Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply styling to core/tests #4355

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/tests/ethereum_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def make_payload(
prefix: bytes = b"trzd1",
data_type: EthereumDefinitionType = EthereumDefinitionType.NETWORK,
timestamp: int = 0xFFFF_FFFF,
message: messages.EthereumNetworkInfo
| messages.EthereumTokenInfo
| bytes = make_network(),
message: (
messages.EthereumNetworkInfo | messages.EthereumTokenInfo | bytes
) = make_network(),
) -> bytes:
payload = prefix
payload += data_type.to_bytes(1, "little")
Expand Down
6 changes: 3 additions & 3 deletions core/tests/slip39_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
[
"herald flea academic cage avoid space trend estate dryer hairy evoke eyebrow improve airline artwork garlic premium duration prevent oven",
"herald flea academic client blue skunk class goat luxury deny presence impulse graduate clay join blanket bulge survive dish necklace",
"herald flea academic acne advance fused brother frozen broken game ranked ajar already believe check install theory angry exercise adult"
"herald flea academic acne advance fused brother frozen broken game ranked ajar already believe check install theory angry exercise adult",
],
"ad6f2ad8b59bbbaa01369b9006208d9a",
],
Expand All @@ -296,7 +296,7 @@
[
[
"enemy favorite academic acid cowboy phrase havoc level response walnut budget painting inside trash adjust froth kitchen learn tidy punish",
"enemy favorite academic always academic sniff script carpet romp kind promise scatter center unfair training emphasis evening belong fake enforce"
"enemy favorite academic always academic sniff script carpet romp kind promise scatter center unfair training emphasis evening belong fake enforce",
],
"48b1a4b80b8c209ad42c33672bdaa428",
],
Expand All @@ -309,7 +309,7 @@
[
[
"western apart academic always artist resident briefing sugar woman oven coding club ajar merit pecan answer prisoner artist fraction amount desktop mild false necklace muscle photo wealthy alpha category unwrap spew losing making",
"western apart academic acid answer ancient auction flip image penalty oasis beaver multiple thunder problem switch alive heat inherit superior teaspoon explain blanket pencil numb lend punish endless aunt garlic humidity kidney observe"
"western apart academic acid answer ancient auction flip image penalty oasis beaver multiple thunder problem switch alive heat inherit superior teaspoon explain blanket pencil numb lend punish endless aunt garlic humidity kidney observe",
],
"8dc652d6d6cd370d8c963141f6d79ba440300f25c467302c1d966bff8f62300d",
],
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.binance.address.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto.curve import secp256k1
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.binance.sign_tx.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto.curve import secp256k1
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.bitcoin.address.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor import wire
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.bitcoin.address_grs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip32, bip39
Expand Down
10 changes: 6 additions & 4 deletions core/tests/test_apps.bitcoin.approver.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ def setUp(self):
self.msg_auth = AuthorizeCoinJoin(
coordinator=self.coordinator_name,
max_rounds=10,
max_coordinator_fee_rate=int(
self.fee_rate_percent * 10**FEE_RATE_DECIMALS
),
max_coordinator_fee_rate=int(self.fee_rate_percent * 10**FEE_RATE_DECIMALS),
max_fee_per_kvbyte=7000,
address_n=[H_(10025), H_(0), H_(0), H_(1)],
coin_name=self.coin.coin_name,
Expand Down Expand Up @@ -146,7 +144,11 @@ def test_coinjoin_lots_of_inputs(self):
if txo.address_n:
await_result(approver.add_change_output(txo, script_pubkey=bytes(22)))
else:
await_result(approver.add_external_output(txo, script_pubkey=bytes(22), tx_info=tx_info))
await_result(
approver.add_external_output(
txo, script_pubkey=bytes(22), tx_info=tx_info
)
)

await_result(approver.approve_tx(tx_info, [], None))

Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.bitcoin.keychain.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from storage import cache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip39
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip39
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.enums import InputScriptType
Expand Down
13 changes: 10 additions & 3 deletions core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor import wire
Expand Down Expand Up @@ -112,15 +113,19 @@ def test_send_native_p2wpkh(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
details=TxRequestDetailsType(request_index=1, tx_hash=None),
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out2, coin, AmountUnit.BITCOIN, 1, False, [H_(49), H_(1), H_(0)]
),
True,
helpers.UiConfirmTotal(
12300000, 11000, fee_rate, coin, AmountUnit.BITCOIN, inp1.address_n[:3]
Expand Down Expand Up @@ -309,7 +314,9 @@ def test_send_native_p2wpkh_change(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
Expand Down
13 changes: 10 additions & 3 deletions core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip39
Expand Down Expand Up @@ -123,15 +124,19 @@ def test_send_native_p2wpkh(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(84), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(84), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
details=TxRequestDetailsType(request_index=1, tx_hash=None),
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False, [H_(84), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out2, coin, AmountUnit.BITCOIN, 1, False, [H_(84), H_(1), H_(0)]
),
True,
helpers.UiConfirmNonDefaultLocktime(tx.lock_time, lock_time_disabled=False),
True,
Expand Down Expand Up @@ -332,7 +337,9 @@ def test_send_native_p2wpkh_change(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(84), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(84), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
Expand Down
17 changes: 13 additions & 4 deletions core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor import wire
Expand Down Expand Up @@ -114,15 +115,19 @@ def test_send_p2wpkh_in_p2sh(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
details=TxRequestDetailsType(request_index=1, tx_hash=None),
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out2, coin, AmountUnit.BITCOIN, 1, False, [H_(49), H_(1), H_(0)]
),
True,
helpers.UiConfirmTotal(
123445789 + 11000,
Expand Down Expand Up @@ -317,7 +322,9 @@ def test_send_p2wpkh_in_p2sh_change(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
Expand Down Expand Up @@ -531,7 +538,9 @@ def test_send_p2wpkh_in_p2sh_attack_amount(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip39
Expand Down Expand Up @@ -123,15 +124,19 @@ def test_send_p2wpkh_in_p2sh(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
details=TxRequestDetailsType(request_index=1, tx_hash=None),
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out2, coin, AmountUnit.BITCOIN, 1, False, [H_(49), H_(1), H_(0)]
),
True,
helpers.UiConfirmNonDefaultLocktime(tx.lock_time, lock_time_disabled=False),
True,
Expand Down Expand Up @@ -336,7 +341,9 @@ def test_send_p2wpkh_in_p2sh_change(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
),
True,
TxRequest(
request_type=TXOUTPUT,
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.bitcoin.sign_tx.writers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.enums import InputScriptType
Expand Down
5 changes: 4 additions & 1 deletion core/tests/test_apps.bitcoin.signtx.fee_threshold.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip39
Expand Down Expand Up @@ -180,7 +181,9 @@ def test_under_threshold(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin_bitcoin, AmountUnit.BITCOIN, 0, False, None),
helpers.UiConfirmOutput(
out1, coin_bitcoin, AmountUnit.BITCOIN, 0, False, None
),
True,
helpers.UiConfirmMultipleAccounts(),
True,
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.bitcoin.signtx.omni.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from apps.bitcoin.sign_tx.omni import is_valid, parse
Expand Down
5 changes: 4 additions & 1 deletion core/tests/test_apps.bitcoin.signtx.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip39
Expand Down Expand Up @@ -111,7 +112,9 @@ def test_one_one_fee(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin_bitcoin, AmountUnit.BITCOIN, 0, False, [H_(44), H_(0), H_(0)]),
helpers.UiConfirmOutput(
out1, coin_bitcoin, AmountUnit.BITCOIN, 0, False, [H_(44), H_(0), H_(0)]
),
True,
helpers.UiConfirmTotal(
3_801_747,
Expand Down
12 changes: 9 additions & 3 deletions core/tests/test_apps.bitcoin.signtx_decred.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

if utils.INTERNAL_MODEL in ("T2T1", ):
if utils.INTERNAL_MODEL in ("T2T1",): # pylint: disable=internal-model-tuple-comparison
from trezor.crypto import bip39
from trezor.enums import AmountUnit, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
Expand Down Expand Up @@ -112,7 +113,9 @@ def test_one_one_fee(self):
),
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin_decred, AmountUnit.BITCOIN, 0, False, [H_(44), H_(1), H_(0)]),
helpers.UiConfirmOutput(
out1, coin_decred, AmountUnit.BITCOIN, 0, False, [H_(44), H_(1), H_(0)]
),
True,
helpers.UiConfirmTotal(
200_000_000,
Expand Down Expand Up @@ -405,5 +408,8 @@ def test_purchase_ticket(self):


if __name__ == "__main__":
if utils.INTERNAL_MODEL in ("T2T1",):
if utils.INTERNAL_MODEL in ( # pylint: disable=internal-model-tuple-comparison
"T2T1",
):

unittest.main()
5 changes: 4 additions & 1 deletion core/tests/test_apps.bitcoin.signtx_grs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip39
Expand Down Expand Up @@ -112,7 +113,9 @@ def test_one_one_fee(self):
serialized=EMPTY_SERIALIZED,
),
TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False, [H_(44), H_(17), H_(0)]),
helpers.UiConfirmOutput(
out1, coin, AmountUnit.BITCOIN, 0, False, [H_(44), H_(17), H_(0)]
),
True,
helpers.UiConfirmTotal(
210016, 192, fee_rate, coin, AmountUnit.BITCOIN, inp1.address_n[:3]
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.bitcoin.txweight.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.crypto import bip39
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_apps.bitcoin.zcash.zip243.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip

from trezor.enums import InputScriptType
Expand Down
Loading
Loading