From a24f683f0be2e2fff6bb3d73845ff800a47ea016 Mon Sep 17 00:00:00 2001
From: matograine <tom.ngr@zaclys.net>
Date: Fri, 12 Feb 2021 18:12:24 +0100
Subject: [PATCH] [test] [fix] #368 : wrong use of context `with
 pytest.raises() as...`   * fix wrong tests

---
 tests/test_unit_tx.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tests/test_unit_tx.py b/tests/test_unit_tx.py
index 57379c10..89278b6f 100644
--- a/tests/test_unit_tx.py
+++ b/tests/test_unit_tx.py
@@ -193,7 +193,7 @@ def test_compute_amounts_errors(capsys):
                 trial[1],
             )
         assert pytest_exit.type == SystemExit
-        expected_error = "Error: amount {0} is too low.".format(trial[0][0])
+        expected_error = "Error: amount {0} is too low.\n".format(trial[0][0])
         assert capsys.readouterr().out == expected_error
 
 
@@ -1347,9 +1347,9 @@ def test_check_transaction_values_errors(
     assert pytest_exit.type == SystemExit
     display = capsys.readouterr()
     if comment.find("Wrong_Char_") != -1:
-        assert display == "Error: the format of the comment is invalid"
+        assert display.out == "Error: the format of the comment is invalid\n"
     elif len(comment) > tx.MAX_COMMENT_LENGTH:
-        assert display == "Error: the format of the comment is invalid"
+        assert display.out == "Error: Comment is too long\n"
     elif "Wrong_Pubkey" in outputAddresses:
         assert display.out.find("Error: bad format for following public key:") != -1
     elif outputBackChange:
@@ -1360,7 +1360,6 @@ def test_check_transaction_values_errors(
             display.out.find("pubkey doesn’t have enough money for this transaction.")
             != -1
         )
-    assert result == ""
 
 
 # test generate_unlocks()
-- 
GitLab