From deb75884bfe8a47c9143fd7006960c81d956d6d4 Mon Sep 17 00:00:00 2001 From: jp1ac4 <121959000+jp1ac4@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:00:47 +0000 Subject: [PATCH] tests: run black --- tests/test_framework/signer.py | 4 +++- tests/test_framework/utils.py | 4 +++- tests/test_misc.py | 7 +++++-- tests/test_spend.py | 24 +++++++++++++++++++----- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/tests/test_framework/signer.py b/tests/test_framework/signer.py index b0332eb9..51c8e0f2 100644 --- a/tests/test_framework/signer.py +++ b/tests/test_framework/signer.py @@ -93,7 +93,9 @@ def sign_psbt_taproot(psbt, hds): psbt_str = psbt.to_base64() for hd in hds: xprv = hd.get_xpriv() - proc = subprocess.run([bin_path, psbt_str, xprv], capture_output=True, check=True) + proc = subprocess.run( + [bin_path, psbt_str, xprv], capture_output=True, check=True + ) psbt_str = proc.stdout.decode("utf-8") return PSBT.from_base64(psbt_str) diff --git a/tests/test_framework/utils.py b/tests/test_framework/utils.py index ffa50aa3..17b2c0ce 100644 --- a/tests/test_framework/utils.py +++ b/tests/test_framework/utils.py @@ -24,7 +24,9 @@ DEFAULT_BITCOIND_PATH = "bitcoind" BITCOIND_PATH = os.getenv("BITCOIND_PATH", DEFAULT_BITCOIND_PATH) OLD_LIANAD_PATH = os.getenv("OLD_LIANAD_PATH", None) IS_NOT_BITCOIND_24 = bool(int(os.getenv("IS_NOT_BITCOIND_24", True))) -USE_TAPROOT = bool(int(os.getenv("USE_TAPROOT", False))) # TODO: switch to True in a couple releases. +USE_TAPROOT = bool( + int(os.getenv("USE_TAPROOT", False)) +) # TODO: switch to True in a couple releases. COIN = 10**8 diff --git a/tests/test_misc.py b/tests/test_misc.py index c7f29a6d..fecad7c3 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -250,12 +250,15 @@ def test_coinbase_deposit(lianad, bitcoind): assert coin["is_change"] bitcoind.generate_block(100) wait_for_sync() - coin = next(c for c in lianad.rpc.listcoins()["coins"] if c["outpoint"] == coin["outpoint"]) + coin = next( + c for c in lianad.rpc.listcoins()["coins"] if c["outpoint"] == coin["outpoint"] + ) assert not coin["is_immature"] and coin["block_height"] is not None @pytest.mark.skipif( - OLD_LIANAD_PATH is None or USE_TAPROOT, reason="Need the old lianad binary to create the datadir." + OLD_LIANAD_PATH is None or USE_TAPROOT, + reason="Need the old lianad binary to create the datadir.", ) def test_migration(lianad_multisig, bitcoind): """Test we can start a newer lianad on a datadir created by an older lianad.""" diff --git a/tests/test_spend.py b/tests/test_spend.py index 9c496386..deeefc32 100644 --- a/tests/test_spend.py +++ b/tests/test_spend.py @@ -1,6 +1,12 @@ from fixtures import * from test_framework.serializations import PSBT, uint256_from_str -from test_framework.utils import sign_and_broadcast_psbt, wait_for, COIN, RpcError, USE_TAPROOT +from test_framework.utils import ( + sign_and_broadcast_psbt, + wait_for, + COIN, + RpcError, + USE_TAPROOT, +) def test_spend_change(lianad, bitcoind): @@ -334,7 +340,9 @@ def test_coin_selection(lianad, bitcoind): bytes.fromhex(spend_txid_1)[::-1] ) anc_vsize = bitcoind.rpc.getmempoolentry(spend_txid_1)["ancestorsize"] - anc_fees = int(bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN) + anc_fees = int( + bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN + ) additional_fee = additional_fees(anc_vsize, anc_fees, feerate) assert len(spend_res_2["warnings"]) == 1 assert ( @@ -352,7 +360,9 @@ def test_coin_selection(lianad, bitcoind): bytes.fromhex(spend_txid_1)[::-1] ) anc_vsize = bitcoind.rpc.getmempoolentry(spend_txid_1)["ancestorsize"] - anc_fees = int(bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN) + anc_fees = int( + bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN + ) additional_fee = additional_fees(anc_vsize, anc_fees, feerate) assert len(spend_res_2["warnings"]) == 1 assert ( @@ -398,8 +408,12 @@ def test_coin_selection(lianad, bitcoind): anc_vsize = bitcoind.rpc.getmempoolentry(deposit_2)["ancestorsize"] anc_fees = int(bitcoind.rpc.getmempoolentry(deposit_2)["fees"]["ancestor"] * COIN) prev_anc_vsize = bitcoind.rpc.getmempoolentry(spend_txid_1)["ancestorsize"] - prev_anc_fees = int(bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN) - additional_fee = additional_fees(anc_vsize, anc_fees, feerate) + additional_fees(prev_anc_vsize, prev_anc_fees, feerate) + prev_anc_fees = int( + bitcoind.rpc.getmempoolentry(spend_txid_1)["fees"]["ancestor"] * COIN + ) + additional_fee = additional_fees(anc_vsize, anc_fees, feerate) + additional_fees( + prev_anc_vsize, prev_anc_fees, feerate + ) assert len(spend_res_3["warnings"]) == 1 assert ( spend_res_3["warnings"][0]