Skip to content
Snippets Groups Projects
Commit c46c64fd authored by matograine's avatar matograine
Browse files

[enh #203 use texttable in money.py

  * modify related test
parent 2b9f4380
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,6 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>. ...@@ -16,7 +16,6 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
""" """
from click import command, argument, pass_context, echo from click import command, argument, pass_context, echo
from tabulate import tabulate
from silkaj.network_tools import ClientInstance from silkaj.network_tools import ClientInstance
from silkaj.blockchain_tools import HeadBlock from silkaj.blockchain_tools import HeadBlock
...@@ -30,7 +29,7 @@ from silkaj.crypto_tools import ( ...@@ -30,7 +29,7 @@ from silkaj.crypto_tools import (
check_pubkey_format, check_pubkey_format,
validate_checksum, 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.api.bma import tx, blockchain
from duniterpy.documents.transaction import InputSource from duniterpy.documents.transaction import InputSource
...@@ -105,7 +104,10 @@ async def show_amount_from_pubkey(pubkey, inputs_balance): ...@@ -105,7 +104,10 @@ async def show_amount_from_pubkey(pubkey, inputs_balance):
"{0} x M/N".format(round(totalAmountInput / average, 2)), "{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(): async def get_average():
......
...@@ -52,7 +52,7 @@ def test_balance(): ...@@ -52,7 +52,7 @@ def test_balance():
silkaj + ["--gtest", "balance", "3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj"] silkaj + ["--gtest", "balance", "3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj"]
).decode() ).decode()
assert ( assert (
"│ Balance of pubkey │ 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj:EyF" "│ Balance of pubkey │ 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj: │"
in output in output
) )
assert "│ Total amount (unit|relative) │" in output assert "│ Total amount (unit|relative) │" in output
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment