def METHOD_NAME(build_node, type_, type_str):
    node = build_node(type_str)
    if type_str == TYPES[type_]:
        t = type_from_annotation(node)
        _check_type_equals(type_, t)
    else:
        with pytest.raises(InvalidType):
            t = type_from_annotation(node)
            _check_type_equals(type_, t)