SomberNight
6 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
5 additions and
2 deletions
-
electrum/tests/test_util.py
-
electrum/util.py
|
|
@ -13,9 +13,12 @@ class TestUtil(SequentialTestCase): |
|
|
|
def test_format_satoshis_negative(self): |
|
|
|
self.assertEqual("-0.00001234", format_satoshis(-1234)) |
|
|
|
|
|
|
|
def test_format_fee(self): |
|
|
|
def test_format_fee_float(self): |
|
|
|
self.assertEqual("1.7", format_fee_satoshis(1700/1000)) |
|
|
|
|
|
|
|
def test_format_fee_decimal(self): |
|
|
|
self.assertEqual("1.7", format_fee_satoshis(Decimal("1.7"))) |
|
|
|
|
|
|
|
def test_format_fee_precision(self): |
|
|
|
self.assertEqual("1.666", |
|
|
|
format_fee_satoshis(1666/1000, precision=6)) |
|
|
|
|
|
@ -514,7 +514,7 @@ def format_satoshis(x, num_zeros=0, decimal_point=8, precision=None, is_diff=Fal |
|
|
|
if precision is None: |
|
|
|
precision = decimal_point |
|
|
|
# format string |
|
|
|
decimal_format = ".0" + str(precision) if precision > 0 else "" |
|
|
|
decimal_format = "." + str(precision) if precision > 0 else "" |
|
|
|
if is_diff: |
|
|
|
decimal_format = '+' + decimal_format |
|
|
|
# initial result |
|
|
|