From 95bf6ffdca51ee4258caef80700ad020ff3b8dd9 Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Sun, 29 Mar 2020 15:50:28 +0200
Subject: [PATCH] fixup! [enh] #111 : create compute_amounts() function * Uses
 a list of user amounts and a multiplicator (should be CENT_MULT_TO_UNIT or
 UD_Value). * Multiplies the given amounts(UD) to get usable int() amounts for
 Duniter. * Makes sure that each amountUD is superior to the minimal amount.  
   * Absolute amounts are in FloatRange(MINIMAL_AMOUNT), so they have already
 been checked.     * This check should be updated when solving issue #306 /
 DUBP v13. * Returns list of amounts.

- Do the check after the generation of the amount list
- Change conditions to be more precise and easier to read
- Rename variable to UDs_amounts
- Remove useless commas
---
 tests/test_unit_tx.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/test_unit_tx.py b/tests/test_unit_tx.py
index 780ef082..c6550114 100644
--- a/tests/test_unit_tx.py
+++ b/tests/test_unit_tx.py
@@ -200,7 +200,7 @@ async def test_transaction_confirmation(
 
 # compute_amounts()
 def test_compute_amounts_errors(capsys):
-    trials = (((0.0031, 1,), 314,),)
+    trials = (((0.0031, 1), 314),)
     for trial in trials:
         # check program exit on error
         with pytest.raises(SystemExit) as pytest_exit:
@@ -222,14 +222,14 @@ def test_compute_amounts():
         1,
         2,
     ]
-    assert compute_amounts([0.0032], ud_value,) == [1]
-    assert compute_amounts([1.00], ud_value,) == [314]
-    assert compute_amounts([1.01], ud_value,) == [317]
-    assert compute_amounts([1.99], ud_value,) == [625]
-    assert compute_amounts([1.001], ud_value,) == [314]
-    assert compute_amounts([1.009], ud_value,) == [317]
+    assert compute_amounts([0.0032], ud_value) == [1]
+    assert compute_amounts([1.00], ud_value) == [314]
+    assert compute_amounts([1.01], ud_value) == [317]
+    assert compute_amounts([1.99], ud_value) == [625]
+    assert compute_amounts([1.001], ud_value) == [314]
+    assert compute_amounts([1.009], ud_value) == [317]
     # This case will not happen in real use, but this particular function will allow it.
-    assert compute_amounts([0.0099], 100,) == [1]
+    assert compute_amounts([0.0099], 100) == [1]
 
 
 # transaction_amount()
-- 
GitLab