summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-09-05 14:14:32 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-09-05 14:14:32 (GMT)
commit362c1b513d5b7354f50dd2371d178c493d498a2f (patch)
tree652aa05e30d5ce3965505bd4a59263f3d72890bc /Lib/test/test_inspect.py
parente1040e276b11f21b7007c139269c38d5eba04f5e (diff)
downloadcpython-362c1b513d5b7354f50dd2371d178c493d498a2f.zip
cpython-362c1b513d5b7354f50dd2371d178c493d498a2f.tar.gz
cpython-362c1b513d5b7354f50dd2371d178c493d498a2f.tar.bz2
Issue #18830: inspect.getclasstree() no more produces duplicated entries even
when input list contains duplicates.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r--Lib/test/test_inspect.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 9f5e93b..5cbec9b 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -224,8 +224,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,)),