Example #1
0
def test_wrong_type_match_data():
    data = ("hello", "goodbye")
    match_data_and_abi = (
        ("string", (50505050,)),
        ("string", (50505050,)),
    )
    abi_types, match_data = zip(*match_data_and_abi)
    encoded_data = encode_abi(abi_types, data)
    with pytest.raises(ValueError):
        match_fn(match_data_and_abi, encoded_data)
Example #2
0
def test_match_fn_with_various_data_types(data, expected, match_data_and_abi):
    abi_types, match_data = zip(*match_data_and_abi)
    encoded_data = encode_abi(abi_types, data)
    assert match_fn(match_data_and_abi, encoded_data) == expected
def test_match_fn_with_various_data_types_strict(w3_strict_abi, data, expected,
                                                 match_data_and_abi):
    abi_types, match_data = zip(*match_data_and_abi)
    encoded_data = w3_strict_abi.codec.encode_abi(abi_types, data)
    assert match_fn(w3_strict_abi, match_data_and_abi,
                    encoded_data) == expected