ch11-24: clean up by @eumiro & sync with Atlas
This commit is contained in:
8
17-it-generator/tree/step0/test_tree.py
Normal file
8
17-it-generator/tree/step0/test_tree.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from tree import tree
|
||||
|
||||
|
||||
def test_1_level():
|
||||
class One: pass
|
||||
expected = ['One']
|
||||
result = list(tree(One))
|
||||
assert expected == result
|
||||
11
17-it-generator/tree/step0/tree.py
Normal file
11
17-it-generator/tree/step0/tree.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def tree(cls):
|
||||
yield cls.__name__
|
||||
|
||||
|
||||
def display(cls):
|
||||
for cls_name in tree(cls):
|
||||
print(cls_name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
display(BaseException)
|
||||
Reference in New Issue
Block a user