def check_size(example, size):
tree = ast.parse(example)
for node in tree.body:
if isinstance(node, ast.ClassDef) and node.name == 'Foo':
assert count_lines(node) == size
break
else:
assert False, 'Failed to find top-level class "Foo" in code'
评论列表
文章目录