From d44a51ef4969eba663a77030251506f33a5b8c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Fri, 15 Nov 2024 13:55:14 +0100 Subject: [PATCH 1/4] style(core/tests): silent star import warnings --- core/tests/test_apps.binance.address.py | 1 + core/tests/test_apps.binance.sign_tx.py | 1 + core/tests/test_apps.bitcoin.address.py | 1 + core/tests/test_apps.bitcoin.address_grs.py | 1 + core/tests/test_apps.bitcoin.keychain.py | 1 + core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py | 1 + core/tests/test_apps.bitcoin.segwit.bip143.p2wpkh_in_p2sh.py | 1 + core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py | 1 + core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py | 1 + core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py | 1 + core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py | 1 + core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py | 1 + core/tests/test_apps.bitcoin.sign_tx.writers.py | 1 + core/tests/test_apps.bitcoin.signtx.fee_threshold.py | 1 + core/tests/test_apps.bitcoin.signtx.omni.py | 1 + core/tests/test_apps.bitcoin.signtx.py | 1 + core/tests/test_apps.bitcoin.signtx_decred.py | 1 + core/tests/test_apps.bitcoin.signtx_grs.py | 1 + core/tests/test_apps.bitcoin.txweight.py | 1 + core/tests/test_apps.bitcoin.zcash.zip243.py | 1 + core/tests/test_apps.cardano.address.py | 1 + core/tests/test_apps.cardano.bech32.py | 1 + core/tests/test_apps.cardano.certificate.py | 1 + core/tests/test_apps.cardano.credential.py | 1 + core/tests/test_apps.cardano.get_public_key.py | 1 + core/tests/test_apps.cardano.native_script.py | 1 + core/tests/test_apps.cardano.seed.py | 1 + core/tests/test_apps.cardano.utils.py | 1 + core/tests/test_apps.common.cbor.py | 1 + core/tests/test_apps.common.coins.py | 1 + core/tests/test_apps.common.keychain.py | 1 + core/tests/test_apps.common.paths.py | 1 + core/tests/test_apps.common.seed.py | 1 + core/tests/test_apps.common.writers.py | 1 + core/tests/test_apps.eos.check_action.py | 1 + core/tests/test_apps.eos.conversions.py | 1 + core/tests/test_apps.eos.get_public_key.py | 1 + core/tests/test_apps.ethereum.definitions.py | 1 + core/tests/test_apps.ethereum.helpers.py | 1 + core/tests/test_apps.ethereum.keychain.py | 1 + core/tests/test_apps.ethereum.layout.py | 1 + core/tests/test_apps.ethereum.sign_typed_data.py | 1 + core/tests/test_apps.ethereum.tokens.py | 1 + core/tests/test_apps.management.recovery_device.py | 1 + core/tests/test_apps.monero.bulletproof.py | 1 + core/tests/test_apps.monero.clsag.py | 1 + core/tests/test_apps.monero.crypto.py | 1 + core/tests/test_apps.monero.proto.py | 1 + core/tests/test_apps.monero.serializer.py | 1 + core/tests/test_apps.nem.address.py | 1 + core/tests/test_apps.nem.hdnode.py | 1 + core/tests/test_apps.nem.mosaic.py | 1 + core/tests/test_apps.nem.mosaic_creation.py | 1 + core/tests/test_apps.nem.mosaic_supply_change.py | 1 + core/tests/test_apps.nem.multisig.aggregate_modification.py | 1 + core/tests/test_apps.nem.multisig.py | 1 + core/tests/test_apps.nem.namespace.py | 1 + core/tests/test_apps.nem.transfer.py | 1 + core/tests/test_apps.ripple.address.py | 1 + core/tests/test_apps.ripple.serializer.py | 1 + core/tests/test_apps.stellar.address.py | 1 + core/tests/test_apps.tezos.address.py | 1 + core/tests/test_apps.tezos.encode.py | 1 + core/tests/test_apps.thp.credential_manager.py | 1 + core/tests/test_apps.webauthn.credential.py | 1 + core/tests/test_apps.zcash.f4jumble.py | 1 + core/tests/test_apps.zcash.unified_addresses.py | 1 + core/tests/test_apps.zcash.zip244.py | 1 + core/tests/test_storage.cache.py | 1 + core/tests/test_storage.py | 1 + core/tests/test_trezor.config.py | 1 + core/tests/test_trezor.crypto.aes.py | 1 + core/tests/test_trezor.crypto.aesgcm.py | 1 + core/tests/test_trezor.crypto.base32.py | 1 + core/tests/test_trezor.crypto.base58.py | 1 + core/tests/test_trezor.crypto.bech32.py | 1 + core/tests/test_trezor.crypto.bip32.py | 1 + core/tests/test_trezor.crypto.bip39.py | 1 + core/tests/test_trezor.crypto.cashaddr.py | 1 + core/tests/test_trezor.crypto.chacha20poly1305.py | 1 + core/tests/test_trezor.crypto.cosi.py | 1 + core/tests/test_trezor.crypto.crc.py | 1 + core/tests/test_trezor.crypto.curve.bip340.py | 1 + core/tests/test_trezor.crypto.curve.curve25519.py | 1 + core/tests/test_trezor.crypto.curve.ed25519.py | 1 + core/tests/test_trezor.crypto.curve.nist256p1.py | 1 + core/tests/test_trezor.crypto.curve.secp256k1.py | 1 + core/tests/test_trezor.crypto.der.py | 1 + core/tests/test_trezor.crypto.elligator2.py | 1 + core/tests/test_trezor.crypto.hashlib.blake256.py | 1 + core/tests/test_trezor.crypto.hashlib.blake2b.py | 1 + core/tests/test_trezor.crypto.hashlib.blake2s.py | 1 + core/tests/test_trezor.crypto.hashlib.groestl512.py | 1 + core/tests/test_trezor.crypto.hashlib.ripemd160.py | 1 + core/tests/test_trezor.crypto.hashlib.sha1.py | 1 + core/tests/test_trezor.crypto.hashlib.sha256.py | 1 + core/tests/test_trezor.crypto.hashlib.sha3_256.py | 1 + core/tests/test_trezor.crypto.hashlib.sha3_512.py | 1 + core/tests/test_trezor.crypto.hashlib.sha512.py | 1 + core/tests/test_trezor.crypto.hmac.py | 1 + core/tests/test_trezor.crypto.pbkdf2.py | 1 + core/tests/test_trezor.crypto.random.py | 1 + core/tests/test_trezor.crypto.rlp.py | 1 + core/tests/test_trezor.crypto.slip39.py | 1 + core/tests/test_trezor.io.fatfs.py | 1 + core/tests/test_trezor.io.sdcard.py | 1 + core/tests/test_trezor.protobuf.py | 1 + core/tests/test_trezor.sdcard.py | 1 + core/tests/test_trezor.strings.py | 1 + core/tests/test_trezor.ui.display.py | 1 + core/tests/test_trezor.utils.py | 1 + core/tests/test_trezor.wire.codec_v1.py | 1 + core/tests/test_unittest.py | 1 + 113 files changed, 113 insertions(+) diff --git a/core/tests/test_apps.binance.address.py b/core/tests/test_apps.binance.address.py index c1a9ae92675..59f364f5ec3 100644 --- a/core/tests/test_apps.binance.address.py +++ b/core/tests/test_apps.binance.address.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto.curve import secp256k1 diff --git a/core/tests/test_apps.binance.sign_tx.py b/core/tests/test_apps.binance.sign_tx.py index 699d5ead020..9c1e9c35da0 100644 --- a/core/tests/test_apps.binance.sign_tx.py +++ b/core/tests/test_apps.binance.sign_tx.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto.curve import secp256k1 diff --git a/core/tests/test_apps.bitcoin.address.py b/core/tests/test_apps.bitcoin.address.py index 1808c3d2aad..ec8d4d4c077 100644 --- a/core/tests/test_apps.bitcoin.address.py +++ b/core/tests/test_apps.bitcoin.address.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import wire diff --git a/core/tests/test_apps.bitcoin.address_grs.py b/core/tests/test_apps.bitcoin.address_grs.py index d4ce7619236..724e8f95b86 100644 --- a/core/tests/test_apps.bitcoin.address_grs.py +++ b/core/tests/test_apps.bitcoin.address_grs.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip32, bip39 diff --git a/core/tests/test_apps.bitcoin.keychain.py b/core/tests/test_apps.bitcoin.keychain.py index 3828a3ebbcf..c0541416a06 100644 --- a/core/tests/test_apps.bitcoin.keychain.py +++ b/core/tests/test_apps.bitcoin.keychain.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from storage import cache diff --git a/core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py b/core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py index ebfb98c6beb..b93e7658020 100644 --- a/core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py +++ b/core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.segwit.bip143.p2wpkh_in_p2sh.py b/core/tests/test_apps.bitcoin.segwit.bip143.p2wpkh_in_p2sh.py index 7a5457b8674..a5fcad4ebbd 100644 --- a/core/tests/test_apps.bitcoin.segwit.bip143.p2wpkh_in_p2sh.py +++ b/core/tests/test_apps.bitcoin.segwit.bip143.p2wpkh_in_p2sh.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py b/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py index e234069aaf2..bec4b1aa279 100644 --- a/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py +++ b/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.enums import InputScriptType diff --git a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py index c7f0e42cd6b..49743b0516b 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import wire diff --git a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py index 6860dd79772..dac240f903c 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py b/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py index 8e0f5928712..3187c65ec88 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import wire diff --git a/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py b/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py index 0abf34cacbb..549fa2d04b2 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.sign_tx.writers.py b/core/tests/test_apps.bitcoin.sign_tx.writers.py index 5a9f951637e..f2588bd5457 100644 --- a/core/tests/test_apps.bitcoin.sign_tx.writers.py +++ b/core/tests/test_apps.bitcoin.sign_tx.writers.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.enums import InputScriptType diff --git a/core/tests/test_apps.bitcoin.signtx.fee_threshold.py b/core/tests/test_apps.bitcoin.signtx.fee_threshold.py index 9aebc7b07ac..9352c633339 100644 --- a/core/tests/test_apps.bitcoin.signtx.fee_threshold.py +++ b/core/tests/test_apps.bitcoin.signtx.fee_threshold.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.signtx.omni.py b/core/tests/test_apps.bitcoin.signtx.omni.py index 7474db0fe67..b6893db4740 100644 --- a/core/tests/test_apps.bitcoin.signtx.omni.py +++ b/core/tests/test_apps.bitcoin.signtx.omni.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from apps.bitcoin.sign_tx.omni import is_valid, parse diff --git a/core/tests/test_apps.bitcoin.signtx.py b/core/tests/test_apps.bitcoin.signtx.py index 1d8a0339a62..a2dfe23ad4a 100644 --- a/core/tests/test_apps.bitcoin.signtx.py +++ b/core/tests/test_apps.bitcoin.signtx.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.signtx_decred.py b/core/tests/test_apps.bitcoin.signtx_decred.py index 3b4a881277b..c0131fd5c1b 100644 --- a/core/tests/test_apps.bitcoin.signtx_decred.py +++ b/core/tests/test_apps.bitcoin.signtx_decred.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if utils.INTERNAL_MODEL in ("T2T1", ): diff --git a/core/tests/test_apps.bitcoin.signtx_grs.py b/core/tests/test_apps.bitcoin.signtx_grs.py index 8fd6e7cd0d4..63209375334 100644 --- a/core/tests/test_apps.bitcoin.signtx_grs.py +++ b/core/tests/test_apps.bitcoin.signtx_grs.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.txweight.py b/core/tests/test_apps.bitcoin.txweight.py index 2e91170b9fb..229b5bd02f9 100644 --- a/core/tests/test_apps.bitcoin.txweight.py +++ b/core/tests/test_apps.bitcoin.txweight.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.zcash.zip243.py b/core/tests/test_apps.bitcoin.zcash.zip243.py index 5395c63dc7c..b6d1f48aee5 100644 --- a/core/tests/test_apps.bitcoin.zcash.zip243.py +++ b/core/tests/test_apps.bitcoin.zcash.zip243.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.enums import InputScriptType diff --git a/core/tests/test_apps.cardano.address.py b/core/tests/test_apps.cardano.address.py index 140992bc135..c1fb264661e 100644 --- a/core/tests/test_apps.cardano.address.py +++ b/core/tests/test_apps.cardano.address.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import wire diff --git a/core/tests/test_apps.cardano.bech32.py b/core/tests/test_apps.cardano.bech32.py index 560b6da2c75..097db529927 100644 --- a/core/tests/test_apps.cardano.bech32.py +++ b/core/tests/test_apps.cardano.bech32.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from apps.cardano.helpers import bech32 diff --git a/core/tests/test_apps.cardano.certificate.py b/core/tests/test_apps.cardano.certificate.py index f4dc1379f35..e0399249d51 100644 --- a/core/tests/test_apps.cardano.certificate.py +++ b/core/tests/test_apps.cardano.certificate.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import wire diff --git a/core/tests/test_apps.cardano.credential.py b/core/tests/test_apps.cardano.credential.py index 86719efc714..a86dbc42d0d 100644 --- a/core/tests/test_apps.cardano.credential.py +++ b/core/tests/test_apps.cardano.credential.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.enums import CardanoAddressType diff --git a/core/tests/test_apps.cardano.get_public_key.py b/core/tests/test_apps.cardano.get_public_key.py index 846219bbae6..61e46277c14 100644 --- a/core/tests/test_apps.cardano.get_public_key.py +++ b/core/tests/test_apps.cardano.get_public_key.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import cardano, slip39 diff --git a/core/tests/test_apps.cardano.native_script.py b/core/tests/test_apps.cardano.native_script.py index 633670c06fe..3a188f7c956 100644 --- a/core/tests/test_apps.cardano.native_script.py +++ b/core/tests/test_apps.cardano.native_script.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import wire diff --git a/core/tests/test_apps.cardano.seed.py b/core/tests/test_apps.cardano.seed.py index aa95dde49ec..31700bfa84c 100644 --- a/core/tests/test_apps.cardano.seed.py +++ b/core/tests/test_apps.cardano.seed.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import cardano diff --git a/core/tests/test_apps.cardano.utils.py b/core/tests/test_apps.cardano.utils.py index 53a40286f22..be4670260f0 100644 --- a/core/tests/test_apps.cardano.utils.py +++ b/core/tests/test_apps.cardano.utils.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.common.cbor.py b/core/tests/test_apps.common.cbor.py index 0de5777f75b..dd0f588c1a8 100644 --- a/core/tests/test_apps.common.cbor.py +++ b/core/tests/test_apps.common.cbor.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from apps.common.cbor import ( diff --git a/core/tests/test_apps.common.coins.py b/core/tests/test_apps.common.coins.py index 860fa798c27..f36b8ede7bf 100644 --- a/core/tests/test_apps.common.coins.py +++ b/core/tests/test_apps.common.coins.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from apps.common import coins diff --git a/core/tests/test_apps.common.keychain.py b/core/tests/test_apps.common.keychain.py index 84681a0b01e..7a15c51532b 100644 --- a/core/tests/test_apps.common.keychain.py +++ b/core/tests/test_apps.common.keychain.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from mock_storage import mock_storage diff --git a/core/tests/test_apps.common.paths.py b/core/tests/test_apps.common.paths.py index e9c88bdae5e..97f631d94a3 100644 --- a/core/tests/test_apps.common.paths.py +++ b/core/tests/test_apps.common.paths.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.utils import ensure diff --git a/core/tests/test_apps.common.seed.py b/core/tests/test_apps.common.seed.py index 3ea7cd8e8d6..1757c12d132 100644 --- a/core/tests/test_apps.common.seed.py +++ b/core/tests/test_apps.common.seed.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import wire diff --git a/core/tests/test_apps.common.writers.py b/core/tests/test_apps.common.writers.py index 289f0a54717..629142c56fd 100644 --- a/core/tests/test_apps.common.writers.py +++ b/core/tests/test_apps.common.writers.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip import apps.common.writers as writers diff --git a/core/tests/test_apps.eos.check_action.py b/core/tests/test_apps.eos.check_action.py index 5a7d4ff1172..8350f9b6fd9 100644 --- a/core/tests/test_apps.eos.check_action.py +++ b/core/tests/test_apps.eos.check_action.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.eos.conversions.py b/core/tests/test_apps.eos.conversions.py index dfa2ef8fc58..a69c5b41f55 100644 --- a/core/tests/test_apps.eos.conversions.py +++ b/core/tests/test_apps.eos.conversions.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.eos.get_public_key.py b/core/tests/test_apps.eos.get_public_key.py index a9af6695d9a..e07502d3429 100644 --- a/core/tests/test_apps.eos.get_public_key.py +++ b/core/tests/test_apps.eos.get_public_key.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip32, bip39 diff --git a/core/tests/test_apps.ethereum.definitions.py b/core/tests/test_apps.ethereum.definitions.py index e1365c3f59c..e72567c8731 100644 --- a/core/tests/test_apps.ethereum.definitions.py +++ b/core/tests/test_apps.ethereum.definitions.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip import typing as t diff --git a/core/tests/test_apps.ethereum.helpers.py b/core/tests/test_apps.ethereum.helpers.py index c812ccfb96f..5c0bbdfda7b 100644 --- a/core/tests/test_apps.ethereum.helpers.py +++ b/core/tests/test_apps.ethereum.helpers.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.ethereum.keychain.py b/core/tests/test_apps.ethereum.keychain.py index 53affef1b73..3b9110101ea 100644 --- a/core/tests/test_apps.ethereum.keychain.py +++ b/core/tests/test_apps.ethereum.keychain.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip import unittest diff --git a/core/tests/test_apps.ethereum.layout.py b/core/tests/test_apps.ethereum.layout.py index d912a87c9a5..61fdd7e0e4a 100644 --- a/core/tests/test_apps.ethereum.layout.py +++ b/core/tests/test_apps.ethereum.layout.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.ethereum.sign_typed_data.py b/core/tests/test_apps.ethereum.sign_typed_data.py index e8a261886a1..6dba7da7ab2 100644 --- a/core/tests/test_apps.ethereum.sign_typed_data.py +++ b/core/tests/test_apps.ethereum.sign_typed_data.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import wire diff --git a/core/tests/test_apps.ethereum.tokens.py b/core/tests/test_apps.ethereum.tokens.py index af1728ce5fd..7065ca135d8 100644 --- a/core/tests/test_apps.ethereum.tokens.py +++ b/core/tests/test_apps.ethereum.tokens.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.management.recovery_device.py b/core/tests/test_apps.management.recovery_device.py index f1d876afae1..adabe9e3af8 100644 --- a/core/tests/test_apps.management.recovery_device.py +++ b/core/tests/test_apps.management.recovery_device.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip import storage diff --git a/core/tests/test_apps.monero.bulletproof.py b/core/tests/test_apps.monero.bulletproof.py index 86e2dcd2f66..1518e30a960 100644 --- a/core/tests/test_apps.monero.bulletproof.py +++ b/core/tests/test_apps.monero.bulletproof.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.monero.clsag.py b/core/tests/test_apps.monero.clsag.py index a4775e79054..7fcf9fe8093 100644 --- a/core/tests/test_apps.monero.clsag.py +++ b/core/tests/test_apps.monero.clsag.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.monero.crypto.py b/core/tests/test_apps.monero.crypto.py index 6ab505e6cda..9d98c80bc02 100644 --- a/core/tests/test_apps.monero.crypto.py +++ b/core/tests/test_apps.monero.crypto.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.monero.proto.py b/core/tests/test_apps.monero.proto.py index f515683d68c..3ed74ef4fb3 100644 --- a/core/tests/test_apps.monero.proto.py +++ b/core/tests/test_apps.monero.proto.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.monero.serializer.py b/core/tests/test_apps.monero.serializer.py index 7f11afbd395..ac883a69a7b 100644 --- a/core/tests/test_apps.monero.serializer.py +++ b/core/tests/test_apps.monero.serializer.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import utils diff --git a/core/tests/test_apps.nem.address.py b/core/tests/test_apps.nem.address.py index 22266d80303..0a00938bb85 100644 --- a/core/tests/test_apps.nem.address.py +++ b/core/tests/test_apps.nem.address.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from apps.common.paths import HARDENED diff --git a/core/tests/test_apps.nem.hdnode.py b/core/tests/test_apps.nem.hdnode.py index 3e9ae858edf..8c41c4f14d4 100644 --- a/core/tests/test_apps.nem.hdnode.py +++ b/core/tests/test_apps.nem.hdnode.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip32 diff --git a/core/tests/test_apps.nem.mosaic.py b/core/tests/test_apps.nem.mosaic.py index 9fd8916d104..94f3ee194fb 100644 --- a/core/tests/test_apps.nem.mosaic.py +++ b/core/tests/test_apps.nem.mosaic.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.nem.mosaic_creation.py b/core/tests/test_apps.nem.mosaic_creation.py index 38eedce9fea..181d5e7a71e 100644 --- a/core/tests/test_apps.nem.mosaic_creation.py +++ b/core/tests/test_apps.nem.mosaic_creation.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_apps.nem.mosaic_supply_change.py b/core/tests/test_apps.nem.mosaic_supply_change.py index 578035ab6ae..490a7a8a003 100644 --- a/core/tests/test_apps.nem.mosaic_supply_change.py +++ b/core/tests/test_apps.nem.mosaic_supply_change.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_apps.nem.multisig.aggregate_modification.py b/core/tests/test_apps.nem.multisig.aggregate_modification.py index 3ab8a639509..b2e225ef340 100644 --- a/core/tests/test_apps.nem.multisig.aggregate_modification.py +++ b/core/tests/test_apps.nem.multisig.aggregate_modification.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_apps.nem.multisig.py b/core/tests/test_apps.nem.multisig.py index bb183c73444..3c02a8112ec 100644 --- a/core/tests/test_apps.nem.multisig.py +++ b/core/tests/test_apps.nem.multisig.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.nem.namespace.py b/core/tests/test_apps.nem.namespace.py index 02361e0ac7c..3d28b69f250 100644 --- a/core/tests/test_apps.nem.namespace.py +++ b/core/tests/test_apps.nem.namespace.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_apps.nem.transfer.py b/core/tests/test_apps.nem.transfer.py index 4e3419800e6..c368b8f0eb9 100644 --- a/core/tests/test_apps.nem.transfer.py +++ b/core/tests/test_apps.nem.transfer.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_apps.ripple.address.py b/core/tests/test_apps.ripple.address.py index 4b85cd07cbc..c5cd1d73678 100644 --- a/core/tests/test_apps.ripple.address.py +++ b/core/tests/test_apps.ripple.address.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.ripple.serializer.py b/core/tests/test_apps.ripple.serializer.py index 8c174a90cce..837820f0bea 100644 --- a/core/tests/test_apps.ripple.serializer.py +++ b/core/tests/test_apps.ripple.serializer.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.stellar.address.py b/core/tests/test_apps.stellar.address.py index e9cbe159ade..b808e9260f5 100644 --- a/core/tests/test_apps.stellar.address.py +++ b/core/tests/test_apps.stellar.address.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.wire import ProcessError diff --git a/core/tests/test_apps.tezos.address.py b/core/tests/test_apps.tezos.address.py index 4484797fa67..748419e760b 100644 --- a/core/tests/test_apps.tezos.address.py +++ b/core/tests/test_apps.tezos.address.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.tezos.encode.py b/core/tests/test_apps.tezos.encode.py index 1f87ff5cad3..ad9d15b7af4 100644 --- a/core/tests/test_apps.tezos.encode.py +++ b/core/tests/test_apps.tezos.encode.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.thp.credential_manager.py b/core/tests/test_apps.thp.credential_manager.py index 771930e6c11..c66b99985dc 100644 --- a/core/tests/test_apps.thp.credential_manager.py +++ b/core/tests/test_apps.thp.credential_manager.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * from trezor import config, utils from trezor import log diff --git a/core/tests/test_apps.webauthn.credential.py b/core/tests/test_apps.webauthn.credential.py index f5babf58b6f..84294821573 100644 --- a/core/tests/test_apps.webauthn.credential.py +++ b/core/tests/test_apps.webauthn.credential.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip import storage diff --git a/core/tests/test_apps.zcash.f4jumble.py b/core/tests/test_apps.zcash.f4jumble.py index fe897603f46..215b64ffb7e 100644 --- a/core/tests/test_apps.zcash.f4jumble.py +++ b/core/tests/test_apps.zcash.f4jumble.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from apps.zcash.f4jumble import f4jumble, f4unjumble diff --git a/core/tests/test_apps.zcash.unified_addresses.py b/core/tests/test_apps.zcash.unified_addresses.py index e7e77d04fb5..b7d2aba2f17 100644 --- a/core/tests/test_apps.zcash.unified_addresses.py +++ b/core/tests/test_apps.zcash.unified_addresses.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from apps.common import coininfo diff --git a/core/tests/test_apps.zcash.zip244.py b/core/tests/test_apps.zcash.zip244.py index 519339427f3..3ead9b97277 100644 --- a/core/tests/test_apps.zcash.zip244.py +++ b/core/tests/test_apps.zcash.zip244.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.enums import InputScriptType diff --git a/core/tests/test_storage.cache.py b/core/tests/test_storage.cache.py index 76fe29655b9..f523403dbe2 100644 --- a/core/tests/test_storage.cache.py +++ b/core/tests/test_storage.cache.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from mock_storage import mock_storage diff --git a/core/tests/test_storage.py b/core/tests/test_storage.py index 062ed8f74b6..5e697c5cd63 100644 --- a/core/tests/test_storage.py +++ b/core/tests/test_storage.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from storage import device diff --git a/core/tests/test_trezor.config.py b/core/tests/test_trezor.config.py index 1ebd3875287..4eb1dfc34f9 100644 --- a/core/tests/test_trezor.config.py +++ b/core/tests/test_trezor.config.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import config diff --git a/core/tests/test_trezor.crypto.aes.py b/core/tests/test_trezor.crypto.aes.py index e33ed40be38..20957f89049 100644 --- a/core/tests/test_trezor.crypto.aes.py +++ b/core/tests/test_trezor.crypto.aes.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import aes diff --git a/core/tests/test_trezor.crypto.aesgcm.py b/core/tests/test_trezor.crypto.aesgcm.py index 78e834bb975..54cc3c0bd54 100644 --- a/core/tests/test_trezor.crypto.aesgcm.py +++ b/core/tests/test_trezor.crypto.aesgcm.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import aesgcm diff --git a/core/tests/test_trezor.crypto.base32.py b/core/tests/test_trezor.crypto.base32.py index 58bbb5d4db6..f93c0c5ecdc 100644 --- a/core/tests/test_trezor.crypto.base32.py +++ b/core/tests/test_trezor.crypto.base32.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import base32 diff --git a/core/tests/test_trezor.crypto.base58.py b/core/tests/test_trezor.crypto.base58.py index 006cce66e0c..63903b8e006 100644 --- a/core/tests/test_trezor.crypto.base58.py +++ b/core/tests/test_trezor.crypto.base58.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import base58 diff --git a/core/tests/test_trezor.crypto.bech32.py b/core/tests/test_trezor.crypto.bech32.py index 168d3e8c595..a48f1807cce 100644 --- a/core/tests/test_trezor.crypto.bech32.py +++ b/core/tests/test_trezor.crypto.bech32.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip # Copyright (c) 2017, 2020 Pieter Wuille diff --git a/core/tests/test_trezor.crypto.bip32.py b/core/tests/test_trezor.crypto.bip32.py index 8bcc7bfe3be..46f21544c82 100644 --- a/core/tests/test_trezor.crypto.bip32.py +++ b/core/tests/test_trezor.crypto.bip32.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip32 diff --git a/core/tests/test_trezor.crypto.bip39.py b/core/tests/test_trezor.crypto.bip39.py index 4d2feef13ef..8584a0ddc3b 100644 --- a/core/tests/test_trezor.crypto.bip39.py +++ b/core/tests/test_trezor.crypto.bip39.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import bip39 diff --git a/core/tests/test_trezor.crypto.cashaddr.py b/core/tests/test_trezor.crypto.cashaddr.py index 2a1f63d3723..42fda52c572 100644 --- a/core/tests/test_trezor.crypto.cashaddr.py +++ b/core/tests/test_trezor.crypto.cashaddr.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip # Copyright (c) 2017 Pieter Wuille diff --git a/core/tests/test_trezor.crypto.chacha20poly1305.py b/core/tests/test_trezor.crypto.chacha20poly1305.py index f4f022dc8a8..754f61fd4fe 100644 --- a/core/tests/test_trezor.crypto.chacha20poly1305.py +++ b/core/tests/test_trezor.crypto.chacha20poly1305.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import chacha20poly1305 diff --git a/core/tests/test_trezor.crypto.cosi.py b/core/tests/test_trezor.crypto.cosi.py index 24d6a23faee..61ea3677e4d 100644 --- a/core/tests/test_trezor.crypto.cosi.py +++ b/core/tests/test_trezor.crypto.cosi.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import cosi, random diff --git a/core/tests/test_trezor.crypto.crc.py b/core/tests/test_trezor.crypto.crc.py index 3beddfb166e..a56bce4ebd7 100644 --- a/core/tests/test_trezor.crypto.crc.py +++ b/core/tests/test_trezor.crypto.crc.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import crc diff --git a/core/tests/test_trezor.crypto.curve.bip340.py b/core/tests/test_trezor.crypto.curve.bip340.py index 121b1f2a5f8..2f29d619c86 100644 --- a/core/tests/test_trezor.crypto.curve.bip340.py +++ b/core/tests/test_trezor.crypto.curve.bip340.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import random diff --git a/core/tests/test_trezor.crypto.curve.curve25519.py b/core/tests/test_trezor.crypto.curve.curve25519.py index 0cc3401f038..9a99eea4960 100644 --- a/core/tests/test_trezor.crypto.curve.curve25519.py +++ b/core/tests/test_trezor.crypto.curve.curve25519.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto.curve import curve25519 diff --git a/core/tests/test_trezor.crypto.curve.ed25519.py b/core/tests/test_trezor.crypto.curve.ed25519.py index 7cfb31b20ab..22f85abeacb 100644 --- a/core/tests/test_trezor.crypto.curve.ed25519.py +++ b/core/tests/test_trezor.crypto.curve.ed25519.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import random diff --git a/core/tests/test_trezor.crypto.curve.nist256p1.py b/core/tests/test_trezor.crypto.curve.nist256p1.py index 4a065449916..c15535f7f66 100644 --- a/core/tests/test_trezor.crypto.curve.nist256p1.py +++ b/core/tests/test_trezor.crypto.curve.nist256p1.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import random diff --git a/core/tests/test_trezor.crypto.curve.secp256k1.py b/core/tests/test_trezor.crypto.curve.secp256k1.py index de633c0eca9..ebdbea8aa3d 100644 --- a/core/tests/test_trezor.crypto.curve.secp256k1.py +++ b/core/tests/test_trezor.crypto.curve.secp256k1.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import random diff --git a/core/tests/test_trezor.crypto.der.py b/core/tests/test_trezor.crypto.der.py index f7792ebe804..cad1431e7e7 100644 --- a/core/tests/test_trezor.crypto.der.py +++ b/core/tests/test_trezor.crypto.der.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import der diff --git a/core/tests/test_trezor.crypto.elligator2.py b/core/tests/test_trezor.crypto.elligator2.py index 1c4189fcfd1..f68352fe9dc 100644 --- a/core/tests/test_trezor.crypto.elligator2.py +++ b/core/tests/test_trezor.crypto.elligator2.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * if utils.USE_THP: diff --git a/core/tests/test_trezor.crypto.hashlib.blake256.py b/core/tests/test_trezor.crypto.hashlib.blake256.py index d73cc30a606..4fe16160f12 100644 --- a/core/tests/test_trezor.crypto.hashlib.blake256.py +++ b/core/tests/test_trezor.crypto.hashlib.blake256.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.blake2b.py b/core/tests/test_trezor.crypto.hashlib.blake2b.py index 674564cb541..ce2fa038a07 100644 --- a/core/tests/test_trezor.crypto.hashlib.blake2b.py +++ b/core/tests/test_trezor.crypto.hashlib.blake2b.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.blake2s.py b/core/tests/test_trezor.crypto.hashlib.blake2s.py index 5b1e7e56fbe..91260b02838 100644 --- a/core/tests/test_trezor.crypto.hashlib.blake2s.py +++ b/core/tests/test_trezor.crypto.hashlib.blake2s.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.groestl512.py b/core/tests/test_trezor.crypto.hashlib.groestl512.py index a72a84d89ad..c07c045884d 100644 --- a/core/tests/test_trezor.crypto.hashlib.groestl512.py +++ b/core/tests/test_trezor.crypto.hashlib.groestl512.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.ripemd160.py b/core/tests/test_trezor.crypto.hashlib.ripemd160.py index 4c28fe506df..19a13699e14 100644 --- a/core/tests/test_trezor.crypto.hashlib.ripemd160.py +++ b/core/tests/test_trezor.crypto.hashlib.ripemd160.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.sha1.py b/core/tests/test_trezor.crypto.hashlib.sha1.py index b6ee71134cb..21d76287a0e 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha1.py +++ b/core/tests/test_trezor.crypto.hashlib.sha1.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.sha256.py b/core/tests/test_trezor.crypto.hashlib.sha256.py index 571f54a4f05..48ee0d02bd1 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha256.py +++ b/core/tests/test_trezor.crypto.hashlib.sha256.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.sha3_256.py b/core/tests/test_trezor.crypto.hashlib.sha3_256.py index 2ed633fa9f6..7e8645bf134 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha3_256.py +++ b/core/tests/test_trezor.crypto.hashlib.sha3_256.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.sha3_512.py b/core/tests/test_trezor.crypto.hashlib.sha3_512.py index 4d3db4da1da..ae90fdd7bd6 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha3_512.py +++ b/core/tests/test_trezor.crypto.hashlib.sha3_512.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hashlib.sha512.py b/core/tests/test_trezor.crypto.hashlib.sha512.py index 34df4dae437..0b835e6ee89 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha512.py +++ b/core/tests/test_trezor.crypto.hashlib.sha512.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hashlib diff --git a/core/tests/test_trezor.crypto.hmac.py b/core/tests/test_trezor.crypto.hmac.py index 3debda40448..40aa78b8b1e 100644 --- a/core/tests/test_trezor.crypto.hmac.py +++ b/core/tests/test_trezor.crypto.hmac.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import hmac diff --git a/core/tests/test_trezor.crypto.pbkdf2.py b/core/tests/test_trezor.crypto.pbkdf2.py index 77ddf6de41e..69542ee811f 100644 --- a/core/tests/test_trezor.crypto.pbkdf2.py +++ b/core/tests/test_trezor.crypto.pbkdf2.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import pbkdf2 diff --git a/core/tests/test_trezor.crypto.random.py b/core/tests/test_trezor.crypto.random.py index 59f8aa9cf70..890f92cc705 100644 --- a/core/tests/test_trezor.crypto.random.py +++ b/core/tests/test_trezor.crypto.random.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import random diff --git a/core/tests/test_trezor.crypto.rlp.py b/core/tests/test_trezor.crypto.rlp.py index 9ecbf6781f4..be852e9f099 100644 --- a/core/tests/test_trezor.crypto.rlp.py +++ b/core/tests/test_trezor.crypto.rlp.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.crypto import rlp diff --git a/core/tests/test_trezor.crypto.slip39.py b/core/tests/test_trezor.crypto.slip39.py index 26367957f82..4fa298e74c6 100644 --- a/core/tests/test_trezor.crypto.slip39.py +++ b/core/tests/test_trezor.crypto.slip39.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from slip39_vectors import vectors diff --git a/core/tests/test_trezor.io.fatfs.py b/core/tests/test_trezor.io.fatfs.py index c2b29eb9aad..2467a587fc1 100644 --- a/core/tests/test_trezor.io.fatfs.py +++ b/core/tests/test_trezor.io.fatfs.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import utils diff --git a/core/tests/test_trezor.io.sdcard.py b/core/tests/test_trezor.io.sdcard.py index 6697e80c21c..7dd9f2b9508 100644 --- a/core/tests/test_trezor.io.sdcard.py +++ b/core/tests/test_trezor.io.sdcard.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import io, utils diff --git a/core/tests/test_trezor.protobuf.py b/core/tests/test_trezor.protobuf.py index 6418819bf9c..0d04e3edfab 100644 --- a/core/tests/test_trezor.protobuf.py +++ b/core/tests/test_trezor.protobuf.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import protobuf diff --git a/core/tests/test_trezor.sdcard.py b/core/tests/test_trezor.sdcard.py index 3846c5faaed..783682e9318 100644 --- a/core/tests/test_trezor.sdcard.py +++ b/core/tests/test_trezor.sdcard.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import io, sdcard, utils diff --git a/core/tests/test_trezor.strings.py b/core/tests/test_trezor.strings.py index ef39ab7e210..3b48d9e6793 100644 --- a/core/tests/test_trezor.strings.py +++ b/core/tests/test_trezor.strings.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import strings diff --git a/core/tests/test_trezor.ui.display.py b/core/tests/test_trezor.ui.display.py index 60dec5e8012..3dac73498db 100644 --- a/core/tests/test_trezor.ui.display.py +++ b/core/tests/test_trezor.ui.display.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor.ui import display diff --git a/core/tests/test_trezor.utils.py b/core/tests/test_trezor.utils.py index b764b3ffe95..015bf7a3bea 100644 --- a/core/tests/test_trezor.utils.py +++ b/core/tests/test_trezor.utils.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip from trezor import utils diff --git a/core/tests/test_trezor.wire.codec_v1.py b/core/tests/test_trezor.wire.codec_v1.py index 1da0ea896b4..a7ca816136a 100644 --- a/core/tests/test_trezor.wire.codec_v1.py +++ b/core/tests/test_trezor.wire.codec_v1.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip import ustruct diff --git a/core/tests/test_unittest.py b/core/tests/test_unittest.py index abbe990060b..9d0cdef7bc0 100644 --- a/core/tests/test_unittest.py +++ b/core/tests/test_unittest.py @@ -1,3 +1,4 @@ +# flake8: noqa: F403,F405 from common import * # isort:skip From d081f185b1e9fd29aca391631412ea3edece4831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Fri, 15 Nov 2024 14:17:38 +0100 Subject: [PATCH 2/4] style(core/tests): fix warnings --- core/tests/test_apps.bitcoin.signtx_decred.py | 7 +++++-- core/tests/test_apps.cardano.address.py | 2 +- core/tests/test_apps.common.coins.py | 4 +++- core/tests/test_apps.ethereum.definitions.py | 8 ++++---- core/tests/test_apps.ethereum.sign_typed_data.py | 1 + .../test_apps.management.recovery_device.py | 16 ++++++++-------- core/tests/test_apps.monero.bulletproof.py | 2 +- core/tests/test_apps.monero.clsag.py | 2 +- core/tests/test_apps.thp.credential_manager.py | 2 +- core/tests/test_apps.zcash.zip244.py | 2 +- core/tests/test_storage.cache.py | 2 +- core/tests/test_trezor.crypto.base32.py | 14 ++++++-------- core/tests/test_trezor.crypto.bech32.py | 7 +++---- core/tests/test_trezor.crypto.cashaddr.py | 7 +++---- core/tests/test_trezor.crypto.curve.ed25519.py | 2 +- .../test_trezor.crypto.hashlib.groestl512.py | 10 ++++------ .../test_trezor.crypto.hashlib.ripemd160.py | 2 +- core/tests/test_trezor.crypto.hashlib.sha1.py | 12 +++++------- core/tests/test_trezor.crypto.hashlib.sha256.py | 12 +++++------- .../tests/test_trezor.crypto.hashlib.sha3_256.py | 12 +++++------- .../tests/test_trezor.crypto.hashlib.sha3_512.py | 12 +++++------- core/tests/test_trezor.crypto.hashlib.sha512.py | 12 +++++------- core/tests/test_trezor.crypto.hmac.py | 8 ++++---- core/tests/test_trezor.crypto.pbkdf2.py | 8 ++++---- core/tests/test_trezor.crypto.slip39.py | 4 ++-- core/tests/test_trezor.utils.py | 5 ++++- core/tests/unittest.py | 3 ++- 27 files changed, 86 insertions(+), 92 deletions(-) diff --git a/core/tests/test_apps.bitcoin.signtx_decred.py b/core/tests/test_apps.bitcoin.signtx_decred.py index c0131fd5c1b..8d55c1d63d5 100644 --- a/core/tests/test_apps.bitcoin.signtx_decred.py +++ b/core/tests/test_apps.bitcoin.signtx_decred.py @@ -1,7 +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 @@ -406,5 +406,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() diff --git a/core/tests/test_apps.cardano.address.py b/core/tests/test_apps.cardano.address.py index c1fb264661e..c5575a6fbf9 100644 --- a/core/tests/test_apps.cardano.address.py +++ b/core/tests/test_apps.cardano.address.py @@ -628,7 +628,7 @@ def test_derive_address(self): for ( network_id, - address_type, + _, address_parameters, expected_address, ) in test_vectors: diff --git a/core/tests/test_apps.common.coins.py b/core/tests/test_apps.common.coins.py index f36b8ede7bf..901a0b37829 100644 --- a/core/tests/test_apps.common.coins.py +++ b/core/tests/test_apps.common.coins.py @@ -23,7 +23,9 @@ def test_altcoins(self): ("ZEC", "Zcash", 7352), ("TAZ", "Zcash Testnet", 7461), ] - if utils.INTERNAL_MODEL in ("T2T1",): + if utils.INTERNAL_MODEL in ( # pylint: disable=internal-model-tuple-comparison + "T2T1", + ): ref.extend( [ ("NMC", "Namecoin", 52), diff --git a/core/tests/test_apps.ethereum.definitions.py b/core/tests/test_apps.ethereum.definitions.py index e72567c8731..894b1a6fb2e 100644 --- a/core/tests/test_apps.ethereum.definitions.py +++ b/core/tests/test_apps.ethereum.definitions.py @@ -58,7 +58,7 @@ def test_not_enough_signatures(self): def test_missing_signature(self): payload = make_payload() - proof, signature = sign_payload(payload, []) + proof, _ = sign_payload(payload, []) self.assertFailed(payload + proof) def test_mangled_payload(self): @@ -69,7 +69,7 @@ def test_mangled_payload(self): def test_proof_length_mismatch(self): payload = make_payload() - proof, signature = sign_payload(payload, []) + _, signature = sign_payload(payload, []) bad_proof = b"\x01" self.assertFailed(payload + bad_proof + signature) @@ -133,13 +133,13 @@ def assertUnknown(self, what: t.Any) -> None: return if what is tokens.UNKNOWN_TOKEN: return - self.fail("Expected UNKNOWN_*, got %r" % what) + self.fail(f"Expected UNKNOWN_*, got {what}") def assertKnown(self, what: t.Any) -> None: if not EthereumNetworkInfo.is_type_of( what ) and not EthereumTokenInfo.is_type_of(what): - self.fail("Expected network / token info, got %r" % what) + self.fail(f"Expected network / token info, got {what}") if what is networks.UNKNOWN_NETWORK: self.fail("Expected known network, got UNKNOWN_NETWORK") if what is tokens.UNKNOWN_TOKEN: diff --git a/core/tests/test_apps.ethereum.sign_typed_data.py b/core/tests/test_apps.ethereum.sign_typed_data.py index 6dba7da7ab2..136170ad31a 100644 --- a/core/tests/test_apps.ethereum.sign_typed_data.py +++ b/core/tests/test_apps.ethereum.sign_typed_data.py @@ -135,6 +135,7 @@ def parse_type_n(type_name: str) -> int: buf += char else: return int("".join(reversed(buf))) + raise ValueError(f"Invalid type name: {type_name}") def parse_array_n(type_name: str) -> Union[int, str]: diff --git a/core/tests/test_apps.management.recovery_device.py b/core/tests/test_apps.management.recovery_device.py index adabe9e3af8..e3fec11a896 100644 --- a/core/tests/test_apps.management.recovery_device.py +++ b/core/tests/test_apps.management.recovery_device.py @@ -175,19 +175,19 @@ def test_exceptions(self): storage.recovery.set_in_progress(True) words = MNEMONIC_SLIP39_BASIC_20_3of6[0] - secret, share = process_slip39(words) + secret, _ = process_slip39(words) self.assertIsNone(secret) # same mnemonic words = MNEMONIC_SLIP39_BASIC_20_3of6[0] with self.assertRaises(RuntimeError): - secret, share = process_slip39(words) + secret, _ = process_slip39(words) self.assertIsNone(secret) # identifier mismatch words = MNEMONIC_SLIP39_ADVANCED_20[0] with self.assertRaises(RuntimeError): - secret, share = process_slip39(words) + secret, _ = process_slip39(words) self.assertIsNone(secret) # same identifier but different group settings @@ -200,7 +200,7 @@ def test_exceptions(self): w[19] = "merchant" words = " ".join(w) with self.assertRaises(RuntimeError): - secret, share = process_slip39(words) + secret, _ = process_slip39(words) self.assertIsNone(secret) @mock_storage @@ -218,11 +218,11 @@ def test_check_word_validity(self): check(BackupType.Bip39, ["ocean"]) # let's store two shares in the storage - secret, share = process_slip39( + secret, _ = process_slip39( "trash smug adjust ambition criminal prisoner security math cover pecan response pharmacy center criminal salary elbow bracelet lunar briefing dragon" ) self.assertIsNone(secret) - secret, share = process_slip39( + secret, _ = process_slip39( "trash smug adjust aide benefit temple round clogs devote prevent type cards clogs plastic aspect paper behavior lunar custody intimate" ) self.assertIsNone(secret) @@ -244,11 +244,11 @@ def test_check_word_validity(self): check(BackupType.Slip39_Advanced, ["trash", "smug", "adjust", "ambition"]) # Let's store two more. The group is 4/6 so this group is now complete. - secret, share = process_slip39( + secret, _ = process_slip39( "trash smug adjust arena beard quick language program true hush amount round geology should training practice language diet order ruin" ) self.assertIsNone(secret) - secret, share = process_slip39( + secret, _ = process_slip39( "trash smug adjust beam brave sack magazine radar toxic emission domestic cradle vocal petition mule toxic acid hobo welcome downtown" ) self.assertIsNone(secret) diff --git a/core/tests/test_apps.monero.bulletproof.py b/core/tests/test_apps.monero.bulletproof.py index 1518e30a960..d94cbbde7e8 100644 --- a/core/tests/test_apps.monero.bulletproof.py +++ b/core/tests/test_apps.monero.bulletproof.py @@ -14,7 +14,7 @@ def test_square_multiply(self): ss = crypto.random_scalar() s1 = crypto.sc_copy(None, ss) s2 = crypto.sc_copy(None, ss) - for i in range(1, x): + for _ in range(1, x): crypto.sc_mul_into(s1, s1, ss) bp._sc_square_mult(s2, ss, x) diff --git a/core/tests/test_apps.monero.clsag.py b/core/tests/test_apps.monero.clsag.py index 7fcf9fe8093..c697fe4933b 100644 --- a/core/tests/test_apps.monero.clsag.py +++ b/core/tests/test_apps.monero.clsag.py @@ -108,7 +108,7 @@ def gen_clsag_sig(self, ring_size=11, index=None): Cp = crypto.add_keys2_into(None, alpha, amnt, crypto.xmr_H()) ring = [] - for i in range(ring_size - 1): + for _ in range(ring_size - 1): tk = TmpKey( crypto_helpers.encodepoint( crypto.scalarmult_base_into(None, crypto.random_scalar()) diff --git a/core/tests/test_apps.thp.credential_manager.py b/core/tests/test_apps.thp.credential_manager.py index c66b99985dc..f62aa3bb9d1 100644 --- a/core/tests/test_apps.thp.credential_manager.py +++ b/core/tests/test_apps.thp.credential_manager.py @@ -1,5 +1,5 @@ # flake8: noqa: F403,F405 -from common import * +from common import * # isort: skip from trezor import config, utils from trezor import log diff --git a/core/tests/test_apps.zcash.zip244.py b/core/tests/test_apps.zcash.zip244.py index 3ead9b97277..b4947a14dd0 100644 --- a/core/tests/test_apps.zcash.zip244.py +++ b/core/tests/test_apps.zcash.zip244.py @@ -139,7 +139,7 @@ def test_zcash_hasher(self): self.assertEqual(computed_txid, expected_txid) # test ZcashSigHasher.signature_digest - for txi, expected_sighash, pk in zip(inputs, expected_sighashes, pubkeys): + for txi, expected_sighash, _ in zip(inputs, expected_sighashes, pubkeys): computed_sighash = hasher.signature_digest(txi, txi.script_pubkey) self.assertEqual(computed_sighash, expected_sighash) diff --git a/core/tests/test_storage.cache.py b/core/tests/test_storage.cache.py index f523403dbe2..a3c7d509b6b 100644 --- a/core/tests/test_storage.cache.py +++ b/core/tests/test_storage.cache.py @@ -64,7 +64,7 @@ def test_session_queue(self): session_id = cache.start_session() self.assertEqual(cache.start_session(session_id), session_id) cache.set(KEY, b"A") - for i in range(cache._MAX_SESSIONS_COUNT): + for _ in range(cache._MAX_SESSIONS_COUNT): cache.start_session() self.assertNotEqual(cache.start_session(session_id), session_id) self.assertIsNone(cache.get(KEY)) diff --git a/core/tests/test_trezor.crypto.base32.py b/core/tests/test_trezor.crypto.base32.py index f93c0c5ecdc..69db5706dfe 100644 --- a/core/tests/test_trezor.crypto.base32.py +++ b/core/tests/test_trezor.crypto.base32.py @@ -26,15 +26,13 @@ class TestCryptoBase32(unittest.TestCase): b"zlutoucky kun upel dabelske ody", "PJWHK5DPOVRWW6JANN2W4IDVOBSWYIDEMFRGK3DTNNSSA33EPE======", ), - # fmt: off - (b"中文", "4S4K3ZUWQ4======"), # noqa: E999 - (b"中文1", "4S4K3ZUWQ4YQ===="), # noqa: E999 - (b"中文12", "4S4K3ZUWQ4YTE==="), # noqa: E999 - (b"aécio", "MHB2SY3JN4======"), # noqa: E999 - (b"𠜎", "6CQJZDQ="), # noqa: E999 - (b"Base64是一種基於64個可列印字元來表示二進制資料的表示方法", # noqa: E999 + ("中文".encode(), "4S4K3ZUWQ4======"), + ("中文1".encode(), "4S4K3ZUWQ4YQ===="), + ("中文12".encode(), "4S4K3ZUWQ4YTE==="), + ("aécio".encode(), "MHB2SY3JN4======"), + ("𠜎".encode(), "6CQJZDQ="), + ("Base64是一種基於64個可列印字元來表示二進制資料的表示方法".encode(), "IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V"), - # fmt: on ] def test_encode(self): diff --git a/core/tests/test_trezor.crypto.bech32.py b/core/tests/test_trezor.crypto.bech32.py index a48f1807cce..ca8c195e209 100644 --- a/core/tests/test_trezor.crypto.bech32.py +++ b/core/tests/test_trezor.crypto.bech32.py @@ -1,6 +1,3 @@ -# flake8: noqa: F403,F405 -from common import * # isort:skip - # Copyright (c) 2017, 2020 Pieter Wuille # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -21,9 +18,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. - """Reference tests for segwit adresses""" +# flake8: noqa: F403,F405 +from common import * # isort:skip + from trezor.crypto import bech32 diff --git a/core/tests/test_trezor.crypto.cashaddr.py b/core/tests/test_trezor.crypto.cashaddr.py index 42fda52c572..0f004abb270 100644 --- a/core/tests/test_trezor.crypto.cashaddr.py +++ b/core/tests/test_trezor.crypto.cashaddr.py @@ -1,6 +1,3 @@ -# flake8: noqa: F403,F405 -from common import * # isort:skip - # Copyright (c) 2017 Pieter Wuille # Copyright (c) 2018 Pavol Rusnak # @@ -22,9 +19,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. - """Reference tests for cashaddr adresses""" +# flake8: noqa: F403,F405 +from common import * # isort:skip + from trezor.crypto import base58, cashaddr VALID_CHECKSUM = [ diff --git a/core/tests/test_trezor.crypto.curve.ed25519.py b/core/tests/test_trezor.crypto.curve.ed25519.py index 22f85abeacb..db19c2747cd 100644 --- a/core/tests/test_trezor.crypto.curve.ed25519.py +++ b/core/tests/test_trezor.crypto.curve.ed25519.py @@ -63,7 +63,7 @@ def test_sign(self): self.assertEqual(sig2, unhexlify(sig)) def test_verify(self): - for sk, pk, sig in self.vectors: + for _, pk, sig in self.vectors: # msg = pk self.assertTrue( ed25519.verify(unhexlify(pk), unhexlify(sig), unhexlify(pk)) diff --git a/core/tests/test_trezor.crypto.hashlib.groestl512.py b/core/tests/test_trezor.crypto.hashlib.groestl512.py index c07c045884d..caad11c45ef 100644 --- a/core/tests/test_trezor.crypto.hashlib.groestl512.py +++ b/core/tests/test_trezor.crypto.hashlib.groestl512.py @@ -63,12 +63,10 @@ def test_update(self): self.assertEqual(x.digest(), unhexlify(d)) # Test from ExtremelyLongMsgKAT_512.txt, disabled by default because it resource-expensive - """ - x = hashlib.groestl512() - for i in range(16777216): - x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') - self.assertEqual(x.digest(), unhexlify('787C88460E5D09ABD7A98C050F3422BBFDBD36A74B05DE04B57A13FA3F36A570B8561580AB9DA4096CCD5111B5DE948F769D9D61833A6CE2B2F223061E688994')) - """ + # x = hashlib.groestl512() + # for i in range(16777216): + # x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') + # self.assertEqual(x.digest(), unhexlify('787C88460E5D09ABD7A98C050F3422BBFDBD36A74B05DE04B57A13FA3F36A570B8561580AB9DA4096CCD5111B5DE948F769D9D61833A6CE2B2F223061E688994')) def test_digest_multi(self): x = hashlib.groestl512() diff --git a/core/tests/test_trezor.crypto.hashlib.ripemd160.py b/core/tests/test_trezor.crypto.hashlib.ripemd160.py index 19a13699e14..6ab0131eafd 100644 --- a/core/tests/test_trezor.crypto.hashlib.ripemd160.py +++ b/core/tests/test_trezor.crypto.hashlib.ripemd160.py @@ -38,7 +38,7 @@ def test_update(self): self.assertEqual(x.digest(), unhexlify(d)) x = hashlib.ripemd160() - for i in range(8): + for _ in range(8): x.update(b"1234567890") self.assertEqual( x.digest(), unhexlify("9b752e45573d4b39f4dbd3323cab82bf63326bfb") diff --git a/core/tests/test_trezor.crypto.hashlib.sha1.py b/core/tests/test_trezor.crypto.hashlib.sha1.py index 21d76287a0e..04871c2e61a 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha1.py +++ b/core/tests/test_trezor.crypto.hashlib.sha1.py @@ -31,18 +31,16 @@ def test_update(self): self.assertEqual(x.digest(), unhexlify(d)) x = hashlib.sha1() - for i in range(1000000): + for _ in range(1000000): x.update(b"a") self.assertEqual( x.digest(), unhexlify("34aa973cd4c4daa4f61eeb2bdbad27316534016f") ) - """ - x = hashlib.sha1() - for i in range(16777216): - x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') - self.assertEqual(x.digest(), unhexlify('7789f0c9ef7bfc40d93311143dfbe69e2017f592')) - """ + # x = hashlib.sha1() + # for i in range(16777216): + # x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') + # self.assertEqual(x.digest(), unhexlify('7789f0c9ef7bfc40d93311143dfbe69e2017f592')) def test_digest_multi(self): x = hashlib.sha1() diff --git a/core/tests/test_trezor.crypto.hashlib.sha256.py b/core/tests/test_trezor.crypto.hashlib.sha256.py index 48ee0d02bd1..928949a04d2 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha256.py +++ b/core/tests/test_trezor.crypto.hashlib.sha256.py @@ -31,7 +31,7 @@ def test_update(self): self.assertEqual(x.digest(), unhexlify(d)) x = hashlib.sha256() - for i in range(1000000): + for _ in range(1000000): x.update(b"a") self.assertEqual( x.digest(), @@ -40,12 +40,10 @@ def test_update(self): ), ) - """ - x = hashlib.sha256() - for i in range(16777216): - x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') - self.assertEqual(x.digest(), unhexlify('50e72a0e26442fe2552dc3938ac58658228c0cbfb1d2ca872ae435266fcd055e')) - """ + # x = hashlib.sha256() + # for i in range(16777216): + # x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') + # self.assertEqual(x.digest(), unhexlify('50e72a0e26442fe2552dc3938ac58658228c0cbfb1d2ca872ae435266fcd055e')) def test_digest_multi(self): x = hashlib.sha256() diff --git a/core/tests/test_trezor.crypto.hashlib.sha3_256.py b/core/tests/test_trezor.crypto.hashlib.sha3_256.py index 7e8645bf134..4b7f990c0d4 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha3_256.py +++ b/core/tests/test_trezor.crypto.hashlib.sha3_256.py @@ -48,7 +48,7 @@ def test_update(self): self.assertEqual(x.digest(), unhexlify(d)) x = hashlib.sha3_256() - for i in range(1000000): + for _ in range(1000000): x.update(b"a") self.assertEqual( x.digest(), @@ -57,12 +57,10 @@ def test_update(self): ), ) - """ - x = hashlib.sha3_256() - for i in range(16777216): - x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') - self.assertEqual(x.digest(), unhexlify('ecbbc42cbf296603acb2c6bc0410ef4378bafb24b710357f12df607758b33e2b')) - """ + # x = hashlib.sha3_256() + # for i in range(16777216): + # x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') + # self.assertEqual(x.digest(), unhexlify('ecbbc42cbf296603acb2c6bc0410ef4378bafb24b710357f12df607758b33e2b')) def test_update_keccak(self): for b, d in self.vectors_keccak: diff --git a/core/tests/test_trezor.crypto.hashlib.sha3_512.py b/core/tests/test_trezor.crypto.hashlib.sha3_512.py index ae90fdd7bd6..3c55ac70584 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha3_512.py +++ b/core/tests/test_trezor.crypto.hashlib.sha3_512.py @@ -60,7 +60,7 @@ def test_update(self): self.assertEqual(x.digest(), unhexlify(d)) x = hashlib.sha3_512() - for i in range(1000000): + for _ in range(1000000): x.update(b"a") self.assertEqual( x.digest(), @@ -69,12 +69,10 @@ def test_update(self): ), ) - """ - x = hashlib.sha3_512() - for i in range(16777216): - x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') - self.assertEqual(x.digest(), unhexlify('235ffd53504ef836a1342b488f483b396eabbfe642cf78ee0d31feec788b23d0d18d5c339550dd5958a500d4b95363da1b5fa18affc1bab2292dc63b7d85097c')) - """ + # x = hashlib.sha3_512() + # for i in range(16777216): + # x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') + # self.assertEqual(x.digest(), unhexlify('235ffd53504ef836a1342b488f483b396eabbfe642cf78ee0d31feec788b23d0d18d5c339550dd5958a500d4b95363da1b5fa18affc1bab2292dc63b7d85097c')) def test_update_keccak(self): for b, d in self.vectors_keccak: diff --git a/core/tests/test_trezor.crypto.hashlib.sha512.py b/core/tests/test_trezor.crypto.hashlib.sha512.py index 0b835e6ee89..4a5c4209428 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha512.py +++ b/core/tests/test_trezor.crypto.hashlib.sha512.py @@ -37,7 +37,7 @@ def test_update(self): self.assertEqual(x.digest(), unhexlify(d)) x = hashlib.sha512() - for i in range(1000000): + for _ in range(1000000): x.update(b"a") self.assertEqual( x.digest(), @@ -46,12 +46,10 @@ def test_update(self): ), ) - """ - x = hashlib.sha512() - for i in range(16777216): - x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') - self.assertEqual(x.digest(), unhexlify('b47c933421ea2db149ad6e10fce6c7f93d0752380180ffd7f4629a712134831d77be6091b819ed352c2967a2e2d4fa5050723c9630691f1a05a7281dbe6c1086')) - """ + # x = hashlib.sha512() + # for i in range(16777216): + # x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno') + # self.assertEqual(x.digest(), unhexlify('b47c933421ea2db149ad6e10fce6c7f93d0752380180ffd7f4629a712134831d77be6091b819ed352c2967a2e2d4fa5050723c9630691f1a05a7281dbe6c1086')) def test_digest_multi(self): x = hashlib.sha512() diff --git a/core/tests/test_trezor.crypto.hmac.py b/core/tests/test_trezor.crypto.hmac.py index 40aa78b8b1e..4e27567df1c 100644 --- a/core/tests/test_trezor.crypto.hmac.py +++ b/core/tests/test_trezor.crypto.hmac.py @@ -111,7 +111,7 @@ def test_update(self): # case 3 key = b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" x = hmac(hmac.SHA256, key) - for i in range(50): + for _ in range(50): x.update(b"\xdd") self.assertEqual( x.digest(), @@ -120,7 +120,7 @@ def test_update(self): ), ) x = hmac(hmac.SHA512, key) - for i in range(50): + for _ in range(50): x.update(b"\xdd") self.assertEqual( x.digest(), @@ -132,7 +132,7 @@ def test_update(self): # case 4 key = b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19" x = hmac(hmac.SHA256, key) - for i in range(50): + for _ in range(50): x.update(b"\xcd") self.assertEqual( x.digest(), @@ -141,7 +141,7 @@ def test_update(self): ), ) x = hmac(hmac.SHA512, key) - for i in range(50): + for _ in range(50): x.update(b"\xcd") self.assertEqual( x.digest(), diff --git a/core/tests/test_trezor.crypto.pbkdf2.py b/core/tests/test_trezor.crypto.pbkdf2.py index 69542ee811f..fe7a349dc96 100644 --- a/core/tests/test_trezor.crypto.pbkdf2.py +++ b/core/tests/test_trezor.crypto.pbkdf2.py @@ -65,7 +65,7 @@ def test_pbkdf2_hmac_sha256_update(self): ), ) p = pbkdf2(pbkdf2.HMAC_SHA256, P, S) - for i in range(32): + for _ in range(32): p.update(128) dk = p.key() self.assertEqual( @@ -77,7 +77,7 @@ def test_pbkdf2_hmac_sha256_update(self): P = b"passwordPASSWORDpassword" S = b"saltSALTsaltSALTsaltSALTsaltSALTsalt" p = pbkdf2(pbkdf2.HMAC_SHA256, P, S) - for i in range(64): + for _ in range(64): p.update(64) dk = p.key() self.assertEqual( @@ -146,7 +146,7 @@ def test_pbkdf2_hmac_sha512_update(self): ), ) p = pbkdf2(pbkdf2.HMAC_SHA512, P, S) - for i in range(32): + for _ in range(32): p.update(128) dk = p.key() self.assertEqual( @@ -158,7 +158,7 @@ def test_pbkdf2_hmac_sha512_update(self): P = b"passwordPASSWORDpassword" S = b"saltSALTsaltSALTsaltSALTsaltSALTsalt" p = pbkdf2(pbkdf2.HMAC_SHA512, P, S) - for i in range(64): + for _ in range(64): p.update(64) dk = p.key() self.assertEqual( diff --git a/core/tests/test_trezor.crypto.slip39.py b/core/tests/test_trezor.crypto.slip39.py index 4fa298e74c6..8e5a9421e20 100644 --- a/core/tests/test_trezor.crypto.slip39.py +++ b/core/tests/test_trezor.crypto.slip39.py @@ -65,13 +65,13 @@ def test_iteration_exponent(self): identifier = slip39.generate_random_identifier() mnemonics = slip39.split_ems(1, [(3, 5)], identifier, extendable, 1, self.EMS) mnemonics = mnemonics[0] - identifier, extendable, exponent, ems = slip39.recover_ems(mnemonics[1:4]) + identifier, extendable, _, ems = slip39.recover_ems(mnemonics[1:4]) self.assertEqual(ems, self.EMS) identifier = slip39.generate_random_identifier() mnemonics = slip39.split_ems(1, [(3, 5)], identifier, extendable, 2, self.EMS) mnemonics = mnemonics[0] - identifier, extendable, exponent, ems = slip39.recover_ems(mnemonics[1:4]) + identifier, extendable, _, ems = slip39.recover_ems(mnemonics[1:4]) self.assertEqual(ems, self.EMS) def test_group_sharing(self): diff --git a/core/tests/test_trezor.utils.py b/core/tests/test_trezor.utils.py index 015bf7a3bea..67150d2a9b5 100644 --- a/core/tests/test_trezor.utils.py +++ b/core/tests/test_trezor.utils.py @@ -54,7 +54,10 @@ def test_truncate_utf8(self): ) # b'\xe1\x88\xb4\xe5\x99\xb8 def test_firmware_hash(self): - if utils.INTERNAL_MODEL in ('DISC2', 'T3W1'): + if utils.INTERNAL_MODEL in ( # pylint: disable=internal-model-tuple-comparison + "DISC2", + "T3W1", + ): self.assertEqual( utils.firmware_hash(), b"\xde\xce\xc5\xf6\xa4vgl5\x13l2\xa5\xf8F\xd8\xba\n$\x0b!x\x1fVM\x1e\xf3}@\xd9\xa8\xe9", diff --git a/core/tests/unittest.py b/core/tests/unittest.py index 00e398cc278..1127d0257d4 100644 --- a/core/tests/unittest.py +++ b/core/tests/unittest.py @@ -140,10 +140,11 @@ def assertRaises(self, exc, func=None, *args, **kwargs): func(*args, **kwargs) except Exception as e: if isinstance(e, exc): - return + return None raise else: ensure(False, f"{repr(exc)} not raised") + return None def assertListEqual(self, x, y, msg=""): if len(x) != len(y): From 87bc53c4a3acfaf7c02e97d0854f6e262bd41964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Fri, 15 Nov 2024 15:02:47 +0100 Subject: [PATCH 3/4] style(core/tests): apply formatting --- core/tests/ethereum_common.py | 6 +- core/tests/slip39_vectors.py | 6 +- core/tests/test_apps.bitcoin.approver.py | 10 +-- ...pps.bitcoin.segwit.signtx.native_p2wpkh.py | 12 +++- ...bitcoin.segwit.signtx.native_p2wpkh_grs.py | 12 +++- ...ps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py | 16 +++-- ...itcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py | 12 +++- .../test_apps.bitcoin.signtx.fee_threshold.py | 4 +- core/tests/test_apps.bitcoin.signtx.py | 4 +- core/tests/test_apps.bitcoin.signtx_decred.py | 6 +- core/tests/test_apps.bitcoin.signtx_grs.py | 4 +- core/tests/test_apps.cardano.address.py | 8 ++- .../tests/test_apps.cardano.get_public_key.py | 8 ++- core/tests/test_apps.common.cbor.py | 14 ++-- core/tests/test_apps.ethereum.layout.py | 1 + .../tests/test_apps.thp.credential_manager.py | 6 +- core/tests/test_storage.py | 3 +- core/tests/test_trezor.crypto.aesgcm.py | 4 +- core/tests/test_trezor.crypto.base32.py | 8 ++- core/tests/test_trezor.crypto.bech32.py | 2 +- core/tests/test_trezor.crypto.elligator2.py | 65 +++++++++++++------ core/tests/test_trezor.crypto.slip39.py | 49 ++++++++++---- core/tests/test_trezor.strings.py | 56 +++++++++++++--- core/tests/test_trezor.utils.py | 1 - 24 files changed, 226 insertions(+), 91 deletions(-) diff --git a/core/tests/ethereum_common.py b/core/tests/ethereum_common.py index a0ce8e83d1d..2f480401e72 100644 --- a/core/tests/ethereum_common.py +++ b/core/tests/ethereum_common.py @@ -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") diff --git a/core/tests/slip39_vectors.py b/core/tests/slip39_vectors.py index bd89c0c05ca..8d5fe46e2bf 100644 --- a/core/tests/slip39_vectors.py +++ b/core/tests/slip39_vectors.py @@ -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", ], @@ -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", ], @@ -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", ], diff --git a/core/tests/test_apps.bitcoin.approver.py b/core/tests/test_apps.bitcoin.approver.py index 7354a846b1d..fd63f0a34bc 100644 --- a/core/tests/test_apps.bitcoin.approver.py +++ b/core/tests/test_apps.bitcoin.approver.py @@ -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, @@ -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)) diff --git a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py index 49743b0516b..1c1ebc84440 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py @@ -113,7 +113,9 @@ 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, @@ -121,7 +123,9 @@ def test_send_native_p2wpkh(self): 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] @@ -310,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, diff --git a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py index dac240f903c..a1b1ef683a1 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py @@ -124,7 +124,9 @@ 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, @@ -132,7 +134,9 @@ def test_send_native_p2wpkh(self): 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, @@ -333,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, diff --git a/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py b/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py index 3187c65ec88..289e7f75e3d 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh.py @@ -115,7 +115,9 @@ 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, @@ -123,7 +125,9 @@ def test_send_p2wpkh_in_p2sh(self): 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, @@ -318,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, @@ -532,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, diff --git a/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py b/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py index 549fa2d04b2..4130cd4e6c4 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py @@ -124,7 +124,9 @@ 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, @@ -132,7 +134,9 @@ def test_send_p2wpkh_in_p2sh(self): 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, @@ -337,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, diff --git a/core/tests/test_apps.bitcoin.signtx.fee_threshold.py b/core/tests/test_apps.bitcoin.signtx.fee_threshold.py index 9352c633339..b0ef6e57e71 100644 --- a/core/tests/test_apps.bitcoin.signtx.fee_threshold.py +++ b/core/tests/test_apps.bitcoin.signtx.fee_threshold.py @@ -181,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, diff --git a/core/tests/test_apps.bitcoin.signtx.py b/core/tests/test_apps.bitcoin.signtx.py index a2dfe23ad4a..ec3ee4286a1 100644 --- a/core/tests/test_apps.bitcoin.signtx.py +++ b/core/tests/test_apps.bitcoin.signtx.py @@ -112,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, diff --git a/core/tests/test_apps.bitcoin.signtx_decred.py b/core/tests/test_apps.bitcoin.signtx_decred.py index 8d55c1d63d5..58b52fa369d 100644 --- a/core/tests/test_apps.bitcoin.signtx_decred.py +++ b/core/tests/test_apps.bitcoin.signtx_decred.py @@ -1,7 +1,7 @@ # flake8: noqa: F403,F405 from common import * # isort:skip -if utils.INTERNAL_MODEL in ("T2T1", ): # pylint: disable=internal-model-tuple-comparison +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 @@ -113,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, diff --git a/core/tests/test_apps.bitcoin.signtx_grs.py b/core/tests/test_apps.bitcoin.signtx_grs.py index 63209375334..15fe027f3d4 100644 --- a/core/tests/test_apps.bitcoin.signtx_grs.py +++ b/core/tests/test_apps.bitcoin.signtx_grs.py @@ -113,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] diff --git a/core/tests/test_apps.cardano.address.py b/core/tests/test_apps.cardano.address.py index c5575a6fbf9..22ad3b37dcb 100644 --- a/core/tests/test_apps.cardano.address.py +++ b/core/tests/test_apps.cardano.address.py @@ -192,7 +192,9 @@ def test_slip39_128(self): ] passphrase = b"TREZOR" identifier, extendable, exponent, ems = slip39.recover_ems(mnemonics) - master_secret = slip39.decrypt(ems, passphrase, exponent, identifier, extendable) + master_secret = slip39.decrypt( + ems, passphrase, exponent, identifier, extendable + ) node = cardano.from_seed_slip23(master_secret) @@ -266,7 +268,9 @@ def test_slip39_256(self): ] passphrase = b"TREZOR" identifier, extendable, exponent, ems = slip39.recover_ems(mnemonics) - master_secret = slip39.decrypt(ems, passphrase, exponent, identifier, extendable) + master_secret = slip39.decrypt( + ems, passphrase, exponent, identifier, extendable + ) node = cardano.from_seed_slip23(master_secret) diff --git a/core/tests/test_apps.cardano.get_public_key.py b/core/tests/test_apps.cardano.get_public_key.py index 61e46277c14..ae5850bd2d0 100644 --- a/core/tests/test_apps.cardano.get_public_key.py +++ b/core/tests/test_apps.cardano.get_public_key.py @@ -146,7 +146,9 @@ def test_slip39_128(self): ] passphrase = b"TREZOR" identifier, extendable, exponent, ems = slip39.recover_ems(mnemonics) - master_secret = slip39.decrypt(ems, passphrase, exponent, identifier, extendable) + master_secret = slip39.decrypt( + ems, passphrase, exponent, identifier, extendable + ) node = cardano.from_seed_slip23(master_secret) @@ -195,7 +197,9 @@ def test_slip39_256(self): ] passphrase = b"TREZOR" identifier, extendable, exponent, ems = slip39.recover_ems(mnemonics) - master_secret = slip39.decrypt(ems, passphrase, exponent, identifier, extendable) + master_secret = slip39.decrypt( + ems, passphrase, exponent, identifier, extendable + ) node = cardano.from_seed_slip23(master_secret) diff --git a/core/tests/test_apps.common.cbor.py b/core/tests/test_apps.common.cbor.py index dd0f588c1a8..ae62d8e180d 100644 --- a/core/tests/test_apps.common.cbor.py +++ b/core/tests/test_apps.common.cbor.py @@ -34,19 +34,19 @@ def test_create_array_header(self): def test_create_tagged_set_header(self): test_vectors = [ - (0, 'd9010280'), - (23, 'd9010297'), - ((2 ** 8) - 1, 'd9010298ff'), - ((2 ** 16) - 1, 'd9010299ffff'), - ((2 ** 32) - 1, 'd901029affffffff'), - ((2 ** 64) - 1, 'd901029bffffffffffffffff'), + (0, "d9010280"), + (23, "d9010297"), + ((2**8) - 1, "d9010298ff"), + ((2**16) - 1, "d9010299ffff"), + ((2**32) - 1, "d901029affffffff"), + ((2**64) - 1, "d901029bffffffffffffffff"), ] for val, header_hex in test_vectors: header = unhexlify(header_hex) self.assertEqual(create_tagged_set_header(val), header) with self.assertRaises(NotImplementedError): - create_tagged_set_header(2 ** 64) + create_tagged_set_header(2**64) def test_create_map_header(self): test_vectors = [ diff --git a/core/tests/test_apps.ethereum.layout.py b/core/tests/test_apps.ethereum.layout.py index 61fdd7e0e4a..b160ade4ed6 100644 --- a/core/tests/test_apps.ethereum.layout.py +++ b/core/tests/test_apps.ethereum.layout.py @@ -10,6 +10,7 @@ ETH = networks.by_chain_id(1) + @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") class TestFormatEthereumAmount(unittest.TestCase): def test_denominations(self): diff --git a/core/tests/test_apps.thp.credential_manager.py b/core/tests/test_apps.thp.credential_manager.py index f62aa3bb9d1..267707d3744 100644 --- a/core/tests/test_apps.thp.credential_manager.py +++ b/core/tests/test_apps.thp.credential_manager.py @@ -1,12 +1,12 @@ # flake8: noqa: F403,F405 from common import * # isort: skip -from trezor import config, utils -from trezor import log +from trezor import config, log, utils if utils.USE_THP: - from apps.thp import credential_manager from trezor.messages import ThpCredentialMetadata + from apps.thp import credential_manager + def _issue_credential(host_name: str, host_static_pubkey: bytes) -> bytes: metadata = ThpCredentialMetadata(host_name=host_name) return credential_manager.issue_credential(host_static_pubkey, metadata) diff --git a/core/tests/test_storage.py b/core/tests/test_storage.py index 5e697c5cd63..348ff144d9e 100644 --- a/core/tests/test_storage.py +++ b/core/tests/test_storage.py @@ -4,6 +4,7 @@ from storage import device from trezor import config, utils + class TestConfig(unittest.TestCase): def setUp(self): @@ -39,7 +40,7 @@ def test_cred_auth_key_counter(self): def test_cred_auth_key_counter_overflow(self): from storage import common - from storage.device import _NAMESPACE, _CRED_AUTH_KEY_COUNTER + from storage.device import _CRED_AUTH_KEY_COUNTER, _NAMESPACE common.set(_NAMESPACE, _CRED_AUTH_KEY_COUNTER, b"\xff\xff\xff\xfe") device.increment_cred_auth_key_counter() diff --git a/core/tests/test_trezor.crypto.aesgcm.py b/core/tests/test_trezor.crypto.aesgcm.py index 54cc3c0bd54..9f2bc8164e4 100644 --- a/core/tests/test_trezor.crypto.aesgcm.py +++ b/core/tests/test_trezor.crypto.aesgcm.py @@ -116,7 +116,7 @@ def test_gcm_chunks_in_place(self): # Decrypt by chunks and add authenticated data by chunks. ctx = aesgcm(key, iv) - returned = ctx.decrypt_in_place(memoryview(buffer)[: chunk1_length]) + returned = ctx.decrypt_in_place(memoryview(buffer)[:chunk1_length]) self.assertEqual(returned, chunk1_length) ctx.auth(aad[:17]) returned = ctx.decrypt_in_place(memoryview(buffer)[chunk1_length:]) @@ -128,7 +128,7 @@ def test_gcm_chunks_in_place(self): # Encrypt by chunks and add authenticated data by chunks. ctx.reset(iv) ctx.auth(aad[:7]) - returned = ctx.encrypt_in_place(memoryview(buffer)[: chunk1_length]) + returned = ctx.encrypt_in_place(memoryview(buffer)[:chunk1_length]) self.assertEqual(returned, chunk1_length) ctx.auth(aad[7:]) returned = ctx.encrypt_in_place(memoryview(buffer)[chunk1_length:]) diff --git a/core/tests/test_trezor.crypto.base32.py b/core/tests/test_trezor.crypto.base32.py index 69db5706dfe..e06cd7f638f 100644 --- a/core/tests/test_trezor.crypto.base32.py +++ b/core/tests/test_trezor.crypto.base32.py @@ -1,5 +1,5 @@ # flake8: noqa: F403,F405 -from common import * # isort:skip +from common import * # isort:skip from trezor.crypto import base32 @@ -31,8 +31,10 @@ class TestCryptoBase32(unittest.TestCase): ("中文12".encode(), "4S4K3ZUWQ4YTE==="), ("aécio".encode(), "MHB2SY3JN4======"), ("𠜎".encode(), "6CQJZDQ="), - ("Base64是一種基於64個可列印字元來表示二進制資料的表示方法".encode(), - "IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V"), + ( + "Base64是一種基於64個可列印字元來表示二進制資料的表示方法".encode(), + "IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V", + ), ] def test_encode(self): diff --git a/core/tests/test_trezor.crypto.bech32.py b/core/tests/test_trezor.crypto.bech32.py index ca8c195e209..e9d56bcad5b 100644 --- a/core/tests/test_trezor.crypto.bech32.py +++ b/core/tests/test_trezor.crypto.bech32.py @@ -202,7 +202,7 @@ def test_invalid_checksum(self): def test_valid_address(self): """Test whether valid addresses decode to the correct output.""" - for (address, hexscript) in VALID_ADDRESS: + for address, hexscript in VALID_ADDRESS: hrp = "tb" if address.startswith("tb1") else "bc" witver, witprog = bech32.decode(hrp, address) self.assertIsNotNone(witver) diff --git a/core/tests/test_trezor.crypto.elligator2.py b/core/tests/test_trezor.crypto.elligator2.py index f68352fe9dc..11ecbf86159 100644 --- a/core/tests/test_trezor.crypto.elligator2.py +++ b/core/tests/test_trezor.crypto.elligator2.py @@ -11,30 +11,53 @@ def test_map_to_curve25519(self): # https://elligator.org/vectors/curve25519_direct.vec vectors = [ - ("0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000000"), - ("66665895c5bc6e44ba8d65fd9307092e3244bf2c18877832bd568cb3a2d38a12", - "04d44290d13100b2c25290c9343d70c12ed4813487a07ac1176daa5925e7975e"), - ("673a505e107189ee54ca93310ac42e4545e9e59050aaac6f8b5f64295c8ec02f", - "242ae39ef158ed60f20b89396d7d7eef5374aba15dc312a6aea6d1e57cacf85e"), - ("990b30e04e1c3620b4162b91a33429bddb9f1b70f1da6e5f76385ed3f98ab131", - "998e98021eb4ee653effaa992f3fae4b834de777a953271baaa1fa3fef6b776e"), - ("341a60725b482dd0de2e25a585b208433044bc0a1ba762442df3a0e888ca063c", - "683a71d7fca4fc6ad3d4690108be808c2e50a5af3174486741d0a83af52aeb01"), - ("922688fa428d42bc1fa8806998fbc5959ae801817e85a42a45e8ec25a0d7541a", - "696f341266c64bcfa7afa834f8c34b2730be11c932e08474d1a22f26ed82410b"), - ("0d3b0eb88b74ed13d5f6a130e03c4ad607817057dc227152827c0506a538bb3a", - "0b00df174d9fb0b6ee584d2cf05613130bad18875268c38b377e86dfefef177f"), - ("01a3ea5658f4e00622eeacf724e0bd82068992fae66ed2b04a8599be16662e35", - "7ae4c58bc647b5646c9f5ae4c2554ccbf7c6e428e7b242a574a5a9c293c21f7e"), - ("1d991dff82a84afe97874c0f03a60a56616a15212fbe10d6c099aa3afcfabe35", - "f81f235696f81df90ac2fc861ceee517bff611a394b5be5faaee45584642fb0a"), - ("185435d2b005a3b63f3187e64a1ef3582533e1958d30e4e4747b4d1d3376c728", - "f938b1b320abb0635930bd5d7ced45ae97fa8b5f71cc21d87b4c60905c125d34"), + ( + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + ), + ( + "66665895c5bc6e44ba8d65fd9307092e3244bf2c18877832bd568cb3a2d38a12", + "04d44290d13100b2c25290c9343d70c12ed4813487a07ac1176daa5925e7975e", + ), + ( + "673a505e107189ee54ca93310ac42e4545e9e59050aaac6f8b5f64295c8ec02f", + "242ae39ef158ed60f20b89396d7d7eef5374aba15dc312a6aea6d1e57cacf85e", + ), + ( + "990b30e04e1c3620b4162b91a33429bddb9f1b70f1da6e5f76385ed3f98ab131", + "998e98021eb4ee653effaa992f3fae4b834de777a953271baaa1fa3fef6b776e", + ), + ( + "341a60725b482dd0de2e25a585b208433044bc0a1ba762442df3a0e888ca063c", + "683a71d7fca4fc6ad3d4690108be808c2e50a5af3174486741d0a83af52aeb01", + ), + ( + "922688fa428d42bc1fa8806998fbc5959ae801817e85a42a45e8ec25a0d7541a", + "696f341266c64bcfa7afa834f8c34b2730be11c932e08474d1a22f26ed82410b", + ), + ( + "0d3b0eb88b74ed13d5f6a130e03c4ad607817057dc227152827c0506a538bb3a", + "0b00df174d9fb0b6ee584d2cf05613130bad18875268c38b377e86dfefef177f", + ), + ( + "01a3ea5658f4e00622eeacf724e0bd82068992fae66ed2b04a8599be16662e35", + "7ae4c58bc647b5646c9f5ae4c2554ccbf7c6e428e7b242a574a5a9c293c21f7e", + ), + ( + "1d991dff82a84afe97874c0f03a60a56616a15212fbe10d6c099aa3afcfabe35", + "f81f235696f81df90ac2fc861ceee517bff611a394b5be5faaee45584642fb0a", + ), + ( + "185435d2b005a3b63f3187e64a1ef3582533e1958d30e4e4747b4d1d3376c728", + "f938b1b320abb0635930bd5d7ced45ae97fa8b5f71cc21d87b4c60905c125d34", + ), ] for input, output in vectors: - self.assertEqual(hexlify(elligator2.map_to_curve25519(unhexlify(input))).decode('ascii'), output) + self.assertEqual( + hexlify(elligator2.map_to_curve25519(unhexlify(input))).decode("ascii"), + output, + ) if __name__ == "__main__": diff --git a/core/tests/test_trezor.crypto.slip39.py b/core/tests/test_trezor.crypto.slip39.py index 8e5a9421e20..ff0d840b86d 100644 --- a/core/tests/test_trezor.crypto.slip39.py +++ b/core/tests/test_trezor.crypto.slip39.py @@ -41,17 +41,24 @@ def test_basic_sharing_random(self): def test_basic_sharing_extend(self): identifier = slip39.generate_random_identifier() for extendable in (False, True): - mnemonics = slip39.split_ems(1, [(2, 3)], identifier, extendable, 1, self.EMS) + mnemonics = slip39.split_ems( + 1, [(2, 3)], identifier, extendable, 1, self.EMS + ) mnemonics = mnemonics[0] extended_mnemonics = slip39.extend_mnemonics(4, mnemonics[1:]) self.assertEqual(mnemonics, extended_mnemonics[:3]) for i in range(3): - self.assertEqual(slip39.recover_ems([extended_mnemonics[3], mnemonics[i]])[3], self.EMS) + self.assertEqual( + slip39.recover_ems([extended_mnemonics[3], mnemonics[i]])[3], + self.EMS, + ) def test_basic_sharing_fixed(self): for extendable in (False, True): generated_identifier = slip39.generate_random_identifier() - mnemonics = slip39.split_ems(1, [(3, 5)], generated_identifier, extendable, 1, self.EMS) + mnemonics = slip39.split_ems( + 1, [(3, 5)], generated_identifier, extendable, 1, self.EMS + ) mnemonics = mnemonics[0] identifier, _, _, ems = slip39.recover_ems(mnemonics[:3]) self.assertEqual(ems, self.EMS) @@ -63,13 +70,17 @@ def test_basic_sharing_fixed(self): def test_iteration_exponent(self): for extendable in (False, True): identifier = slip39.generate_random_identifier() - mnemonics = slip39.split_ems(1, [(3, 5)], identifier, extendable, 1, self.EMS) + mnemonics = slip39.split_ems( + 1, [(3, 5)], identifier, extendable, 1, self.EMS + ) mnemonics = mnemonics[0] identifier, extendable, _, ems = slip39.recover_ems(mnemonics[1:4]) self.assertEqual(ems, self.EMS) identifier = slip39.generate_random_identifier() - mnemonics = slip39.split_ems(1, [(3, 5)], identifier, extendable, 2, self.EMS) + mnemonics = slip39.split_ems( + 1, [(3, 5)], identifier, extendable, 2, self.EMS + ) mnemonics = mnemonics[0] identifier, extendable, _, ems = slip39.recover_ems(mnemonics[1:4]) self.assertEqual(ems, self.EMS) @@ -90,7 +101,9 @@ def test_group_sharing(self): ) # Test all valid combinations of mnemonics. - for groups in combinations(zip(mnemonics, member_thresholds), group_threshold): + for groups in combinations( + zip(mnemonics, member_thresholds), group_threshold + ): for group1_subset in combinations(groups[0][0], groups[0][1]): for group2_subset in combinations(groups[1][0], groups[1][1]): mnemonic_subset = list(group1_subset + group2_subset) @@ -104,7 +117,9 @@ def test_group_sharing(self): ) self.assertEqual(ems, self.EMS) self.assertEqual( - slip39.recover_ems([mnemonics[2][3], mnemonics[3][0], mnemonics[2][4]])[3], + slip39.recover_ems([mnemonics[2][3], mnemonics[3][0], mnemonics[2][4]])[ + 3 + ], ems, ) @@ -160,23 +175,33 @@ def test_invalid_sharing(self): # Group threshold exceeds number of groups. with self.assertRaises(ValueError): - slip39.split_ems(3, [(3, 5), (2, 5)], identifier, extendable, 1, self.EMS) + slip39.split_ems( + 3, [(3, 5), (2, 5)], identifier, extendable, 1, self.EMS + ) # Invalid group threshold. with self.assertRaises(ValueError): - slip39.split_ems(0, [(3, 5), (2, 5)], identifier, extendable, 1, self.EMS) + slip39.split_ems( + 0, [(3, 5), (2, 5)], identifier, extendable, 1, self.EMS + ) # Member threshold exceeds number of members. with self.assertRaises(ValueError): - slip39.split_ems(2, [(3, 2), (2, 5)], identifier, extendable, 1, self.EMS) + slip39.split_ems( + 2, [(3, 2), (2, 5)], identifier, extendable, 1, self.EMS + ) # Invalid member threshold. with self.assertRaises(ValueError): - slip39.split_ems(2, [(0, 2), (2, 5)], identifier, extendable, 1, self.EMS) + slip39.split_ems( + 2, [(0, 2), (2, 5)], identifier, extendable, 1, self.EMS + ) # Group with multiple members and threshold 1. with self.assertRaises(ValueError): - slip39.split_ems(2, [(3, 5), (1, 3), (2, 5)], identifier, extendable, 1, self.EMS) + slip39.split_ems( + 2, [(3, 5), (1, 3), (2, 5)], identifier, extendable, 1, self.EMS + ) def test_vectors(self): for mnemonics, secret in vectors: diff --git a/core/tests/test_trezor.strings.py b/core/tests/test_trezor.strings.py index 3b48d9e6793..721d491be18 100644 --- a/core/tests/test_trezor.strings.py +++ b/core/tests/test_trezor.strings.py @@ -44,14 +44,54 @@ def test_format_plural_english(self): def test_format_plural(self): VECTORS = [ - ("You are about to sign {count} {plural}", 0, "action|actions", "You are about to sign 0 actions"), - ("You are about to sign {count} {plural}", 1, "action|actions", "You are about to sign 1 action"), - ("You are about to sign {count} {plural}", 3, "action|actions", "You are about to sign 3 actions"), - ("You are about to sign {count} {plural}", 15, "action|actions", "You are about to sign 15 actions"), - ("Chystáte se podepsat {count} {plural}", 0, "akci|akce|akcí", "Chystáte se podepsat 0 akcí"), - ("Chystáte se podepsat {count} {plural}", 1, "akci|akce|akcí", "Chystáte se podepsat 1 akci"), - ("Chystáte se podepsat {count} {plural}", 3, "akci|akce|akcí", "Chystáte se podepsat 3 akce"), - ("Chystáte se podepsat {count} {plural}", 15, "akci|akce|akcí", "Chystáte se podepsat 15 akcí"), + ( + "You are about to sign {count} {plural}", + 0, + "action|actions", + "You are about to sign 0 actions", + ), + ( + "You are about to sign {count} {plural}", + 1, + "action|actions", + "You are about to sign 1 action", + ), + ( + "You are about to sign {count} {plural}", + 3, + "action|actions", + "You are about to sign 3 actions", + ), + ( + "You are about to sign {count} {plural}", + 15, + "action|actions", + "You are about to sign 15 actions", + ), + ( + "Chystáte se podepsat {count} {plural}", + 0, + "akci|akce|akcí", + "Chystáte se podepsat 0 akcí", + ), + ( + "Chystáte se podepsat {count} {plural}", + 1, + "akci|akce|akcí", + "Chystáte se podepsat 1 akci", + ), + ( + "Chystáte se podepsat {count} {plural}", + 3, + "akci|akce|akcí", + "Chystáte se podepsat 3 akce", + ), + ( + "Chystáte se podepsat {count} {plural}", + 15, + "akci|akce|akcí", + "Chystáte se podepsat 15 akcí", + ), ] for v in VECTORS: self.assertEqual(strings.format_plural(v[0], v[1], v[2]), v[3]) diff --git a/core/tests/test_trezor.utils.py b/core/tests/test_trezor.utils.py index 67150d2a9b5..af39f4f6835 100644 --- a/core/tests/test_trezor.utils.py +++ b/core/tests/test_trezor.utils.py @@ -77,6 +77,5 @@ def test_firmware_hash(self): ) - if __name__ == "__main__": unittest.main() From 629afc880279d8d704fc6c5b8edd055d13d5c226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Fri, 15 Nov 2024 13:37:42 +0100 Subject: [PATCH 4/4] chore(style): include core/tests python files for style linting [no changelog] --- tools/style.py.include | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/style.py.include b/tools/style.py.include index 310ef3dddda..94a9cd61fd6 100644 --- a/tools/style.py.include +++ b/tools/style.py.include @@ -1,6 +1,7 @@ ^common/ ^core/src/ ^core/site_scons/ +^core/tests/ ^crypto/ ^legacy/ ^storage/