Пример #1
0
def test_diff_callable():
    c1 = Callable[[bool], bool]
    c2 = Callable[[str], str]

    unify_helper(c1, c2, TypeFail(f'Incompatible Types {c1} and {c2}'))
Пример #2
0
def test_diff_nested_tuples():
    unify_helper(
        Tuple[str, Tuple[str, str]], Tuple[str, Tuple[bool, str]],
        TypeFail(
            f'Incompatible Types {Tuple[str, Tuple[str, str]]} and {Tuple[str, Tuple[bool, str]]}'
        ))
Пример #3
0
def test_diff_list():
    unify_helper(List[str], List[int],
                 TypeFail(f'Incompatible Types {List[str]} and {List[int]}'))
Пример #4
0
def test_diff_tuple():
    unify_helper(
        Tuple[int, int], Tuple[str, str],
        TypeFail(
            f'Incompatible Types {Tuple[int, int]} and {Tuple[str, str]}'))
Пример #5
0
def test_one_forward_ref():
    fr = _ForwardRef('a')
    unify_helper(fr, str,
                 TypeFail("Attempted to unify forwardref  with non-ref"))
Пример #6
0
def test_diff_forward_ref():
    raise SkipTest('The existing error msg does not apply to this situation')
    fr1 = _ForwardRef('a')
    fr2 = _ForwardRef('b')
    unify_helper(fr1, fr2,
                 TypeFail("Attempted to unify forwardref  with non-ref"))
Пример #7
0
def test_diff_prim():
    unify_helper(bool, str, TypeFail(f'Incompatible Types {bool} and {str}'))
    unify_helper(int, str, TypeFail(f'Incompatible Types {int} and {str}'))
    unify_helper(bool, int, TypeFail(f'Incompatible Types {bool} and {int}'))
    unify_helper(float, int, TypeFail(f'Incompatible Types {float} and {int}'))
    unify_helper(float, str, TypeFail(f'Incompatible Types {float} and {str}'))
Пример #8
0
def test_diff_forward_ref():
    skip("The existing error msg does not apply to this situation")
    fr1 = ForwardRef("a")
    fr2 = ForwardRef("b")
    unify_helper(fr1, fr2, TypeFail("Attempted to unify forwardref  with non-ref"))