def test_gen_expr_var_scope(self): data = "l = list(n for n in range(10))\n" astroid = builder.parse(data, __name__) # n unavailable outside gen expr scope self.assertNotIn("n", astroid) # test n is inferable anyway n = test_utils.get_name_node(astroid, "n") self.assertIsNot(n.scope(), astroid) self.assertEqual([i.__class__ for i in n.infer()], [util.Uninferable.__class__])
def test_gen_expr_var_scope(self): data = "l = list(n for n in range(10))\n" astroid = builder.parse(data, __name__) # n unavailable outside gen expr scope self.assertNotIn("n", astroid) # test n is inferable anyway n = test_utils.get_name_node(astroid, "n") self.assertIsNot(n.scope(), astroid) self.assertEqual([i.__class__ for i in n.infer()], [util.Uninferable.__class__])
def test_gen_expr_var_scope(self): data = 'l = list(n for n in range(10))\n' astroid = test_utils.build_module(data, __name__) # n unavailable outside gen expr scope self.assertNotIn('n', astroid) # test n is inferable anyway n = test_utils.get_name_node(astroid, 'n') self.assertIsNot(n.scope(), astroid) self.assertEqual([i.__class__ for i in n.infer()], [YES.__class__])
def test_gen_expr_var_scope(self): data = 'l = list(n for n in range(10))\n' astroid = test_utils.build_module(data, __name__) # n unavailable outside gen expr scope self.assertNotIn('n', astroid) # test n is inferable anyway n = test_utils.get_name_node(astroid, 'n') self.assertIsNot(n.scope(), astroid) self.assertEqual([i.__class__ for i in n.infer()], [YES.__class__])