コード例 #1
0
 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'))
     ])
コード例 #2
0
 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)])
コード例 #3
0
 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)])
コード例 #4
0
 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)
     ])