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)
def test_remove_seq_no(): seq_nos_amounts = ":".join( ['2', '20', '3', '30', '30', '40', '40', '30', '20', '1']) amounts = UTXOAmounts(VALID_ADDR_1, seq_nos_amounts) original_length = len(amounts.data) with pytest.raises(UTXONotFound): amounts.remove_seq_no(35) # UTXOCache.remove_seq_no('35', seq_nos_amounts) assert original_length == len(amounts.data) assert amounts.data == [ '2', '20', '3', '30', '30', '40', '40', '30', '20', '1' ] amounts.remove_seq_no('2') assert original_length == len(amounts.data) + 2 assert amounts.data == ['3', '30', '30', '40', '40', '30', '20', '1'] amounts.remove_seq_no('40', ) assert original_length == len(amounts.data) + 4 assert amounts.data == ['3', '30', '30', '40', '20', '1'] amounts.remove_seq_no('20') assert original_length == len(amounts.data) + 6 assert amounts.data == ['3', '30', '30', '40'] with pytest.raises(UTXONotFound): amounts.remove_seq_no('19') assert original_length == len(amounts.data) + 6 assert amounts.data == ['3', '30', '30', '40'] with pytest.raises(UTXONotFound): amounts.remove_seq_no('40') assert original_length == len(amounts.data) + 6 assert amounts.data == ['3', '30', '30', '40'] amounts.remove_seq_no('30') assert original_length == len(amounts.data) + 8 assert amounts.data == ['3', '30'] amounts.remove_seq_no('3') assert original_length == len(amounts.data) + 10 assert amounts.data == []