diff --git a/core/tests/mock_storage.py b/core/tests/mock_storage.py index f6839eb3b..cadba9bad 100644 --- a/core/tests/mock_storage.py +++ b/core/tests/mock_storage.py @@ -1,5 +1,4 @@ import storage.common - from mock import patch diff --git a/core/tests/production_tests/main.py b/core/tests/production_tests/main.py index bec08bb2f..f783c6526 100644 --- a/core/tests/production_tests/main.py +++ b/core/tests/production_tests/main.py @@ -1,7 +1,6 @@ -import utime - import trezorio as io import trezorui as ui +import utime usb_vcp = io.VCP( iface_num=0x00, diff --git a/core/tests/test_apps.binance.address.py b/core/tests/test_apps.binance.address.py index a5bc2ddb8..c1a9ae926 100644 --- a/core/tests/test_apps.binance.address.py +++ b/core/tests/test_apps.binance.address.py @@ -1,4 +1,4 @@ -from common import * +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 6e897504b..699d5ead0 100644 --- a/core/tests/test_apps.binance.sign_tx.py +++ b/core/tests/test_apps.binance.sign_tx.py @@ -1,16 +1,19 @@ -from common import * +from common import * # isort:skip from trezor.crypto.curve import secp256k1 from trezor.crypto.hashlib import sha256 if not utils.BITCOIN_ONLY: + from trezor.messages import ( + BinanceCancelMsg, + BinanceCoin, + BinanceInputOutput, + BinanceOrderMsg, + BinanceSignTx, + BinanceTransferMsg, + ) + from apps.binance.helpers import produce_json_for_signing - from trezor.messages import BinanceCancelMsg - from trezor.messages import BinanceCoin - from trezor.messages import BinanceInputOutput - from trezor.messages import BinanceOrderMsg - from trezor.messages import BinanceSignTx - from trezor.messages import BinanceTransferMsg # NOTE: copy-pasted from apps.binance.sign_tx diff --git a/core/tests/test_apps.bitcoin.address.py b/core/tests/test_apps.bitcoin.address.py index ad6cbce3a..1808c3d2a 100644 --- a/core/tests/test_apps.bitcoin.address.py +++ b/core/tests/test_apps.bitcoin.address.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor import wire from trezor.crypto import bip32, bip39 diff --git a/core/tests/test_apps.bitcoin.address_grs.py b/core/tests/test_apps.bitcoin.address_grs.py index f2357e6c4..d4ce76192 100644 --- a/core/tests/test_apps.bitcoin.address_grs.py +++ b/core/tests/test_apps.bitcoin.address_grs.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip32, bip39 diff --git a/core/tests/test_apps.bitcoin.approver.py b/core/tests/test_apps.bitcoin.approver.py index cc20df5de..92d142de4 100644 --- a/core/tests/test_apps.bitcoin.approver.py +++ b/core/tests/test_apps.bitcoin.approver.py @@ -1,4 +1,4 @@ -from common import H_, await_result, unittest +from common import H_, await_result, unittest # isort:skip import storage.cache from trezor import wire diff --git a/core/tests/test_apps.bitcoin.authorization.py b/core/tests/test_apps.bitcoin.authorization.py index 9e67a9623..503c18156 100644 --- a/core/tests/test_apps.bitcoin.authorization.py +++ b/core/tests/test_apps.bitcoin.authorization.py @@ -1,4 +1,4 @@ -from common import H_, unittest +from common import H_, unittest # isort:skip import storage.cache from trezor.enums import InputScriptType diff --git a/core/tests/test_apps.bitcoin.keychain.py b/core/tests/test_apps.bitcoin.keychain.py index 4fa04dfe5..3828a3ebb 100644 --- a/core/tests/test_apps.bitcoin.keychain.py +++ b/core/tests/test_apps.bitcoin.keychain.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from storage import cache from trezor import wire diff --git a/core/tests/test_apps.bitcoin.ownership_proof.py b/core/tests/test_apps.bitcoin.ownership_proof.py index 32fdfd543..8c830d582 100644 --- a/core/tests/test_apps.bitcoin.ownership_proof.py +++ b/core/tests/test_apps.bitcoin.ownership_proof.py @@ -1,4 +1,4 @@ -from common import unhexlify, unittest +from common import unhexlify, unittest # isort:skip from trezor.crypto import bip39 from trezor.enums import InputScriptType 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 a9d8f76c1..ebfb98c6b 100644 --- a/core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py +++ b/core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import InputScriptType, OutputScriptType 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 8927a2833..7a5457b86 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,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import InputScriptType, OutputScriptType diff --git a/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py b/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py index df9cecd2f..e234069aa 100644 --- a/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py +++ b/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py @@ -1,12 +1,12 @@ -from common import * +from common import * # isort:skip + +from trezor.enums import InputScriptType +from trezor.messages import PrevOutput, SignTx, TxInput from apps.bitcoin.common import SigHashType from apps.bitcoin.sign_tx.sig_hasher import BitcoinSigHasher from apps.bitcoin.writers import get_tx_hash -from trezor.enums import InputScriptType -from trezor.messages import PrevOutput, SignTx, TxInput - VECTORS = [ { # https://github.com/bitcoin/bips/pull/1225/commits/f7af1f73b287c14cf2f63afcb8d199feaf6ab5e1 "sign_tx": SignTx( 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 cc8f1a1ef..cd58acee7 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor import wire from trezor.crypto import bip39 @@ -112,7 +112,6 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( @@ -121,7 +120,6 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out2)), - helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False), True, helpers.UiConfirmTotal( @@ -311,7 +309,6 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( 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 a390755be..0294a41f5 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,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import AmountUnit, InputScriptType, OutputScriptType @@ -123,7 +123,6 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( @@ -132,7 +131,6 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out2)), - helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False), True, helpers.UiConfirmNonDefaultLocktime(tx.lock_time, lock_time_disabled=False), @@ -334,7 +332,6 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( 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 3bfa88489..228f4a801 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,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor import wire from trezor.crypto import bip39 @@ -114,7 +114,6 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( @@ -123,7 +122,6 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out2)), - helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False), True, helpers.UiConfirmTotal( @@ -319,7 +317,6 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( @@ -534,7 +531,6 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( 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 f3c55ea75..7e45cf8a9 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,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import AmountUnit, InputScriptType, OutputScriptType @@ -123,7 +123,6 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( @@ -132,7 +131,6 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out2)), - helpers.UiConfirmOutput(out2, coin, AmountUnit.BITCOIN, 1, False), True, helpers.UiConfirmNonDefaultLocktime(tx.lock_time, lock_time_disabled=False), @@ -338,7 +336,6 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase): serialized=EMPTY_SERIALIZED, ), TxAckOutput(tx=TxAckOutputWrapper(output=out1)), - helpers.UiConfirmOutput(out1, coin, AmountUnit.BITCOIN, 0, False), True, TxRequest( diff --git a/core/tests/test_apps.bitcoin.sign_tx.writers.py b/core/tests/test_apps.bitcoin.sign_tx.writers.py index 36bc9943b..5a9f95163 100644 --- a/core/tests/test_apps.bitcoin.sign_tx.writers.py +++ b/core/tests/test_apps.bitcoin.sign_tx.writers.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.enums import InputScriptType from trezor.messages import TxInput diff --git a/core/tests/test_apps.bitcoin.signtx.fee_threshold.py b/core/tests/test_apps.bitcoin.signtx.fee_threshold.py index 6ebf6a375..e5e0320bb 100644 --- a/core/tests/test_apps.bitcoin.signtx.fee_threshold.py +++ b/core/tests/test_apps.bitcoin.signtx.fee_threshold.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import AmountUnit, OutputScriptType diff --git a/core/tests/test_apps.bitcoin.signtx.omni.py b/core/tests/test_apps.bitcoin.signtx.omni.py index 395b7699c..7474db0fe 100644 --- a/core/tests/test_apps.bitcoin.signtx.omni.py +++ b/core/tests/test_apps.bitcoin.signtx.omni.py @@ -1,4 +1,4 @@ -from common import * +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 23c3f9385..e9e094696 100644 --- a/core/tests/test_apps.bitcoin.signtx.py +++ b/core/tests/test_apps.bitcoin.signtx.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import AmountUnit, OutputScriptType diff --git a/core/tests/test_apps.bitcoin.signtx_decred.py b/core/tests/test_apps.bitcoin.signtx_decred.py index 17faf6516..1766ee5df 100644 --- a/core/tests/test_apps.bitcoin.signtx_decred.py +++ b/core/tests/test_apps.bitcoin.signtx_decred.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import AmountUnit, OutputScriptType diff --git a/core/tests/test_apps.bitcoin.signtx_grs.py b/core/tests/test_apps.bitcoin.signtx_grs.py index 9d8c9661d..573e3017f 100644 --- a/core/tests/test_apps.bitcoin.signtx_grs.py +++ b/core/tests/test_apps.bitcoin.signtx_grs.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import AmountUnit, OutputScriptType diff --git a/core/tests/test_apps.bitcoin.txweight.py b/core/tests/test_apps.bitcoin.txweight.py index 8e1713277..2e91170b9 100644 --- a/core/tests/test_apps.bitcoin.txweight.py +++ b/core/tests/test_apps.bitcoin.txweight.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip39 from trezor.enums import OutputScriptType diff --git a/core/tests/test_apps.bitcoin.zcash.zip243.py b/core/tests/test_apps.bitcoin.zcash.zip243.py index 99aa7ef06..5395c63dc 100644 --- a/core/tests/test_apps.bitcoin.zcash.zip243.py +++ b/core/tests/test_apps.bitcoin.zcash.zip243.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.enums import InputScriptType from trezor.messages import PrevOutput, SignTx, TxInput diff --git a/core/tests/test_apps.cardano.address.py b/core/tests/test_apps.cardano.address.py index a6736c990..77a295fbc 100644 --- a/core/tests/test_apps.cardano.address.py +++ b/core/tests/test_apps.cardano.address.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor import wire from trezor.crypto import cardano, slip39 diff --git a/core/tests/test_apps.cardano.bech32.py b/core/tests/test_apps.cardano.bech32.py index 9b6867623..560b6da2c 100644 --- a/core/tests/test_apps.cardano.bech32.py +++ b/core/tests/test_apps.cardano.bech32.py @@ -1,4 +1,4 @@ -from common import * +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 048911a5c..6eb44ebda 100644 --- a/core/tests/test_apps.cardano.certificate.py +++ b/core/tests/test_apps.cardano.certificate.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor import wire from trezor.enums import CardanoCertificateType @@ -8,7 +8,7 @@ from apps.common.paths import HARDENED if not utils.BITCOIN_ONLY: from apps.cardano import certificates - from apps.cardano.helpers import protocol_magics, network_ids + from apps.cardano.helpers import network_ids, protocol_magics from apps.cardano.helpers.account_path_check import AccountPathChecker diff --git a/core/tests/test_apps.cardano.credential.py b/core/tests/test_apps.cardano.credential.py index 78a60cb1c..86719efc7 100644 --- a/core/tests/test_apps.cardano.credential.py +++ b/core/tests/test_apps.cardano.credential.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.enums import CardanoAddressType from trezor.messages import CardanoAddressParametersType, CardanoBlockchainPointerType diff --git a/core/tests/test_apps.cardano.get_public_key.py b/core/tests/test_apps.cardano.get_public_key.py index 10546931b..4d8635b0c 100644 --- a/core/tests/test_apps.cardano.get_public_key.py +++ b/core/tests/test_apps.cardano.get_public_key.py @@ -1,4 +1,4 @@ -from common import * +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 c4c972353..633670c06 100644 --- a/core/tests/test_apps.cardano.native_script.py +++ b/core/tests/test_apps.cardano.native_script.py @@ -1,17 +1,16 @@ -from common import * +from common import * # isort:skip from trezor import wire from trezor.crypto import cardano from trezor.enums import CardanoNativeScriptType from trezor.messages import CardanoNativeScript - if not utils.BITCOIN_ONLY: - from apps.cardano.seed import Keychain from apps.cardano.native_script import ( get_native_script_hash, validate_native_script, ) + from apps.cardano.seed import Keychain VALID_NATIVE_SCRIPTS = [ # PUB_KEY diff --git a/core/tests/test_apps.cardano.seed.py b/core/tests/test_apps.cardano.seed.py index 4b6d771b5..aa95dde49 100644 --- a/core/tests/test_apps.cardano.seed.py +++ b/core/tests/test_apps.cardano.seed.py @@ -1,12 +1,12 @@ -from common import * +from common import * # isort:skip from trezor.crypto import cardano from apps.common.paths import HARDENED if not utils.BITCOIN_ONLY: - from apps.cardano.seed import Keychain from apps.cardano.get_public_key import _get_public_key + from apps.cardano.seed import Keychain @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") diff --git a/core/tests/test_apps.cardano.utils.py b/core/tests/test_apps.cardano.utils.py index 5939f68b5..53a40286f 100644 --- a/core/tests/test_apps.cardano.utils.py +++ b/core/tests/test_apps.cardano.utils.py @@ -1,9 +1,9 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: from apps.cardano.helpers.utils import ( - variable_length_encode, format_asset_fingerprint, + variable_length_encode, ) diff --git a/core/tests/test_apps.common.cbor.py b/core/tests/test_apps.common.cbor.py index 264ab96a7..07750d940 100644 --- a/core/tests/test_apps.common.cbor.py +++ b/core/tests/test_apps.common.cbor.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from apps.common.cbor import ( IndefiniteLengthArray, diff --git a/core/tests/test_apps.common.coins.py b/core/tests/test_apps.common.coins.py index 0af26ba47..553a2566f 100644 --- a/core/tests/test_apps.common.coins.py +++ b/core/tests/test_apps.common.coins.py @@ -1,4 +1,4 @@ -from common import * +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 8fe0b99b2..84681a0b0 100644 --- a/core/tests/test_apps.common.keychain.py +++ b/core/tests/test_apps.common.keychain.py @@ -1,5 +1,6 @@ -from common import * +from common import * # isort:skip +from mock_storage import mock_storage from storage import cache from trezor import wire from trezor.crypto import bip39 @@ -8,7 +9,6 @@ from trezor.enums import SafetyCheckLevel from apps.common import safety_checks from apps.common.keychain import Keychain, LRUCache, get_keychain, with_slip44_keychain from apps.common.paths import PATTERN_SEP5, PathSchema -from mock_storage import mock_storage class TestKeychain(unittest.TestCase): diff --git a/core/tests/test_apps.common.paths.py b/core/tests/test_apps.common.paths.py index fbcc0629b..e9c88bdae 100644 --- a/core/tests/test_apps.common.paths.py +++ b/core/tests/test_apps.common.paths.py @@ -1,4 +1,4 @@ -from common import * +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 a21e882b8..3ea7cd8e8 100644 --- a/core/tests/test_apps.common.seed.py +++ b/core/tests/test_apps.common.seed.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor import wire from trezor.crypto import bip39 diff --git a/core/tests/test_apps.common.writers.py b/core/tests/test_apps.common.writers.py index 4b837efb3..289f0a547 100644 --- a/core/tests/test_apps.common.writers.py +++ b/core/tests/test_apps.common.writers.py @@ -1,4 +1,4 @@ -from common import * +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 5a23e7014..5a7d4ff11 100644 --- a/core/tests/test_apps.eos.check_action.py +++ b/core/tests/test_apps.eos.check_action.py @@ -1,9 +1,10 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: - from apps.eos.actions import _check_action from trezor.messages import EosTxActionAck + from apps.eos.actions import _check_action + @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") class TestEosActions(unittest.TestCase): diff --git a/core/tests/test_apps.eos.conversions.py b/core/tests/test_apps.eos.conversions.py index 2569f6f57..dfa2ef8fc 100644 --- a/core/tests/test_apps.eos.conversions.py +++ b/core/tests/test_apps.eos.conversions.py @@ -1,9 +1,10 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: - from apps.eos import helpers from trezor.messages import EosAsset + from apps.eos import helpers + @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") class TestEosConversions(unittest.TestCase): diff --git a/core/tests/test_apps.eos.get_public_key.py b/core/tests/test_apps.eos.get_public_key.py index 07125416b..a9af6695d 100644 --- a/core/tests/test_apps.eos.get_public_key.py +++ b/core/tests/test_apps.eos.get_public_key.py @@ -1,9 +1,8 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip32, bip39 from trezor.crypto.curve import secp256k1 - if not utils.BITCOIN_ONLY: from apps.eos.helpers import public_key_to_wif diff --git a/core/tests/test_apps.ethereum.definitions.py b/core/tests/test_apps.ethereum.definitions.py index a45d3c0dd..e1365c3f5 100644 --- a/core/tests/test_apps.ethereum.definitions.py +++ b/core/tests/test_apps.ethereum.definitions.py @@ -1,21 +1,18 @@ -from common import * +from common import * # isort:skip import typing as t import unittest from trezor import utils, wire - if not utils.BITCOIN_ONLY: - from apps.ethereum import networks, tokens - from apps.ethereum.definitions import decode_definition, Definitions from ethereum_common import * from trezor.enums import EthereumDefinitionType - from trezor.messages import ( - EthereumNetworkInfo, - EthereumTokenInfo, - ) + from trezor.messages import EthereumNetworkInfo, EthereumTokenInfo + + from apps.ethereum import networks, tokens + from apps.ethereum.definitions import Definitions, decode_definition TETHER_ADDRESS = b"\xda\xc1\x7f\x95\x8d\x2e\xe5\x23\xa2\x20\x62\x06\x99\x45\x97\xc1\x3d\x83\x1e\xc7" diff --git a/core/tests/test_apps.ethereum.helpers.py b/core/tests/test_apps.ethereum.helpers.py index cd09dab59..c812ccfb9 100644 --- a/core/tests/test_apps.ethereum.helpers.py +++ b/core/tests/test_apps.ethereum.helpers.py @@ -1,9 +1,10 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: - from apps.ethereum.helpers import address_from_bytes from ethereum_common import make_network + from apps.ethereum.helpers import address_from_bytes + @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") class TestEthereumGetAddress(unittest.TestCase): diff --git a/core/tests/test_apps.ethereum.keychain.py b/core/tests/test_apps.ethereum.keychain.py index 37e9b1797..53affef1b 100644 --- a/core/tests/test_apps.ethereum.keychain.py +++ b/core/tests/test_apps.ethereum.keychain.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip import unittest @@ -10,27 +10,26 @@ from apps.common.keychain import get_keychain from apps.common.paths import HARDENED if not utils.BITCOIN_ONLY: + from ethereum_common import encode_network, make_network + from trezor.messages import ( + EthereumDefinitions, + EthereumGetAddress, + EthereumSignMessage, + EthereumSignTx, + EthereumSignTxEIP1559, + EthereumSignTypedData, + ) + from apps.ethereum import CURVE - from apps.ethereum.networks import UNKNOWN_NETWORK from apps.ethereum.keychain import ( PATTERNS_ADDRESS, - _schemas_from_network, _defs_from_message, + _schemas_from_network, _slip44_from_address_n, - with_keychain_from_path, with_keychain_from_chain_id, + with_keychain_from_path, ) - - from trezor.messages import ( - EthereumGetAddress, - EthereumSignTx, - EthereumDefinitions, - EthereumSignMessage, - EthereumSignTypedData, - EthereumSignTxEIP1559, - ) - - from ethereum_common import make_network, encode_network + from apps.ethereum.networks import UNKNOWN_NETWORK @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") diff --git a/core/tests/test_apps.ethereum.layout.py b/core/tests/test_apps.ethereum.layout.py index cbe66ac0c..f1b3477bd 100644 --- a/core/tests/test_apps.ethereum.layout.py +++ b/core/tests/test_apps.ethereum.layout.py @@ -1,12 +1,12 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: + from ethereum_common import make_network, make_token + from apps.ethereum import networks from apps.ethereum.layout import format_ethereum_amount from apps.ethereum.tokens import UNKNOWN_TOKEN - from ethereum_common import make_network, make_token - ETH = networks.by_chain_id(1) diff --git a/core/tests/test_apps.ethereum.sign_typed_data.py b/core/tests/test_apps.ethereum.sign_typed_data.py index addbd9ba9..bf6f3772c 100644 --- a/core/tests/test_apps.ethereum.sign_typed_data.py +++ b/core/tests/test_apps.ethereum.sign_typed_data.py @@ -1,27 +1,21 @@ -from common import * +from common import * # isort:skip from trezor import wire -from trezor.wire import context from trezor.enums import EthereumDataType as EDT -from trezor.messages import ( - EthereumFieldType as EFT, - EthereumStructMember as ESM, - EthereumTypedDataStructAck as ETDSA, - EthereumTypedDataValueAck, -) - +from trezor.messages import EthereumFieldType as EFT +from trezor.messages import EthereumStructMember as ESM +from trezor.messages import EthereumTypedDataStructAck as ETDSA +from trezor.messages import EthereumTypedDataValueAck +from trezor.wire import context if not utils.BITCOIN_ONLY: + from apps.ethereum.helpers import decode_typed_data, get_type_name from apps.ethereum.sign_typed_data import ( - encode_field, - _validate_value, - validate_field_type, - keccak256, TypedDataEnvelope, - ) - from apps.ethereum.helpers import ( - get_type_name, - decode_typed_data, + _validate_value, + encode_field, + keccak256, + validate_field_type, ) diff --git a/core/tests/test_apps.ethereum.tokens.py b/core/tests/test_apps.ethereum.tokens.py index 1a2a79926..af1728ce5 100644 --- a/core/tests/test_apps.ethereum.tokens.py +++ b/core/tests/test_apps.ethereum.tokens.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: from apps.ethereum import tokens diff --git a/core/tests/test_apps.management.recovery_device.py b/core/tests/test_apps.management.recovery_device.py index 7810c8af7..ebfd4d712 100644 --- a/core/tests/test_apps.management.recovery_device.py +++ b/core/tests/test_apps.management.recovery_device.py @@ -1,7 +1,8 @@ -from common import * +from common import * # isort:skip import storage import storage.recovery +from mock_storage import mock_storage from trezor.enums import BackupType from apps.management.recovery_device.recover import process_slip39 @@ -11,7 +12,6 @@ from apps.management.recovery_device.word_validity import ( ThresholdReached, check, ) -from mock_storage import mock_storage MNEMONIC_SLIP39_BASIC_20_3of6 = [ "extra extend academic bishop cricket bundle tofu goat apart victim enlarge program behavior permit course armed jerky faint language modern", diff --git a/core/tests/test_apps.monero.bulletproof.py b/core/tests/test_apps.monero.bulletproof.py index 71ac42712..86e2dcd2f 100644 --- a/core/tests/test_apps.monero.bulletproof.py +++ b/core/tests/test_apps.monero.bulletproof.py @@ -1,7 +1,8 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: - from apps.monero.xmr import bulletproof as bp, crypto + from apps.monero.xmr import bulletproof as bp + from apps.monero.xmr import crypto from apps.monero.xmr.serialize_messages.tx_rsig_bulletproof import BulletproofPlus diff --git a/core/tests/test_apps.monero.clsag.py b/core/tests/test_apps.monero.clsag.py index 9e1bf9ff6..a4775e790 100644 --- a/core/tests/test_apps.monero.clsag.py +++ b/core/tests/test_apps.monero.clsag.py @@ -1,11 +1,13 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: - from apps.monero.xmr import crypto, crypto_helpers, clsag - from apps.monero.xmr.serialize_messages.tx_ct_key import CtKey + import ubinascii + from trezor.crypto import monero as tcry from trezor.crypto import random - import ubinascii + + from apps.monero.xmr import clsag, crypto, crypto_helpers + from apps.monero.xmr.serialize_messages.tx_ct_key import CtKey point_mul8_into = tcry.ge25519_mul8 diff --git a/core/tests/test_apps.monero.crypto.py b/core/tests/test_apps.monero.crypto.py index 6fd1a63e8..6ab505e6c 100644 --- a/core/tests/test_apps.monero.crypto.py +++ b/core/tests/test_apps.monero.crypto.py @@ -1,8 +1,9 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: from trezor.crypto import monero as tcry from trezor.enums import MoneroNetworkType + from apps.monero.xmr import crypto, crypto_helpers, monero from apps.monero.xmr.addresses import encode_addr from apps.monero.xmr.credentials import AccountCreds diff --git a/core/tests/test_apps.monero.proto.py b/core/tests/test_apps.monero.proto.py index be3d46130..f515683d6 100644 --- a/core/tests/test_apps.monero.proto.py +++ b/core/tests/test_apps.monero.proto.py @@ -1,12 +1,13 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: - from trezor.crypto import chacha20poly1305 - from apps.monero.signing import offloading_keys - from apps.monero.signing import step_09_sign_input - from apps.monero.signing.state import State import ubinascii + from trezor.crypto import chacha20poly1305 + + from apps.monero.signing import offloading_keys, step_09_sign_input + from apps.monero.signing.state import State + @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") class TestMoneroProto(unittest.TestCase): diff --git a/core/tests/test_apps.monero.serializer.py b/core/tests/test_apps.monero.serializer.py index 74bb8676c..7f11afbd3 100644 --- a/core/tests/test_apps.monero.serializer.py +++ b/core/tests/test_apps.monero.serializer.py @@ -1,13 +1,9 @@ -from common import * +from common import * # isort:skip from trezor import utils - if not utils.BITCOIN_ONLY: - from apps.monero.xmr.serialize.int_serialize import ( - dump_uvarint, - load_uvarint, - ) + from apps.monero.xmr.serialize.int_serialize import dump_uvarint, load_uvarint from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter from apps.monero.xmr.serialize_messages.base import ECPoint from apps.monero.xmr.serialize_messages.tx_prefix import TxinToKey diff --git a/core/tests/test_apps.nem.address.py b/core/tests/test_apps.nem.address.py index b10463cec..22266d803 100644 --- a/core/tests/test_apps.nem.address.py +++ b/core/tests/test_apps.nem.address.py @@ -1,14 +1,15 @@ -from common import * +from common import * # isort:skip from apps.common.paths import HARDENED if not utils.BITCOIN_ONLY: from trezor.crypto import nem + from apps.nem.helpers import ( - check_path, NEM_NETWORK_MAINNET, - NEM_NETWORK_TESTNET, NEM_NETWORK_MIJIN, + NEM_NETWORK_TESTNET, + check_path, ) diff --git a/core/tests/test_apps.nem.hdnode.py b/core/tests/test_apps.nem.hdnode.py index 2393433a4..7e304fbe3 100644 --- a/core/tests/test_apps.nem.hdnode.py +++ b/core/tests/test_apps.nem.hdnode.py @@ -1,8 +1,7 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip32 - if not utils.BITCOIN_ONLY: from apps.nem import CURVE from apps.nem.helpers import NEM_NETWORK_MAINNET diff --git a/core/tests/test_apps.nem.mosaic.py b/core/tests/test_apps.nem.mosaic.py index c63b5fd5d..9fd8916d1 100644 --- a/core/tests/test_apps.nem.mosaic.py +++ b/core/tests/test_apps.nem.mosaic.py @@ -1,7 +1,8 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: from trezor.messages import NEMMosaic + from apps.nem.mosaic.helpers import get_mosaic_definition from apps.nem.transfer import * from apps.nem.transfer.serialize import * diff --git a/core/tests/test_apps.nem.mosaic_creation.py b/core/tests/test_apps.nem.mosaic_creation.py index 53008a548..38eedce9f 100644 --- a/core/tests/test_apps.nem.mosaic_creation.py +++ b/core/tests/test_apps.nem.mosaic_creation.py @@ -1,15 +1,15 @@ -from common import * +from common import * # isort:skip from trezor.crypto import hashlib - if not utils.BITCOIN_ONLY: from trezor.messages import ( - NEMSignTx, NEMMosaicCreation, NEMMosaicDefinition, + NEMSignTx, NEMTransactionCommon, ) + from apps.nem.helpers import * from apps.nem.mosaic import * from apps.nem.mosaic.serialize import * diff --git a/core/tests/test_apps.nem.mosaic_supply_change.py b/core/tests/test_apps.nem.mosaic_supply_change.py index 855d2f105..578035ab6 100644 --- a/core/tests/test_apps.nem.mosaic_supply_change.py +++ b/core/tests/test_apps.nem.mosaic_supply_change.py @@ -1,13 +1,13 @@ -from common import * +from common import * # isort:skip from trezor.crypto import hashlib - if not utils.BITCOIN_ONLY: + from trezor.messages import NEMMosaicSupplyChange, NEMSignTx, NEMTransactionCommon + from apps.nem.helpers import * from apps.nem.mosaic import * from apps.nem.mosaic.serialize import * - from trezor.messages import NEMSignTx, NEMMosaicSupplyChange, NEMTransactionCommon @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") diff --git a/core/tests/test_apps.nem.multisig.aggregate_modification.py b/core/tests/test_apps.nem.multisig.aggregate_modification.py index 843a43ec8..3ab8a6395 100644 --- a/core/tests/test_apps.nem.multisig.aggregate_modification.py +++ b/core/tests/test_apps.nem.multisig.aggregate_modification.py @@ -1,13 +1,15 @@ -from common import * +from common import * # isort:skip from trezor.crypto import hashlib - if not utils.BITCOIN_ONLY: - from trezor.messages import NEMAggregateModification - from trezor.messages import NEMCosignatoryModification - from trezor.messages import NEMSignTx - from trezor.messages import NEMTransactionCommon + from trezor.messages import ( + NEMAggregateModification, + NEMCosignatoryModification, + NEMSignTx, + NEMTransactionCommon, + ) + from apps.nem.helpers import * from apps.nem.multisig import * from apps.nem.multisig.serialize import * diff --git a/core/tests/test_apps.nem.multisig.py b/core/tests/test_apps.nem.multisig.py index c6e0323b7..bb183c734 100644 --- a/core/tests/test_apps.nem.multisig.py +++ b/core/tests/test_apps.nem.multisig.py @@ -1,18 +1,19 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: + from trezor.messages import ( + NEMAggregateModification, + NEMCosignatoryModification, + NEMProvisionNamespace, + NEMSignTx, + NEMTransactionCommon, + ) + from apps.nem.helpers import * from apps.nem.multisig import * from apps.nem.multisig.serialize import * from apps.nem.namespace import * from apps.nem.namespace.serialize import * - from trezor.messages import ( - NEMSignTx, - NEMAggregateModification, - NEMProvisionNamespace, - NEMCosignatoryModification, - NEMTransactionCommon, - ) @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") diff --git a/core/tests/test_apps.nem.namespace.py b/core/tests/test_apps.nem.namespace.py index b634ddbf9..02361e0ac 100644 --- a/core/tests/test_apps.nem.namespace.py +++ b/core/tests/test_apps.nem.namespace.py @@ -1,14 +1,13 @@ -from common import * +from common import * # isort:skip from trezor.crypto import hashlib - if not utils.BITCOIN_ONLY: + from trezor.messages import NEMProvisionNamespace, NEMSignTx, NEMTransactionCommon + from apps.nem.helpers import * from apps.nem.namespace import * from apps.nem.namespace.serialize import * - from trezor.messages import NEMProvisionNamespace, NEMTransactionCommon - from trezor.messages import NEMSignTx @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") diff --git a/core/tests/test_apps.nem.transfer.py b/core/tests/test_apps.nem.transfer.py index ba2841591..4e3419800 100644 --- a/core/tests/test_apps.nem.transfer.py +++ b/core/tests/test_apps.nem.transfer.py @@ -1,14 +1,14 @@ -from common import * +from common import * # isort:skip from trezor.crypto import hashlib - if not utils.BITCOIN_ONLY: + from trezor.messages import NEMMosaic, NEMSignTx, NEMTransactionCommon, NEMTransfer + from apps.nem.helpers import * from apps.nem.mosaic import * from apps.nem.transfer import * from apps.nem.transfer.serialize import * - from trezor.messages import NEMTransfer, NEMTransactionCommon, NEMSignTx, NEMMosaic @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") diff --git a/core/tests/test_apps.ripple.address.py b/core/tests/test_apps.ripple.address.py index 884f36c8b..4b85cd07c 100644 --- a/core/tests/test_apps.ripple.address.py +++ b/core/tests/test_apps.ripple.address.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: from apps.ripple.helpers import address_from_public_key diff --git a/core/tests/test_apps.ripple.serializer.py b/core/tests/test_apps.ripple.serializer.py index 30899d019..8c174a90c 100644 --- a/core/tests/test_apps.ripple.serializer.py +++ b/core/tests/test_apps.ripple.serializer.py @@ -1,10 +1,10 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: - from trezor.messages import RipplePayment - from trezor.messages import RippleSignTx - from apps.ripple.serialize import serialize + from trezor.messages import RipplePayment, RippleSignTx + from apps.ripple import helpers + from apps.ripple.serialize import serialize @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") diff --git a/core/tests/test_apps.solana.predefined_transaction.py b/core/tests/test_apps.solana.predefined_transaction.py index 98742c193..9d0984a0e 100644 --- a/core/tests/test_apps.solana.predefined_transaction.py +++ b/core/tests/test_apps.solana.predefined_transaction.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import base58 diff --git a/core/tests/test_apps.stellar.address.py b/core/tests/test_apps.stellar.address.py index c36674af8..e9cbe159a 100644 --- a/core/tests/test_apps.stellar.address.py +++ b/core/tests/test_apps.stellar.address.py @@ -1,8 +1,7 @@ -from common import * +from common import * # isort:skip from trezor.wire import ProcessError - if not utils.BITCOIN_ONLY: from apps.stellar.helpers import address_from_public_key, public_key_from_address diff --git a/core/tests/test_apps.tezos.address.py b/core/tests/test_apps.tezos.address.py index 74121fab4..4484797fa 100644 --- a/core/tests/test_apps.tezos.address.py +++ b/core/tests/test_apps.tezos.address.py @@ -1,10 +1,11 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: - from apps.tezos.sign_tx import _get_address_from_contract from trezor.enums import TezosContractType from trezor.messages import TezosContractID + from apps.tezos.sign_tx import _get_address_from_contract + @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") class TestTezosAddress(unittest.TestCase): diff --git a/core/tests/test_apps.tezos.encode.py b/core/tests/test_apps.tezos.encode.py index 25fb54955..1f87ff5ca 100644 --- a/core/tests/test_apps.tezos.encode.py +++ b/core/tests/test_apps.tezos.encode.py @@ -1,15 +1,16 @@ -from common import * +from common import * # isort:skip if not utils.BITCOIN_ONLY: from trezor.enums import TezosContractType from trezor.messages import TezosContractID - from apps.tezos.helpers import base58_encode_check, write_bool, CONTRACT_ID_SIZE + + from apps.tezos.helpers import CONTRACT_ID_SIZE, base58_encode_check, write_bool from apps.tezos.sign_tx import ( - write_uint8, - write_bytes_fixed, _encode_data_with_bool_prefix, - _encode_zarith, _encode_natural, + _encode_zarith, + write_bytes_fixed, + write_uint8, ) diff --git a/core/tests/test_apps.webauthn.credential.py b/core/tests/test_apps.webauthn.credential.py index e23b8d435..f5babf58b 100644 --- a/core/tests/test_apps.webauthn.credential.py +++ b/core/tests/test_apps.webauthn.credential.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip import storage import storage.device diff --git a/core/tests/test_apps.zcash.f4jumble.py b/core/tests/test_apps.zcash.f4jumble.py index 001e4a9ad..fe897603f 100644 --- a/core/tests/test_apps.zcash.f4jumble.py +++ b/core/tests/test_apps.zcash.f4jumble.py @@ -1,4 +1,4 @@ -from common import * +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 3ce1b1c70..e7e77d04f 100644 --- a/core/tests/test_apps.zcash.unified_addresses.py +++ b/core/tests/test_apps.zcash.unified_addresses.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from apps.common import coininfo from apps.zcash import unified_addresses diff --git a/core/tests/test_apps.zcash.zip244.py b/core/tests/test_apps.zcash.zip244.py index b935595b8..519339427 100644 --- a/core/tests/test_apps.zcash.zip244.py +++ b/core/tests/test_apps.zcash.zip244.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.enums import InputScriptType from trezor.messages import PrevOutput, SignTx, TxInput diff --git a/core/tests/test_storage.cache.py b/core/tests/test_storage.cache.py index 9f8002750..76fe29655 100644 --- a/core/tests/test_storage.cache.py +++ b/core/tests/test_storage.cache.py @@ -1,10 +1,10 @@ -from common import * +from common import * # isort:skip +from mock_storage import mock_storage from storage import cache from trezor.messages import EndSession, Initialize from apps.base import handle_EndSession, handle_Initialize -from mock_storage import mock_storage KEY = 0 diff --git a/core/tests/test_storage.py b/core/tests/test_storage.py index f18a75316..dfe14b6f2 100644 --- a/core/tests/test_storage.py +++ b/core/tests/test_storage.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from storage import device from trezor import config diff --git a/core/tests/test_trezor.config.py b/core/tests/test_trezor.config.py index 676d216e5..1ebd38752 100644 --- a/core/tests/test_trezor.config.py +++ b/core/tests/test_trezor.config.py @@ -1,9 +1,8 @@ -from common import * +from common import * # isort:skip from trezor import config from trezor.crypto import random - PINAPP = 0x00 PINKEY = 0x00 diff --git a/core/tests/test_trezor.crypto.aes.py b/core/tests/test_trezor.crypto.aes.py index 6bf73866f..e33ed40be 100644 --- a/core/tests/test_trezor.crypto.aes.py +++ b/core/tests/test_trezor.crypto.aes.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import aes diff --git a/core/tests/test_trezor.crypto.base32.py b/core/tests/test_trezor.crypto.base32.py index 137c972ef..913a386b4 100644 --- a/core/tests/test_trezor.crypto.base32.py +++ b/core/tests/test_trezor.crypto.base32.py @@ -1,9 +1,8 @@ -from common import * +from common import * # isort:skip from trezor.crypto import base32 - class TestCryptoBase32(unittest.TestCase): # test vectors from: @@ -26,13 +25,15 @@ 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 - "IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V") + "IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V"), + # fmt: on ] def test_encode(self): diff --git a/core/tests/test_trezor.crypto.base58.py b/core/tests/test_trezor.crypto.base58.py index b0087435b..006cce66e 100644 --- a/core/tests/test_trezor.crypto.base58.py +++ b/core/tests/test_trezor.crypto.base58.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import base58 from trezor.crypto.hashlib import ripemd160 diff --git a/core/tests/test_trezor.crypto.bech32.py b/core/tests/test_trezor.crypto.bech32.py index 00d8b1e4c..168d3e8c5 100644 --- a/core/tests/test_trezor.crypto.bech32.py +++ b/core/tests/test_trezor.crypto.bech32.py @@ -1,4 +1,4 @@ -from common import * +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 2340dd133..8bcc7bfe3 100644 --- a/core/tests/test_trezor.crypto.bip32.py +++ b/core/tests/test_trezor.crypto.bip32.py @@ -1,8 +1,7 @@ -from common import * +from common import * # isort:skip from trezor.crypto import bip32 - SECP256K1_NAME = "secp256k1" HARDENED = 0x80000000 VERSION_PUBLIC = 0x0488B21E diff --git a/core/tests/test_trezor.crypto.bip39.py b/core/tests/test_trezor.crypto.bip39.py index b9e836d29..4d2feef13 100644 --- a/core/tests/test_trezor.crypto.bip39.py +++ b/core/tests/test_trezor.crypto.bip39.py @@ -1,4 +1,4 @@ -from common import * +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 2a9cdd9c6..2a1f63d37 100644 --- a/core/tests/test_trezor.crypto.cashaddr.py +++ b/core/tests/test_trezor.crypto.cashaddr.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip # Copyright (c) 2017 Pieter Wuille # Copyright (c) 2018 Pavol Rusnak @@ -26,7 +26,6 @@ from common import * from trezor.crypto import base58, cashaddr - VALID_CHECKSUM = [ "prefix:x64nx6hz", "p:gpf8m4h7", diff --git a/core/tests/test_trezor.crypto.chacha20poly1305.py b/core/tests/test_trezor.crypto.chacha20poly1305.py index 1055cb454..f4f022dc8 100644 --- a/core/tests/test_trezor.crypto.chacha20poly1305.py +++ b/core/tests/test_trezor.crypto.chacha20poly1305.py @@ -1,4 +1,4 @@ -from common import * +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 5bf88ec23..24d6a23fa 100644 --- a/core/tests/test_trezor.crypto.cosi.py +++ b/core/tests/test_trezor.crypto.cosi.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import cosi, random from trezor.crypto.curve import ed25519 diff --git a/core/tests/test_trezor.crypto.crc.py b/core/tests/test_trezor.crypto.crc.py index ba0dfa3df..3beddfb16 100644 --- a/core/tests/test_trezor.crypto.crc.py +++ b/core/tests/test_trezor.crypto.crc.py @@ -1,4 +1,4 @@ -from common import * +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 a18612c9d..121b1f2a5 100644 --- a/core/tests/test_trezor.crypto.curve.bip340.py +++ b/core/tests/test_trezor.crypto.curve.bip340.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import random from trezor.crypto.curve import bip340 diff --git a/core/tests/test_trezor.crypto.curve.curve25519.py b/core/tests/test_trezor.crypto.curve.curve25519.py index 1f0a31961..0cc3401f0 100644 --- a/core/tests/test_trezor.crypto.curve.curve25519.py +++ b/core/tests/test_trezor.crypto.curve.curve25519.py @@ -1,4 +1,4 @@ -from common import * +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 72449ef29..a03ef8c64 100644 --- a/core/tests/test_trezor.crypto.curve.ed25519.py +++ b/core/tests/test_trezor.crypto.curve.ed25519.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import random from trezor.crypto.curve import ed25519 diff --git a/core/tests/test_trezor.crypto.curve.nist256p1.py b/core/tests/test_trezor.crypto.curve.nist256p1.py index 8d00b1fcd..4a0654499 100644 --- a/core/tests/test_trezor.crypto.curve.nist256p1.py +++ b/core/tests/test_trezor.crypto.curve.nist256p1.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import random from trezor.crypto.curve import nist256p1 diff --git a/core/tests/test_trezor.crypto.curve.secp256k1.py b/core/tests/test_trezor.crypto.curve.secp256k1.py index d89b120b4..de633c0ec 100644 --- a/core/tests/test_trezor.crypto.curve.secp256k1.py +++ b/core/tests/test_trezor.crypto.curve.secp256k1.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import random from trezor.crypto.curve import secp256k1 diff --git a/core/tests/test_trezor.crypto.der.py b/core/tests/test_trezor.crypto.der.py index 2e4fd6072..f7792ebe8 100644 --- a/core/tests/test_trezor.crypto.der.py +++ b/core/tests/test_trezor.crypto.der.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor.crypto import der diff --git a/core/tests/test_trezor.crypto.hashlib.blake256.py b/core/tests/test_trezor.crypto.hashlib.blake256.py index 5baa1f675..d73cc30a6 100644 --- a/core/tests/test_trezor.crypto.hashlib.blake256.py +++ b/core/tests/test_trezor.crypto.hashlib.blake256.py @@ -1,4 +1,4 @@ -from common import * +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 51203e2d7..674564cb5 100644 --- a/core/tests/test_trezor.crypto.hashlib.blake2b.py +++ b/core/tests/test_trezor.crypto.hashlib.blake2b.py @@ -1,4 +1,4 @@ -from common import * +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 ba3a5ba1c..5b1e7e56f 100644 --- a/core/tests/test_trezor.crypto.hashlib.blake2s.py +++ b/core/tests/test_trezor.crypto.hashlib.blake2s.py @@ -1,4 +1,4 @@ -from common import * +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 b65be4cbc..a72a84d89 100644 --- a/core/tests/test_trezor.crypto.hashlib.groestl512.py +++ b/core/tests/test_trezor.crypto.hashlib.groestl512.py @@ -1,4 +1,4 @@ -from common import * +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 e761fd33f..4c28fe506 100644 --- a/core/tests/test_trezor.crypto.hashlib.ripemd160.py +++ b/core/tests/test_trezor.crypto.hashlib.ripemd160.py @@ -1,4 +1,4 @@ -from common import * +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 26cfd6c92..b6ee71134 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha1.py +++ b/core/tests/test_trezor.crypto.hashlib.sha1.py @@ -1,4 +1,4 @@ -from common import * +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 6d14236ef..571f54a4f 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha256.py +++ b/core/tests/test_trezor.crypto.hashlib.sha256.py @@ -1,4 +1,4 @@ -from common import * +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 2c1e40907..2ed633fa9 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha3_256.py +++ b/core/tests/test_trezor.crypto.hashlib.sha3_256.py @@ -1,4 +1,4 @@ -from common import * +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 73de6f5b1..4d3db4da1 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha3_512.py +++ b/core/tests/test_trezor.crypto.hashlib.sha3_512.py @@ -1,4 +1,4 @@ -from common import * +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 a05e7874e..34df4dae4 100644 --- a/core/tests/test_trezor.crypto.hashlib.sha512.py +++ b/core/tests/test_trezor.crypto.hashlib.sha512.py @@ -1,4 +1,4 @@ -from common import * +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 4fff7d306..3debda404 100644 --- a/core/tests/test_trezor.crypto.hmac.py +++ b/core/tests/test_trezor.crypto.hmac.py @@ -1,4 +1,4 @@ -from common import * +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 9554ad237..77ddf6de4 100644 --- a/core/tests/test_trezor.crypto.pbkdf2.py +++ b/core/tests/test_trezor.crypto.pbkdf2.py @@ -1,4 +1,4 @@ -from common import * +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 e9da06ecb..59f8aa9cf 100644 --- a/core/tests/test_trezor.crypto.random.py +++ b/core/tests/test_trezor.crypto.random.py @@ -1,4 +1,4 @@ -from common import * +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 27f3e8fcd..9ecbf6781 100644 --- a/core/tests/test_trezor.crypto.rlp.py +++ b/core/tests/test_trezor.crypto.rlp.py @@ -1,4 +1,4 @@ -from common import * +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 3dc0bf09d..c04c88520 100644 --- a/core/tests/test_trezor.crypto.slip39.py +++ b/core/tests/test_trezor.crypto.slip39.py @@ -1,8 +1,7 @@ -from common import * - -from trezor.crypto import random, slip39 +from common import * # isort:skip from slip39_vectors import vectors +from trezor.crypto import random, slip39 def combinations(iterable, r): diff --git a/core/tests/test_trezor.io.fatfs.py b/core/tests/test_trezor.io.fatfs.py index 359228c5f..c2b29eb9a 100644 --- a/core/tests/test_trezor.io.fatfs.py +++ b/core/tests/test_trezor.io.fatfs.py @@ -1,4 +1,4 @@ -from common import * +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 497bee290..6697e80c2 100644 --- a/core/tests/test_trezor.io.sdcard.py +++ b/core/tests/test_trezor.io.sdcard.py @@ -1,4 +1,4 @@ -from common import * +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 c1b756ba3..6418819bf 100644 --- a/core/tests/test_trezor.protobuf.py +++ b/core/tests/test_trezor.protobuf.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip from trezor import protobuf from trezor.messages import ( diff --git a/core/tests/test_trezor.sdcard.py b/core/tests/test_trezor.sdcard.py index 851c4ae97..3846c5faa 100644 --- a/core/tests/test_trezor.sdcard.py +++ b/core/tests/test_trezor.sdcard.py @@ -1,4 +1,4 @@ -from common import * +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 8448cb2c6..ef39ab7e2 100644 --- a/core/tests/test_trezor.strings.py +++ b/core/tests/test_trezor.strings.py @@ -1,4 +1,4 @@ -from common import * +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 37eb5f5b6..60dec5e80 100644 --- a/core/tests/test_trezor.ui.display.py +++ b/core/tests/test_trezor.ui.display.py @@ -1,10 +1,9 @@ -from common import * +from common import * # isort:skip from trezor.ui import display class TestDisplay(unittest.TestCase): - def test_refresh(self): display.refresh() diff --git a/core/tests/test_trezor.utils.py b/core/tests/test_trezor.utils.py index 41292866c..8f503b2b1 100644 --- a/core/tests/test_trezor.utils.py +++ b/core/tests/test_trezor.utils.py @@ -1,4 +1,4 @@ -from common import * +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 c84a62c70..1da0ea896 100644 --- a/core/tests/test_trezor.wire.codec_v1.py +++ b/core/tests/test_trezor.wire.codec_v1.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip import ustruct diff --git a/core/tests/test_unittest.py b/core/tests/test_unittest.py index f41adb7d6..abbe99006 100644 --- a/core/tests/test_unittest.py +++ b/core/tests/test_unittest.py @@ -1,4 +1,4 @@ -from common import * +from common import * # isort:skip class TestUnittest(unittest.TestCase):