def test_import(self): m = self.parser.parse_string(''' import foo; import foo.bar; ''') self.assertEqual(m.import_declarations, [ model.ImportDeclaration(model.Name('foo')), model.ImportDeclaration(model.Name('foo.bar')) ])
def test_wildcard_import(self): m = self.parser.parse_string(''' import foo.bar.*; ''') self.assertEqual( m.import_declarations, [model.ImportDeclaration(model.Name('foo.bar'), on_demand=True)])
def test_static_import(self): m = self.parser.parse_string(''' import static foo.bar; ''') self.assertEqual( m.import_declarations, [model.ImportDeclaration(model.Name('foo.bar'), static=True)])
def test_static_wildcard_import(self): m = self.parser.parse_string(''' import static foo.bar.*; ''') self.assertEqual(m.import_declarations, [ model.ImportDeclaration(model.Name('foo.bar', lineno=2), static=True, on_demand=True, lineno=2) ])