diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-01-17 22:41:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-01-17 22:41:18 (GMT) |
commit | c4656004661da0064338b72a334d544a5977c60b (patch) | |
tree | 7c8a32973d3726c94c3cebed425070ae3c938257 /Lib/test | |
parent | 17c7cd8d02361a104aaff4de20b2beb524ae3f47 (diff) | |
download | cpython-c4656004661da0064338b72a334d544a5977c60b.zip cpython-c4656004661da0064338b72a334d544a5977c60b.tar.gz cpython-c4656004661da0064338b72a334d544a5977c60b.tar.bz2 |
Merged revisions 68676 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68676 | benjamin.peterson | 2009-01-17 16:27:54 -0600 (Sat, 17 Jan 2009) | 1 line
fix inspect.isclass() on instances with a custom __getattr__ #1225107
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_inspect.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index b3aa28c..e2fe641 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -74,7 +74,6 @@ class TestPredicates(IsTestBase): def test_excluding_predicates(self): self.istest(inspect.isbuiltin, 'sys.exit') self.istest(inspect.isbuiltin, '[].append') - self.istest(inspect.isclass, 'mod.StupidGit') self.istest(inspect.iscode, 'mod.spam.__code__') self.istest(inspect.isframe, 'tb.tb_frame') self.istest(inspect.isfunction, 'mod.spam') @@ -99,6 +98,15 @@ class TestPredicates(IsTestBase): self.assert_(inspect.isroutine(mod.spam)) self.assert_(inspect.isroutine([].count)) + def test_isclass(self): + self.istest(inspect.isclass, 'mod.StupidGit') + self.assertTrue(inspect.isclass(list)) + + class CustomGetattr(object): + def __getattr__(self, attr): + return None + self.assertFalse(inspect.isclass(CustomGetattr())) + def test_get_slot_members(self): class C(object): __slots__ = ("a", "b") |