示例#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"))