diff options
author | Larry Hastings <larry@hastings.org> | 2015-07-05 17:31:09 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2015-07-05 17:31:09 (GMT) |
commit | ab30353adbef3a3fdd54fb30856af8ff94f2c108 (patch) | |
tree | 4c330aa36e455a7a6223e1488bc7a7a1b384b538 /Lib | |
parent | b34db6ad9b3332c3101bcf7e020e90583693db20 (diff) | |
parent | 95f9dd5e72d6a72db0ad7438b65990cba30cf36b (diff) | |
download | cpython-ab30353adbef3a3fdd54fb30856af8ff94f2c108.zip cpython-ab30353adbef3a3fdd54fb30856af8ff94f2c108.tar.gz cpython-ab30353adbef3a3fdd54fb30856af8ff94f2c108.tar.bz2 |
Merge with ongoing work in 3.5 branch.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_dict.py | 14 | ||||
-rw-r--r-- | Lib/test/test_unpack_ex.py | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 9553c66..2488b63 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -937,6 +937,20 @@ class DictTest(unittest.TestCase): d.popitem() self.check_reentrant_insertion(mutate) + def test_merge_and_mutate(self): + class X: + def __hash__(self): + return 0 + + def __eq__(self, o): + other.clear() + return False + + l = [(i,0) for i in range(1, 1337)] + other = dict(l) + other[X()] = 0 + d = {X(): 0, 1: 1} + self.assertRaises(RuntimeError, d.update, other) from test import mapping_tests diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py index 01f57b9..d27eef0 100644 --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -128,6 +128,9 @@ Dict display element unpacking ... for i in range(1000)) + "}")) 1000 + >>> {0:1, **{0:2}, 0:3, 0:4} + {0: 4} + List comprehension element unpacking >>> a, b, c = [0, 1, 2], 3, 4 |