summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn R. Lenton <jlenton@gmail.com>2014-01-06 19:48:34 +0000
committerJohn R. Lenton <jlenton@gmail.com>2014-01-07 22:51:08 +0000
commit0fcbaa442f538c8ffca8a7387f7dc6d280172a5c (patch)
treec692010a05f3c3d3d8e52e9e09c1359581b49d6e /tests
parentcd0887352d18467ea96728e75255ea36f425450d (diff)
implemented dict.pop
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/tests/dict_pop.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/basics/tests/dict_pop.py b/tests/basics/tests/dict_pop.py
new file mode 100644
index 000000000..602560ce9
--- /dev/null
+++ b/tests/basics/tests/dict_pop.py
@@ -0,0 +1,12 @@
+d = {1: 2, 3: 4}
+print(d.pop(3), d)
+print(d)
+print(d.pop(1, 42), d)
+print(d.pop(1, 42), d)
+print(d.pop(1, None), d)
+try:
+ print(d.pop(1), "!!!",)
+except KeyError:
+ print("Raised KeyError")
+else:
+ print("Did not rise KeyError!")