diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-10-31 04:01:15 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-10-31 04:01:15 (GMT) |
commit | 2c05a2e01b18e9d10cd153308c4866909631e8c0 (patch) | |
tree | 6736bb6f4263c5f6609c74c41eb9e9b0799493b5 /Lib/test/test_descr.py | |
parent | 8afa7fa51064848d826e4eb8a2bd46cf7f730b0f (diff) | |
download | cpython-2c05a2e01b18e9d10cd153308c4866909631e8c0.zip cpython-2c05a2e01b18e9d10cd153308c4866909631e8c0.tar.gz cpython-2c05a2e01b18e9d10cd153308c4866909631e8c0.tar.bz2 |
do safety checks on __qualname__ assignment
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 21c7b8c..b5a10ed 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4502,6 +4502,14 @@ order (MRO) for bases """ self.assertEqual(float.real.__qualname__, 'float.real') self.assertEqual(int.__add__.__qualname__, 'int.__add__') + class X: + pass + with self.assertRaises(TypeError): + del X.__qualname__ + + self.assertRaises(TypeError, type.__dict__['__qualname__'].__set__, + str, 'Oink') + def test_qualname_dict(self): ns = {'__qualname__': 'some.name'} tp = type('Foo', (), ns) |