def unify_helper(arg1: type, arg2: type, exp_result: Union[type, TypeFail]): unify_result = TypeInfo(arg1) >> ( lambda t1: TypeInfo(arg2) >> ( lambda t2: tc.unify(t1, t2))) if isinstance(exp_result, TypeFail): assert isinstance(unify_result, TypeFail) else: eq_(tc.resolve(unify_result.getValue()).getValue(), tc.resolve(exp_result).getValue())
def test_tuple_single_var(): program = """ a = 1, 2 b = 1, 2, 3 c = 1, 2, 3, 4 """ module, _ = cs._parse_text(program) for assign_node in module.nodes_of_class(astroid.Assign): eq_(assign_node.inf_type, TypeInfo(NoType))
def test_tuple_same_length_str(): program = generate_tuple_assign(10, str, True) module, _ = cs._parse_text(program) for assign_node in module.nodes_of_class(astroid.Assign): eq_(assign_node.inf_type, TypeInfo(NoType))