diff options
author | Raymond Hettinger <python@rcn.com> | 2016-09-08 21:45:40 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-09-08 21:45:40 (GMT) |
commit | 4c483ad52b6f7760a0a861badae6c803d6ce8590 (patch) | |
tree | b4a4883562a12fc4accd126e967b840ff1518bb0 /Lib | |
parent | 33df0c3fb6c48a0434f407732d2a50102923db51 (diff) | |
download | cpython-4c483ad52b6f7760a0a861badae6c803d6ce8590.zip cpython-4c483ad52b6f7760a0a861badae6c803d6ce8590.tar.gz cpython-4c483ad52b6f7760a0a861badae6c803d6ce8590.tar.bz2 |
Merge
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_set.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index 49abfb3..afa6e7f 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -389,6 +389,21 @@ class TestSet(TestJointOps, unittest.TestCase): t = {1,2,3} self.assertEqual(s, t) + def test_set_literal_insertion_order(self): + # SF Issue #26020 -- Expect left to right insertion + s = {1, 1.0, True} + self.assertEqual(len(s), 1) + stored_value = s.pop() + self.assertEqual(type(stored_value), int) + + def test_set_literal_evaluation_order(self): + # Expect left to right expression evaluation + events = [] + def record(obj): + events.append(obj) + s = {record(1), record(2), record(3)} + self.assertEqual(events, [1, 2, 3]) + def test_hash(self): self.assertRaises(TypeError, hash, self.s) |