diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-09-05 14:16:12 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-09-05 14:16:12 (GMT) |
commit | 1e0d82cece755018a022acd5d1f7c0eb890e03db (patch) | |
tree | 733d3c3601f15ecd9020cb41c6dfec2620d5a595 /Lib/test | |
parent | 34d201374ce4bb2c693565ba5fa0c3aa94b490ad (diff) | |
parent | 362c1b513d5b7354f50dd2371d178c493d498a2f (diff) | |
download | cpython-1e0d82cece755018a022acd5d1f7c0eb890e03db.zip cpython-1e0d82cece755018a022acd5d1f7c0eb890e03db.tar.gz cpython-1e0d82cece755018a022acd5d1f7c0eb890e03db.tar.bz2 |
Issue #18830: inspect.getclasstree() no more produces duplicated entries even
when input list contains duplicates.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/inspect_fodder.py | 2 | ||||
-rw-r--r-- | Lib/test/test_inspect.py | 21 |
2 files changed, 21 insertions, 2 deletions
diff --git a/Lib/test/inspect_fodder.py b/Lib/test/inspect_fodder.py index ec96eb7..0c1d810 100644 --- a/Lib/test/inspect_fodder.py +++ b/Lib/test/inspect_fodder.py @@ -49,6 +49,8 @@ class StupidGit: class MalodorousPervert(StupidGit): pass +Tit = MalodorousPervert + class ParrotDroppings: pass diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 5de6212..be55fe4 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -225,8 +225,25 @@ class TestRetrievingSourceCode(GetSourceBase): [('FesteringGob', mod.FesteringGob), ('MalodorousPervert', mod.MalodorousPervert), ('ParrotDroppings', mod.ParrotDroppings), - ('StupidGit', mod.StupidGit)]) - tree = inspect.getclasstree([cls[1] for cls in classes], 1) + ('StupidGit', mod.StupidGit), + ('Tit', mod.MalodorousPervert), + ]) + tree = inspect.getclasstree([cls[1] for cls in classes]) + self.assertEqual(tree, + [(object, ()), + [(mod.ParrotDroppings, (object,)), + [(mod.FesteringGob, (mod.MalodorousPervert, + mod.ParrotDroppings)) + ], + (mod.StupidGit, (object,)), + [(mod.MalodorousPervert, (mod.StupidGit,)), + [(mod.FesteringGob, (mod.MalodorousPervert, + mod.ParrotDroppings)) + ] + ] + ] + ]) + tree = inspect.getclasstree([cls[1] for cls in classes], True) self.assertEqual(tree, [(object, ()), [(mod.ParrotDroppings, (object,)), |