|
|
@ -1,7 +1,8 @@ |
|
|
|
from decimal import Decimal |
|
|
|
|
|
|
|
from electrum.util import (format_satoshis, format_fee_satoshis, parse_URI, |
|
|
|
is_hash256_str, chunks, is_ip_address, list_enabled_bits) |
|
|
|
is_hash256_str, chunks, is_ip_address, list_enabled_bits, |
|
|
|
format_satoshis_plain) |
|
|
|
|
|
|
|
from . import ElectrumTestCase |
|
|
|
|
|
|
@ -14,6 +15,12 @@ class TestUtil(ElectrumTestCase): |
|
|
|
def test_format_satoshis_negative(self): |
|
|
|
self.assertEqual("-0.00001234", format_satoshis(-1234)) |
|
|
|
|
|
|
|
def test_format_satoshis_to_mbtc(self): |
|
|
|
self.assertEqual("0.01234", format_satoshis(1234, decimal_point=5)) |
|
|
|
|
|
|
|
def test_format_satoshis_decimal(self): |
|
|
|
self.assertEqual("0.00001234", format_satoshis(Decimal(1234))) |
|
|
|
|
|
|
|
def test_format_fee_float(self): |
|
|
|
self.assertEqual("1.7", format_fee_satoshis(1700/1000)) |
|
|
|
|
|
|
@ -45,6 +52,15 @@ class TestUtil(ElectrumTestCase): |
|
|
|
def test_format_satoshis_diff_negative(self): |
|
|
|
self.assertEqual("-0.00001234", format_satoshis(-1234, is_diff=True)) |
|
|
|
|
|
|
|
def test_format_satoshis_plain(self): |
|
|
|
self.assertEqual("0.00001234", format_satoshis_plain(1234)) |
|
|
|
|
|
|
|
def test_format_satoshis_plain_decimal(self): |
|
|
|
self.assertEqual("0.00001234", format_satoshis_plain(Decimal(1234))) |
|
|
|
|
|
|
|
def test_format_satoshis_plain_to_mbtc(self): |
|
|
|
self.assertEqual("0.01234", format_satoshis_plain(1234, decimal_point=5)) |
|
|
|
|
|
|
|
def _do_test_parse_URI(self, uri, expected): |
|
|
|
result = parse_URI(uri) |
|
|
|
self.assertEqual(expected, result) |
|
|
|