diff --git a/contrib/pyln-client/tests/test_units.py b/contrib/pyln-client/tests/test_units.py index 0af11e168c33..48750a5327d7 100644 --- a/contrib/pyln-client/tests/test_units.py +++ b/contrib/pyln-client/tests/test_units.py @@ -1,4 +1,5 @@ from pyln.client import Millisatoshi +import pytest def test_to_approx_str(): @@ -34,3 +35,13 @@ def test_to_approx_str(): assert amount.to_approx_str() == "12btc" amount = Millisatoshi('1200000000sat') assert amount.to_approx_str(1) == "12btc" # note: no rounding + + +@pytest.mark.xfail +def test_floats(): + amount = Millisatoshi("0.01btc") + assert amount.to_satoshi() == 10**6 + amount = Millisatoshi("0.1sat") + assert int(amount) == 100 + with pytest.raises(ValueError): + amount = Millisatoshi("0.1msat")