Example #1
0
def test_coin_denom_fail():
    coin = Coin(amount=5000, denom="")

    with pytest.raises(
        ValueError, match="Expect denom"
    ):
        coin.validate()
Example #2
0
def test_coin_amount_fail():
    coin = Coin(amount=-5000, denom="uband")

    with pytest.raises(
        ValueError, match="Expect amount more than 0"
    ):
        coin.validate()
Example #3
0
def test_coin_success():
    coin = Coin(amount=5000, denom="uband")

    assert coin.as_json() == {"amount": "5000", "denom": "uband"}

    assert coin.validate() == True