コード例 #1
0
ファイル: module.py プロジェクト: sjagoe/Python-Grand-Vitesse
    def _children_default(self):
        module_visitor = ModuleVisitor(parent=self)
        for child_ast_node in ast.iter_child_nodes(self.ast_node):
            module_visitor.visit(child_ast_node)

        # Once we have the children, we don't need the ast node!
        self.ast_node = None

        return  module_visitor.children
コード例 #2
0
    def test_children_of_module_with_one_klass_at_module_scope(self):

        ast_node = ast.parse(MODULE_WITH_ONE_KLASS_AT_MODULE_SCOPE)

        module_visitor = ModuleVisitor()
        for child in ast.iter_child_nodes(ast_node):
            module_visitor.visit(child)        

        self.assertEqual(1, len(module_visitor.children))
        self.assertEqual('Foo', module_visitor.children[0].name)
        
        return