def test_absolute_import(self): astroid = abuilder.file_build(self.datapath('absimport.py')) ctx = InferenceContext() ctx.lookupname = 'message' # will fail if absolute import failed next(astroid['message'].infer(ctx)) ctx.lookupname = 'email' m = next(astroid['email'].infer(ctx)) self.assertFalse(m.file.startswith(self.datapath('email.py')))
def test_absolute_import(self): astroid = abuilder.file_build(self.datapath('absimport.py')) ctx = InferenceContext() ctx.lookupname = 'message' # will fail if absolute import failed astroid['message'].infer(ctx).next() ctx.lookupname = 'email' m = astroid['email'].infer(ctx).next() self.assertFalse(m.file.startswith(self.datapath('email.py')))
def test_absolute_import(self): astroid = resources.build_file('data/absimport.py') ctx = InferenceContext() # will fail if absolute import failed ctx.lookupname = 'message' next(astroid['message'].infer(ctx)) ctx.lookupname = 'email' m = next(astroid['email'].infer(ctx)) self.assertFalse(m.file.startswith(os.path.join('data', 'email.py')))
def test_absolute_import(self): astroid = resources.build_file('data/absimport.py') ctx = InferenceContext() # will fail if absolute import failed ctx.lookupname = 'message' next(astroid['message'].infer(ctx)) ctx.lookupname = 'email' m = next(astroid['email'].infer(ctx)) self.assertFalse(m.file.startswith(os.path.join('data', 'email.py')))
def infer_name_module(self, name): context = InferenceContext() context.lookupname = name return self.infer(context, asname=False)
def infer_name_module(self, name): context = InferenceContext() context.lookupname = name return self.infer(context, asname=False)