コード例 #1
0
def test_ignores_unvalid_data():
    """
        Test function returns an empty string for nonsense data inputs
    """
    assert get_address_type("a") == ""
    assert get_address_type("1") == ""
    assert get_address_type("0x123") == ""
    assert get_address_type("bc1" +
                            "0x0a589899a744c89a70e27db251f09c82ee1bd347") == ""
コード例 #2
0
def test_incomplete_bitcoin_address():
    """
        Test function address is invalid and function returns empty string
    """
    assert get_address_type(bitcoin_addresses["p2pkh"][:-1]) == ""
コード例 #3
0
def test_incomplete_ethereum_address():
    """
        Test function address is invalid and function returns empty string
    """
    assert get_address_type(ethereum_address[:-2]) == ""
コード例 #4
0
def test_bitcoin_segwit_address_validation():
    """
        Test whether function recognizes an Segwit bitcoin address
    """
    assert get_address_type(bitcoin_addresses["segwit"]) == BITCOIN
コード例 #5
0
def test_bitcoin_p2pkh_address_validation():
    """
        Test whether function recognizes an P2PKH bitcoin address
    """
    assert get_address_type(bitcoin_addresses["p2pkh"]) == BITCOIN
コード例 #6
0
def test_ethereum_address_validation():
    """
    Test whether function recognizes an ethereum address
    """
    assert get_address_type(ethereum_address) == ETHEREUM