Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testResolveWithFilesystem(self):
imp = parsepy.ImportStatement("a")
r = self.make_resolver("b.py", "b")
f = r.resolve_import(imp)
self.assertTrue(isinstance(f, resolve.Local))
self.assertEqual(f.fs, self.py_fs)
self.assertEqual(f.path, "a.py")
self.assertEqual(f.module_name, "a")
def testResolveStarImport(self):
# from foo.c import *
imp = parsepy.ImportStatement("foo.c", is_from=True, is_star=True)
r = self.make_resolver("x.py", "x")
f = r.resolve_import(imp)
self.assertEqual(f.path, "foo/c.py")
self.assertEqual(f.module_name, "foo.c")
def test_multiple_4(self):
self.assertEqual(self.parse("""
import a
import b
import c
import d
"""), [parsepy.ImportStatement(name='a'),
parsepy.ImportStatement(name='b'),
parsepy.ImportStatement(name='c'),
parsepy.ImportStatement(name='d')])