diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2016-09-05 21:50:11 (GMT) |
---|---|---|
committer | Eric Snow <ericsnowcurrently@gmail.com> | 2016-09-05 21:50:11 (GMT) |
commit | 92a6c170e6897ee98c36a3a9087b1a7d3e054d2b (patch) | |
tree | 59cbc717ac59e802529bc3ad4e61de161b66ac68 /Lib/test/test_metaclass.py | |
parent | 45659861380a9cd9e41ea002d4de92519ffb3422 (diff) | |
download | cpython-92a6c170e6897ee98c36a3a9087b1a7d3e054d2b.zip cpython-92a6c170e6897ee98c36a3a9087b1a7d3e054d2b.tar.gz cpython-92a6c170e6897ee98c36a3a9087b1a7d3e054d2b.tar.bz2 |
Issue #24254: Preserve class attribute definition order.
Diffstat (limited to 'Lib/test/test_metaclass.py')
-rw-r--r-- | Lib/test/test_metaclass.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_metaclass.py b/Lib/test/test_metaclass.py index e6fe20a..4db792e 100644 --- a/Lib/test/test_metaclass.py +++ b/Lib/test/test_metaclass.py @@ -180,7 +180,7 @@ Use a metaclass that doesn't derive from type. meta: C () ns: [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('a', 42), ('b', 24)] kw: [] - >>> type(C) is dict + >>> type(C) is types._DefaultClassNamespaceType True >>> print(sorted(C.items())) [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('a', 42), ('b', 24)] @@ -211,8 +211,11 @@ And again, with a __prepare__ attribute. The default metaclass must define a __prepare__() method. - >>> type.__prepare__() - {} + >>> ns = type.__prepare__() + >>> type(ns) is types._DefaultClassNamespaceType + True + >>> list(ns) == [] + True >>> Make sure it works with subclassing. @@ -248,7 +251,9 @@ Test failures in looking up the __prepare__ method work. """ +from collections import OrderedDict import sys +import types # Trace function introduces __locals__ which causes various tests to fail. if hasattr(sys, 'gettrace') and sys.gettrace(): |