diff options
author | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-11-20 16:20:16 (GMT) |
---|---|---|
committer | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-11-20 16:20:16 (GMT) |
commit | cc7ebb8f69b84bc48ab2bcccf4f7a30f5e7479d2 (patch) | |
tree | de155ac9a70ceeec0386984932c26ea0a37f6f68 /Lib/test/test_inspect.py | |
parent | 45ec42615725d2c854f3cc04d73fb72017138d54 (diff) | |
download | cpython-cc7ebb8f69b84bc48ab2bcccf4f7a30f5e7479d2.zip cpython-cc7ebb8f69b84bc48ab2bcccf4f7a30f5e7479d2.tar.gz cpython-cc7ebb8f69b84bc48ab2bcccf4f7a30f5e7479d2.tar.bz2 |
Issue 9732: remove use of __class__ in inspect.getattr_static and note the mro exception to code execution
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r-- | Lib/test/test_inspect.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 88c57d3..e320c68 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -855,6 +855,18 @@ class TestGetattrStatic(unittest.TestCase): self.assertEqual(inspect.getattr_static(Thing, 'd'), meta.__dict__['d']) + def test_class_as_property(self): + class Base(object): + foo = 3 + + class Something(Base): + @property + def __class__(self): + return object + + self.assertEqual(inspect.getattr_static(Something(), 'foo'), 3) + self.assertEqual(inspect.getattr_static(Something, 'foo'), 3) + def test_main(): run_unittest( TestDecorators, TestRetrievingSourceCode, TestOneliners, TestBuggyCases, |