summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/dict_construct.py16
-rw-r--r--tests/basics/dict_update.py6
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/basics/dict_construct.py b/tests/basics/dict_construct.py
new file mode 100644
index 0000000000..0035e9c0f9
--- /dev/null
+++ b/tests/basics/dict_construct.py
@@ -0,0 +1,16 @@
+# dict constructor
+
+d = dict()
+print(d)
+
+d = dict({1:2})
+print(d)
+
+d = dict(a=1)
+print(d)
+
+d = dict({1:2}, a=3)
+print(d[1], d['a'])
+
+d = dict([(1, 2)], a=3, b=4)
+print(d[1], d['a'], d['b'])
diff --git a/tests/basics/dict_update.py b/tests/basics/dict_update.py
index 46d1f41b5f..ab1a63304a 100644
--- a/tests/basics/dict_update.py
+++ b/tests/basics/dict_update.py
@@ -8,3 +8,9 @@ print(len(d))
d.update([(1,4)])
print(d[1])
print(len(d))
+
+# using keywords
+d.update(a=5)
+print(d['a'])
+d.update([(1,5)], b=6)
+print(d[1], d['b'])