Ejemplo n.º 1
0
def test_as_str_invalid():
    amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
    amount.data = [10, 11, 12, 5, 13, 6]
    with pytest.raises(TypeError):
        amount.as_str()

    amount.data = ['10', '11', '12', '5', '13', '6']
    val = amount.as_str()
    assert val == '10:11:12:5:13:6'
Ejemplo n.º 2
0
def test_as_str():
    amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
    str_val = amount.as_str()
    assert str_val == "1:100:2:332"

    amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
    amount.data = ["1", "100", "2"]
    with pytest.raises(UTXOError):
        amount.as_str()
Ejemplo n.º 3
0
def test_as_output_list():
    amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
    output_list = amount.as_output_list()
    assert len(output_list) == 2
    for o in output_list:
        assert isinstance(o, Output)

    amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
    amount.data = ["1", "100", "2"]
    with pytest.raises(UTXOError):
        amount.as_output_list()
Ejemplo n.º 4
0
def test_remove_seq_no():
    amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
    amount.remove_seq_no(2)
    assert len(amount.data) == 2

    amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
    with pytest.raises(UTXOError):
        amount.remove_seq_no(534)

    amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
    amount.data = ["1", "100", "2"]
    with pytest.raises(UTXOError):
        amount.remove_seq_no(2)