|
|
|
|
@ -3,17 +3,17 @@ import pytest
|
|
|
|
|
from decimal import Decimal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_btc_to_sat(): |
|
|
|
|
def test_btc_to_sat() -> None: |
|
|
|
|
assert(btc.btc_to_sat(Decimal("0.00000001")) == 1) |
|
|
|
|
assert(btc.btc_to_sat(Decimal("1.00000000")) == 100000000) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_sat_to_btc(): |
|
|
|
|
def test_sat_to_btc() -> None: |
|
|
|
|
assert(btc.sat_to_btc(1) == Decimal("0.00000001")) |
|
|
|
|
assert(btc.sat_to_btc(100000000) == Decimal("1.00000000")) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_amount_to_sat(): |
|
|
|
|
def test_amount_to_sat() -> None: |
|
|
|
|
assert(btc.amount_to_sat("1") == 1) |
|
|
|
|
assert(btc.amount_to_sat("1sat") == 1) |
|
|
|
|
assert(btc.amount_to_sat("1.123sat") == 1) |
|
|
|
|
@ -30,7 +30,7 @@ def test_amount_to_sat():
|
|
|
|
|
btc.amount_to_sat("123inv") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_amount_to_btc(): |
|
|
|
|
def test_amount_to_btc() -> None: |
|
|
|
|
assert(btc.amount_to_btc("1") == Decimal("0.00000001")) |
|
|
|
|
assert(btc.amount_to_btc("1sat") == Decimal("0.00000001")) |
|
|
|
|
assert(btc.amount_to_btc("1.123sat") == Decimal("0.00000001")) |
|
|
|
|
@ -47,7 +47,7 @@ def test_amount_to_btc():
|
|
|
|
|
btc.amount_to_btc("123inv") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_amount_to_sat_str(): |
|
|
|
|
def test_amount_to_sat_str() -> None: |
|
|
|
|
assert(btc.amount_to_sat_str("1") == "1 sat") |
|
|
|
|
assert(btc.amount_to_sat_str("1sat") == "1 sat") |
|
|
|
|
assert(btc.amount_to_sat_str("1.123sat") == "1 sat") |
|
|
|
|
@ -64,7 +64,7 @@ def test_amount_to_sat_str():
|
|
|
|
|
btc.amount_to_sat_str("123inv") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_amount_to_btc_str(): |
|
|
|
|
def test_amount_to_btc_str() -> None: |
|
|
|
|
assert(btc.amount_to_btc_str("1") == "0.00000001 BTC") |
|
|
|
|
assert(btc.amount_to_btc_str("1sat") == "0.00000001 BTC") |
|
|
|
|
assert(btc.amount_to_btc_str("1.123sat") == "0.00000001 BTC") |
|
|
|
|
@ -81,7 +81,7 @@ def test_amount_to_btc_str():
|
|
|
|
|
btc.amount_to_btc_str("123inv") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_amount_to_str(): |
|
|
|
|
def test_amount_to_str() -> None: |
|
|
|
|
assert(btc.amount_to_str("1") == "0.00000001 BTC (1 sat)") |
|
|
|
|
assert(btc.amount_to_str("1sat") == "0.00000001 BTC (1 sat)") |
|
|
|
|
assert(btc.amount_to_str("1.123sat") == "0.00000001 BTC (1 sat)") |
|
|
|
|
@ -98,19 +98,19 @@ def test_amount_to_str():
|
|
|
|
|
btc.amount_to_str("123inv") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_sat_to_str(): |
|
|
|
|
def test_sat_to_str() -> None: |
|
|
|
|
assert(btc.sat_to_str(1) == "0.00000001") |
|
|
|
|
assert(btc.sat_to_str(100000000) == "1.00000000") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_sat_to_str_p(): |
|
|
|
|
def test_sat_to_str_p() -> None: |
|
|
|
|
assert(btc.sat_to_str_p(1) == "+0.00000001") |
|
|
|
|
assert(btc.sat_to_str_p(-1) == "-0.00000001") |
|
|
|
|
assert(btc.sat_to_str_p(100000000) == "+1.00000000") |
|
|
|
|
assert(btc.sat_to_str_p(-100000000) == "-1.00000000") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_fee_per_kb_to_str(): |
|
|
|
|
def test_fee_per_kb_to_str() -> None: |
|
|
|
|
assert(btc.fee_per_kb_to_str(1000) == "1000 sat/vkB (1.0 sat/vB)") |
|
|
|
|
assert(btc.fee_per_kb_to_str(1234) == "1234 sat/vkB (1.2 sat/vB)") |
|
|
|
|
assert(btc.fee_per_kb_to_str(1999) == "1999 sat/vkB (1.9 sat/vB)") |
|
|
|
|
|