diff options
| author | Eric Snow <ericsnowcurrently@gmail.com> | 2012-10-17 05:35:38 (GMT) |
|---|---|---|
| committer | Eric Snow <ericsnowcurrently@gmail.com> | 2012-10-17 05:35:38 (GMT) |
| commit | 547298c94cd491dbfaa7bc5f968c2bdcf91588cc (patch) | |
| tree | ec3b7ab445ce7b9042990843536fd930fe9863dd /Lib | |
| parent | e54c7185727ca7e46abc6484181c781ff5b0a4eb (diff) | |
| download | cpython-547298c94cd491dbfaa7bc5f968c2bdcf91588cc.zip cpython-547298c94cd491dbfaa7bc5f968c2bdcf91588cc.tar.gz cpython-547298c94cd491dbfaa7bc5f968c2bdcf91588cc.tar.bz2 | |
Close #16160: Subclass support now works for types.SimpleNamespace. Thanks to RDM for noticing.
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/test/test_types.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 3f5ac98..3ee4c6b 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -1135,6 +1135,15 @@ class SimpleNamespaceTests(unittest.TestCase): with self.assertRaises(TypeError): ns['spam'] + def test_subclass(self): + class Spam(types.SimpleNamespace): + pass + + spam = Spam(ham=8, eggs=9) + + self.assertIs(type(spam), Spam) + self.assertEqual(vars(spam), {'ham': 8, 'eggs': 9}) + def test_main(): run_unittest(TypesTests, MappingProxyTests, ClassCreationTests, |
