Пример #1
0
 def testImportFromMultiple(self):
     imp1 = util.Import('foo.bar')
     imp1.add_binding(util.Import.MODULE, 'bar', util.Import.LEAF)
     imp2 = util.Import('foo.baz')
     imp2.add_binding(util.Import.MODULE, 'baz', util.Import.LEAF)
     self._assert_imports_equal(
         [imp1, imp2], self._visit_import('from foo import bar, baz'))
Пример #2
0
 def testImportMultiple(self):
     imp1 = util.Import('foo')
     imp1.add_binding(util.Import.MODULE, 'foo', util.Import.ROOT)
     imp2 = util.Import('bar')
     imp2.add_binding(util.Import.MODULE, 'bar', util.Import.ROOT)
     self._assert_imports_equal([imp1, imp2],
                                self._visit_import('import foo, bar'))
Пример #3
0
 def testImportFromNativeAs(self):
     imp = util.Import('fmt', is_native=True)
     imp.add_binding(util.Import.MEMBER, 'foo', 'Printf')
     self._assert_imports_equal(
         imp, self._visit_import('from __go__.fmt import Printf as foo'))
Пример #4
0
 def testImportFromAs(self):
     imp = util.Import('foo.bar')
     imp.add_binding(util.Import.MODULE, 'baz', util.Import.LEAF)
     self._assert_imports_equal(
         imp, self._visit_import('from foo import bar as baz'))
Пример #5
0
 def testImportAs(self):
     imp = util.Import('foo')
     imp.add_binding(util.Import.MODULE, 'bar', util.Import.LEAF)
     self._assert_imports_equal(imp,
                                self._visit_import('import foo as bar'))
Пример #6
0
 def testImport(self):
     imp = util.Import('foo')
     imp.add_binding(util.Import.MODULE, 'foo', util.Import.ROOT)
     self._assert_imports_equal(imp, self._visit_import('import foo'))