summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 46cf2d3..dafcf00 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1968,6 +1968,15 @@ class TestType(unittest.TestCase):
with self.assertRaises(TypeError):
type('A', (B,), {'__slots__': '__weakref__'})
+ def test_namespace_order(self):
+ # bpo-34320: namespace should preserve order
+ od = collections.OrderedDict([('a', 1), ('b', 2)])
+ od.move_to_end('a')
+ expected = list(od.items())
+
+ C = type('C', (), od)
+ self.assertEqual(list(C.__dict__.items())[:2], [('b', 2), ('a', 1)])
+
def load_tests(loader, tests, pattern):
from doctest import DocTestSuite