From c46c64fda84bb83af49acaf534eb0cacaa9b5908 Mon Sep 17 00:00:00 2001 From: matograine <tom.ngr@zaclys.net> Date: Fri, 11 Dec 2020 17:01:08 +0100 Subject: [PATCH] [enh #203 use texttable in money.py * modify related test --- silkaj/money.py | 8 +++++--- tests/test_end_to_end.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/silkaj/money.py b/silkaj/money.py index 0cc875eb..31d95ade 100644 --- a/silkaj/money.py +++ b/silkaj/money.py @@ -16,7 +16,6 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>. """ from click import command, argument, pass_context, echo -from tabulate import tabulate from silkaj.network_tools import ClientInstance from silkaj.blockchain_tools import HeadBlock @@ -30,7 +29,7 @@ from silkaj.crypto_tools import ( check_pubkey_format, validate_checksum, ) -from silkaj.tui import display_amount, display_pubkey_and_checksum +from silkaj.tui import display_amount, display_pubkey_and_checksum, create_table from duniterpy.api.bma import tx, blockchain from duniterpy.documents.transaction import InputSource @@ -105,7 +104,10 @@ async def show_amount_from_pubkey(pubkey, inputs_balance): "{0} x M/N".format(round(totalAmountInput / average, 2)), ] ) - echo(tabulate(display, tablefmt="fancy_grid")) + table = create_table() + table.set_header_align(["l", "l"]) + table.add_rows(display) + echo(table.draw()) async def get_average(): diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py index 9dc2fe2f..76fd8a2b 100644 --- a/tests/test_end_to_end.py +++ b/tests/test_end_to_end.py @@ -52,7 +52,7 @@ def test_balance(): silkaj + ["--gtest", "balance", "3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj"] ).decode() assert ( - "│ Balance of pubkey │ 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj:EyF │" + "│ Balance of pubkey │ 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj: │" in output ) assert "│ Total amount (unit|relative) │" in output -- GitLab