Example #1
0
 def testResolveRelativeFromInitFileWithModule(self):
     parent = resolve.Direct("baz/__init__.py", "baz")
     imp = parsepy.ImportStatement(".f")
     r = resolve.Resolver(self.path, parent)
     f = r.resolve_import(imp)
     self.assertTrue(isinstance(f, resolve.Local))
     self.assertEqual(f.path, "baz/f.py")
     self.assertEqual(f.module_name, "baz.f")
Example #2
0
 def testResolveRelativeSymbol(self):
     # importing the Symbol object from baz/__init__.py while in baz/f.py
     parent = resolve.Direct("baz/f.py", "baz.f")
     imp = parsepy.ImportStatement(".Symbol", is_from=True)
     r = resolve.Resolver(self.path, parent)
     f = r.resolve_import(imp)
     self.assertTrue(isinstance(f, resolve.Local))
     self.assertEqual(f.path, "baz/__init__.py")
     self.assertEqual(f.module_name, "baz")
Example #3
0
 def get_source_file_provenance(self, filename):
     return resolve.Direct(filename, "module.name")