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'))
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'))
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'))
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'))
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'))
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'))