diff --git a/core/tests/common.py b/core/tests/common.py index 349f65f8dd..6cf9585290 100644 --- a/core/tests/common.py +++ b/core/tests/common.py @@ -2,12 +2,12 @@ import sys sys.path.append("../src") -from ubinascii import hexlify, unhexlify # noqa: F401 - import unittest # noqa: F401 from typing import Any, Awaitable +from ubinascii import hexlify, unhexlify # noqa: F401 from trezor import utils # noqa: F401 + from apps.common.paths import HARDENED diff --git a/core/tests/ethereum_common.py b/core/tests/ethereum_common.py index a8b31c0d67..a0ce8e83d1 100644 --- a/core/tests/ethereum_common.py +++ b/core/tests/ethereum_common.py @@ -1,10 +1,10 @@ from ubinascii import unhexlify # noqa: F401 from trezor import messages, protobuf -from trezor.enums import EthereumDefinitionType from trezor.crypto import cosi from trezor.crypto.curve import ed25519 from trezor.crypto.hashlib import sha256 +from trezor.enums import EthereumDefinitionType PRIVATE_KEYS_DEV = [byte * 32 for byte in (b"\xdd", b"\xde", b"\xdf")] diff --git a/core/tests/mock_storage.py b/core/tests/mock_storage.py index 0b8cb31f77..2aa0576050 100644 --- a/core/tests/mock_storage.py +++ b/core/tests/mock_storage.py @@ -1,7 +1,7 @@ -from mock import patch - import storage.common +from mock import patch + class MockStorage: PATCH_METHODS = ("get", "set", "delete") diff --git a/core/tests/test_apps.bitcoin.address.py b/core/tests/test_apps.bitcoin.address.py index 4f35af87b0..ad6cbce3a8 100644 --- a/core/tests/test_apps.bitcoin.address.py +++ b/core/tests/test_apps.bitcoin.address.py @@ -1,20 +1,21 @@ from common import * -from trezor.crypto import bip32, bip39 + from trezor import wire -from trezor.messages import GetAddress +from trezor.crypto import bip32, bip39 from trezor.enums import InputScriptType +from trezor.messages import GetAddress from trezor.utils import HashWriter -from apps.common import coins from apps.bitcoin.addresses import * from apps.bitcoin.addresses import ( + _address_multisig_p2sh, + _address_multisig_p2wsh_in_p2sh, _address_p2wsh, _address_p2wsh_in_p2sh, - _address_multisig_p2wsh_in_p2sh, - _address_multisig_p2sh, ) from apps.bitcoin.keychain import validate_path_against_script_type from apps.bitcoin.writers import * +from apps.common import coins def node_derive(root, path): diff --git a/core/tests/test_apps.bitcoin.address_grs.py b/core/tests/test_apps.bitcoin.address_grs.py index fe6afb4ce5..f2357e6c48 100644 --- a/core/tests/test_apps.bitcoin.address_grs.py +++ b/core/tests/test_apps.bitcoin.address_grs.py @@ -1,10 +1,11 @@ from common import * -from apps.bitcoin.common import * -from apps.bitcoin.addresses import * -from apps.common import coins from trezor.crypto import bip32, bip39 +from apps.bitcoin.addresses import * +from apps.bitcoin.common import * +from apps.common import coins + def node_derive(root, path): node = root.clone() diff --git a/core/tests/test_apps.bitcoin.approver.py b/core/tests/test_apps.bitcoin.approver.py index dd9152b716..cc20df5def 100644 --- a/core/tests/test_apps.bitcoin.approver.py +++ b/core/tests/test_apps.bitcoin.approver.py @@ -1,24 +1,26 @@ -from common import unittest, await_result, H_ +from common import H_, await_result, unittest import storage.cache from trezor import wire from trezor.crypto import bip32 from trezor.crypto.curve import bip340, secp256k1 from trezor.crypto.hashlib import sha256 -from trezor.messages import AuthorizeCoinJoin -from trezor.messages import TxInput -from trezor.messages import TxOutput -from trezor.messages import SignTx -from trezor.messages import CoinJoinRequest from trezor.enums import InputScriptType, OutputScriptType +from trezor.messages import ( + AuthorizeCoinJoin, + CoinJoinRequest, + SignTx, + TxInput, + TxOutput, +) from trezor.utils import HashWriter -from apps.common import coins +from apps.bitcoin import writers from apps.bitcoin.authorization import FEE_RATE_DECIMALS, CoinJoinAuthorization from apps.bitcoin.sign_tx.approvers import CoinJoinApprover from apps.bitcoin.sign_tx.bitcoin import Bitcoin from apps.bitcoin.sign_tx.tx_info import TxInfo -from apps.bitcoin import writers +from apps.common import coins class TestApprover(unittest.TestCase): diff --git a/core/tests/test_apps.bitcoin.authorization.py b/core/tests/test_apps.bitcoin.authorization.py index 7cca018713..9e67a96231 100644 --- a/core/tests/test_apps.bitcoin.authorization.py +++ b/core/tests/test_apps.bitcoin.authorization.py @@ -1,13 +1,11 @@ -from common import unittest, H_ +from common import H_, unittest import storage.cache -from trezor.messages import AuthorizeCoinJoin -from trezor.messages import GetOwnershipProof -from trezor.messages import SignTx from trezor.enums import InputScriptType +from trezor.messages import AuthorizeCoinJoin, GetOwnershipProof, SignTx -from apps.common import coins from apps.bitcoin.authorization import CoinJoinAuthorization +from apps.common import coins _ROUND_ID_LEN = 32 diff --git a/core/tests/test_apps.bitcoin.keychain.py b/core/tests/test_apps.bitcoin.keychain.py index b51bcb92a4..fe103a99c5 100644 --- a/core/tests/test_apps.bitcoin.keychain.py +++ b/core/tests/test_apps.bitcoin.keychain.py @@ -1,4 +1,5 @@ from common import * + from storage import cache from trezor import wire from trezor.crypto import bip39 diff --git a/core/tests/test_apps.bitcoin.ownership_proof.py b/core/tests/test_apps.bitcoin.ownership_proof.py index 1d9710443e..32fdfd5435 100644 --- a/core/tests/test_apps.bitcoin.ownership_proof.py +++ b/core/tests/test_apps.bitcoin.ownership_proof.py @@ -1,22 +1,22 @@ from common import unhexlify, unittest + from trezor.crypto import bip39 from trezor.enums import InputScriptType -from trezor.messages import MultisigRedeemScriptType -from trezor.messages import HDNodeType +from trezor.messages import HDNodeType, MultisigRedeemScriptType -from apps.common import coins -from apps.common.keychain import Keychain -from apps.common.paths import HARDENED, AlwaysMatchingSchema from apps.bitcoin import ownership, scripts from apps.bitcoin.addresses import ( + _address_multisig_p2sh, + _address_multisig_p2wsh, + _address_multisig_p2wsh_in_p2sh, _address_p2tr, address_p2wpkh, address_p2wpkh_in_p2sh, - _address_multisig_p2wsh, - _address_multisig_p2wsh_in_p2sh, - _address_multisig_p2sh, ) from apps.bitcoin.multisig import multisig_get_pubkeys +from apps.common import coins +from apps.common.keychain import Keychain +from apps.common.paths import HARDENED, AlwaysMatchingSchema class TestOwnershipProof(unittest.TestCase): 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 77ae98c7d6..a2844c96be 100644 --- a/core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py +++ b/core/tests/test_apps.bitcoin.segwit.bip143.native_p2wpkh.py @@ -1,5 +1,9 @@ from common import * +from trezor.crypto import bip39 +from trezor.enums import InputScriptType, OutputScriptType +from trezor.messages import PrevOutput, SignTx, TxInput, TxOutput + from apps.bitcoin.common import SigHashType from apps.bitcoin.scripts import output_derive_script from apps.bitcoin.sign_tx.sig_hasher import BitcoinSigHasher @@ -7,13 +11,6 @@ from apps.bitcoin.writers import get_tx_hash from apps.common import coins from apps.common.keychain import Keychain from apps.common.paths import AlwaysMatchingSchema -from trezor.messages import SignTx -from trezor.messages import TxInput -from trezor.messages import TxOutput -from trezor.messages import PrevOutput -from trezor.enums import InputScriptType -from trezor.enums import OutputScriptType -from trezor.crypto import bip39 class TestSegwitBip143NativeP2WPKH(unittest.TestCase): 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 60d7e15809..293244741a 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,5 +1,9 @@ from common import * +from trezor.crypto import bip39 +from trezor.enums import InputScriptType, OutputScriptType +from trezor.messages import PrevOutput, SignTx, TxInput, TxOutput + from apps.bitcoin.common import SigHashType from apps.bitcoin.scripts import output_derive_script from apps.bitcoin.sign_tx.sig_hasher import BitcoinSigHasher @@ -7,13 +11,6 @@ from apps.bitcoin.writers import get_tx_hash from apps.common import coins from apps.common.keychain import Keychain from apps.common.paths import AlwaysMatchingSchema -from trezor.messages import SignTx -from trezor.messages import TxInput -from trezor.messages import TxOutput -from trezor.messages import PrevOutput -from trezor.enums import InputScriptType -from trezor.enums import OutputScriptType -from trezor.crypto import bip39 class TestSegwitBip143(unittest.TestCase): diff --git a/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py b/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py index b86eec1e9d..df9cecd2f0 100644 --- a/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py +++ b/core/tests/test_apps.bitcoin.segwit.bip341.p2tr.py @@ -3,11 +3,9 @@ from common import * 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.messages import SignTx -from trezor.messages import TxInput -from trezor.messages import PrevOutput -from trezor.enums import InputScriptType +from trezor.enums import InputScriptType +from trezor.messages import PrevOutput, SignTx, TxInput VECTORS = [ { # https://github.com/bitcoin/bips/pull/1225/commits/f7af1f73b287c14cf2f63afcb8d199feaf6ab5e1 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 dbcca0f478..18d64ed59f 100644 --- a/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py +++ b/core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh.py @@ -1,36 +1,35 @@ from common import * -from trezor.utils import chunks -from trezor.crypto import bip39 -from trezor.messages import SignTx -from trezor.messages import TxAckInput -from trezor.messages import TxAckInputWrapper -from trezor.messages import TxInput -from trezor.messages import TxAckOutput -from trezor.messages import TxAckOutputWrapper -from trezor.messages import TxOutput -from trezor.messages import TxAckPrevMeta -from trezor.messages import PrevTx -from trezor.messages import TxAckPrevInput -from trezor.messages import TxAckPrevInputWrapper -from trezor.messages import PrevInput -from trezor.messages import TxAckPrevOutput -from trezor.messages import TxAckPrevOutputWrapper -from trezor.messages import PrevOutput -from trezor.messages import TxRequest -from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED -from trezor.messages import TxRequestDetailsType -from trezor.messages import TxRequestSerializedType -from trezor.enums import AmountUnit -from trezor.enums import InputScriptType -from trezor.enums import OutputScriptType from trezor import wire +from trezor.crypto import bip39 +from trezor.enums import AmountUnit, InputScriptType, OutputScriptType +from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT +from trezor.messages import ( + PrevInput, + PrevOutput, + PrevTx, + SignTx, + TxAckInput, + TxAckInputWrapper, + TxAckOutput, + TxAckOutputWrapper, + TxAckPrevInput, + TxAckPrevInputWrapper, + TxAckPrevMeta, + TxAckPrevOutput, + TxAckPrevOutputWrapper, + TxInput, + TxOutput, + TxRequest, + TxRequestDetailsType, + TxRequestSerializedType, +) +from trezor.utils import chunks +from apps.bitcoin.keychain import _get_schemas_for_coin +from apps.bitcoin.sign_tx import bitcoin, helpers from apps.common import coins from apps.common.keychain import Keychain -from apps.bitcoin.keychain import _get_schemas_for_coin -from apps.bitcoin.sign_tx import helpers, bitcoin - EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray()) 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 d5ef49c13f..a390755beb 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,35 +1,34 @@ from common import * -from trezor.utils import chunks from trezor.crypto import bip39 -from trezor.messages import SignTx -from trezor.messages import TxAckInput -from trezor.messages import TxAckInputWrapper -from trezor.messages import TxInput -from trezor.messages import TxAckOutput -from trezor.messages import TxAckOutputWrapper -from trezor.messages import TxOutput -from trezor.messages import TxAckPrevMeta -from trezor.messages import PrevTx -from trezor.messages import TxAckPrevInput -from trezor.messages import TxAckPrevInputWrapper -from trezor.messages import PrevInput -from trezor.messages import TxAckPrevOutput -from trezor.messages import TxAckPrevOutputWrapper -from trezor.messages import PrevOutput -from trezor.messages import TxRequest -from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED -from trezor.messages import TxRequestDetailsType -from trezor.messages import TxRequestSerializedType -from trezor.enums import AmountUnit -from trezor.enums import InputScriptType -from trezor.enums import OutputScriptType +from trezor.enums import AmountUnit, InputScriptType, OutputScriptType +from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT +from trezor.messages import ( + PrevInput, + PrevOutput, + PrevTx, + SignTx, + TxAckInput, + TxAckInputWrapper, + TxAckOutput, + TxAckOutputWrapper, + TxAckPrevInput, + TxAckPrevInputWrapper, + TxAckPrevMeta, + TxAckPrevOutput, + TxAckPrevOutputWrapper, + TxInput, + TxOutput, + TxRequest, + TxRequestDetailsType, + TxRequestSerializedType, +) +from trezor.utils import chunks -from apps.common import coins -from apps.common.keychain import Keychain from apps.bitcoin.keychain import _get_schemas_for_coin from apps.bitcoin.sign_tx import bitcoinlike, helpers - +from apps.common import coins +from apps.common.keychain import Keychain EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray()) 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 8e0ecf3292..3bfa884893 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,36 +1,35 @@ from common import * -from trezor.utils import chunks -from trezor.crypto import bip39 -from trezor.messages import SignTx -from trezor.messages import TxAckInput -from trezor.messages import TxAckInputWrapper -from trezor.messages import TxInput -from trezor.messages import TxAckOutput -from trezor.messages import TxAckOutputWrapper -from trezor.messages import TxOutput -from trezor.messages import TxAckPrevMeta -from trezor.messages import PrevTx -from trezor.messages import TxAckPrevInput -from trezor.messages import TxAckPrevInputWrapper -from trezor.messages import PrevInput -from trezor.messages import TxAckPrevOutput -from trezor.messages import TxAckPrevOutputWrapper -from trezor.messages import PrevOutput -from trezor.messages import TxRequest -from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED -from trezor.messages import TxRequestDetailsType -from trezor.messages import TxRequestSerializedType -from trezor.enums import AmountUnit -from trezor.enums import InputScriptType -from trezor.enums import OutputScriptType from trezor import wire +from trezor.crypto import bip39 +from trezor.enums import AmountUnit, InputScriptType, OutputScriptType +from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT +from trezor.messages import ( + PrevInput, + PrevOutput, + PrevTx, + SignTx, + TxAckInput, + TxAckInputWrapper, + TxAckOutput, + TxAckOutputWrapper, + TxAckPrevInput, + TxAckPrevInputWrapper, + TxAckPrevMeta, + TxAckPrevOutput, + TxAckPrevOutputWrapper, + TxInput, + TxOutput, + TxRequest, + TxRequestDetailsType, + TxRequestSerializedType, +) +from trezor.utils import chunks -from apps.common import coins -from apps.common.keychain import Keychain from apps.bitcoin.keychain import _get_schemas_for_coin from apps.bitcoin.sign_tx import bitcoin, helpers - +from apps.common import coins +from apps.common.keychain import Keychain EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray()) 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 a7c4434802..f3c55ea754 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,35 +1,34 @@ from common import * -from trezor.utils import chunks from trezor.crypto import bip39 -from trezor.messages import SignTx -from trezor.messages import TxAckInput -from trezor.messages import TxAckInputWrapper -from trezor.messages import TxInput -from trezor.messages import TxAckOutput -from trezor.messages import TxAckOutputWrapper -from trezor.messages import TxOutput -from trezor.messages import TxAckPrevMeta -from trezor.messages import PrevTx -from trezor.messages import TxAckPrevInput -from trezor.messages import TxAckPrevInputWrapper -from trezor.messages import PrevInput -from trezor.messages import TxAckPrevOutput -from trezor.messages import TxAckPrevOutputWrapper -from trezor.messages import PrevOutput -from trezor.messages import TxRequest -from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED -from trezor.messages import TxRequestDetailsType -from trezor.messages import TxRequestSerializedType -from trezor.enums import AmountUnit -from trezor.enums import InputScriptType -from trezor.enums import OutputScriptType +from trezor.enums import AmountUnit, InputScriptType, OutputScriptType +from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT +from trezor.messages import ( + PrevInput, + PrevOutput, + PrevTx, + SignTx, + TxAckInput, + TxAckInputWrapper, + TxAckOutput, + TxAckOutputWrapper, + TxAckPrevInput, + TxAckPrevInputWrapper, + TxAckPrevMeta, + TxAckPrevOutput, + TxAckPrevOutputWrapper, + TxInput, + TxOutput, + TxRequest, + TxRequestDetailsType, + TxRequestSerializedType, +) +from trezor.utils import chunks -from apps.common import coins -from apps.common.keychain import Keychain from apps.bitcoin.keychain import _get_schemas_for_coin from apps.bitcoin.sign_tx import bitcoinlike, helpers - +from apps.common import coins +from apps.common.keychain import Keychain EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray()) diff --git a/core/tests/test_apps.bitcoin.sign_tx.writers.py b/core/tests/test_apps.bitcoin.sign_tx.writers.py index 6ce2d989f8..36bc9943ba 100644 --- a/core/tests/test_apps.bitcoin.sign_tx.writers.py +++ b/core/tests/test_apps.bitcoin.sign_tx.writers.py @@ -1,7 +1,7 @@ from common import * -from trezor.messages import TxInput from trezor.enums import InputScriptType +from trezor.messages import TxInput from apps.bitcoin import writers diff --git a/core/tests/test_apps.bitcoin.signtx.fee_threshold.py b/core/tests/test_apps.bitcoin.signtx.fee_threshold.py index bcadb66185..aad6803240 100644 --- a/core/tests/test_apps.bitcoin.signtx.fee_threshold.py +++ b/core/tests/test_apps.bitcoin.signtx.fee_threshold.py @@ -1,34 +1,34 @@ from common import * -from trezor.utils import chunks from trezor.crypto import bip32, bip39 -from trezor.messages import SignTx -from trezor.messages import TxAckInput -from trezor.messages import TxAckInputWrapper -from trezor.messages import TxInput -from trezor.messages import TxAckOutput -from trezor.messages import TxAckOutputWrapper -from trezor.messages import TxOutput -from trezor.messages import TxAckPrevMeta -from trezor.messages import PrevTx -from trezor.messages import TxAckPrevInput -from trezor.messages import TxAckPrevInputWrapper -from trezor.messages import PrevInput -from trezor.messages import TxAckPrevOutput -from trezor.messages import TxAckPrevOutputWrapper -from trezor.messages import PrevOutput -from trezor.messages import TxRequest -from trezor.enums.RequestType import TXINPUT, TXOUTPUT, TXMETA -from trezor.messages import TxRequestDetailsType -from trezor.messages import TxRequestSerializedType -from trezor.enums import AmountUnit -from trezor.enums import OutputScriptType +from trezor.enums import AmountUnit, OutputScriptType +from trezor.enums.RequestType import TXINPUT, TXMETA, TXOUTPUT +from trezor.messages import ( + PrevInput, + PrevOutput, + PrevTx, + SignTx, + TxAckInput, + TxAckInputWrapper, + TxAckOutput, + TxAckOutputWrapper, + TxAckPrevInput, + TxAckPrevInputWrapper, + TxAckPrevMeta, + TxAckPrevOutput, + TxAckPrevOutputWrapper, + TxInput, + TxOutput, + TxRequest, + TxRequestDetailsType, + TxRequestSerializedType, +) +from trezor.utils import chunks +from apps.bitcoin.sign_tx import bitcoin, helpers from apps.common import coins from apps.common.keychain import Keychain from apps.common.paths import AlwaysMatchingSchema -from apps.bitcoin.sign_tx import bitcoin, helpers - EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray()) diff --git a/core/tests/test_apps.bitcoin.signtx.py b/core/tests/test_apps.bitcoin.signtx.py index 297a21c3ab..23c3f93854 100644 --- a/core/tests/test_apps.bitcoin.signtx.py +++ b/core/tests/test_apps.bitcoin.signtx.py @@ -1,34 +1,34 @@ from common import * -from trezor.utils import chunks from trezor.crypto import bip39 -from trezor.messages import SignTx -from trezor.messages import TxAckInput -from trezor.messages import TxAckInputWrapper -from trezor.messages import TxInput -from trezor.messages import TxAckOutput -from trezor.messages import TxAckOutputWrapper -from trezor.messages import TxOutput -from trezor.messages import TxAckPrevMeta -from trezor.messages import PrevTx -from trezor.messages import TxAckPrevInput -from trezor.messages import TxAckPrevInputWrapper -from trezor.messages import PrevInput -from trezor.messages import TxAckPrevOutput -from trezor.messages import TxAckPrevOutputWrapper -from trezor.messages import PrevOutput -from trezor.messages import TxRequest -from trezor.enums.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXFINISHED -from trezor.messages import TxRequestDetailsType -from trezor.messages import TxRequestSerializedType -from trezor.enums import AmountUnit -from trezor.enums import OutputScriptType +from trezor.enums import AmountUnit, OutputScriptType +from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT +from trezor.messages import ( + PrevInput, + PrevOutput, + PrevTx, + SignTx, + TxAckInput, + TxAckInputWrapper, + TxAckOutput, + TxAckOutputWrapper, + TxAckPrevInput, + TxAckPrevInputWrapper, + TxAckPrevMeta, + TxAckPrevOutput, + TxAckPrevOutputWrapper, + TxInput, + TxOutput, + TxRequest, + TxRequestDetailsType, + TxRequestSerializedType, +) +from trezor.utils import chunks -from apps.common import coins -from apps.common.keychain import Keychain from apps.bitcoin.keychain import _get_schemas_for_coin from apps.bitcoin.sign_tx import bitcoin, helpers - +from apps.common import coins +from apps.common.keychain import Keychain EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray()) diff --git a/core/tests/test_apps.bitcoin.signtx_decred.py b/core/tests/test_apps.bitcoin.signtx_decred.py index a2bfba91e0..17faf6516a 100644 --- a/core/tests/test_apps.bitcoin.signtx_decred.py +++ b/core/tests/test_apps.bitcoin.signtx_decred.py @@ -1,34 +1,34 @@ from common import * -from trezor.utils import chunks from trezor.crypto import bip39 -from trezor.messages import SignTx -from trezor.messages import TxAckInput -from trezor.messages import TxAckInputWrapper -from trezor.messages import TxInput -from trezor.messages import TxAckOutput -from trezor.messages import TxAckOutputWrapper -from trezor.messages import TxOutput -from trezor.messages import TxAckPrevMeta -from trezor.messages import PrevTx -from trezor.messages import TxAckPrevInput -from trezor.messages import TxAckPrevInputWrapper -from trezor.messages import PrevInput -from trezor.messages import TxAckPrevOutput -from trezor.messages import TxAckPrevOutputWrapper -from trezor.messages import PrevOutput -from trezor.messages import TxRequest -from trezor.enums.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXFINISHED -from trezor.messages import TxRequestDetailsType -from trezor.messages import TxRequestSerializedType -from trezor.enums import AmountUnit -from trezor.enums import OutputScriptType +from trezor.enums import AmountUnit, OutputScriptType +from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT +from trezor.messages import ( + PrevInput, + PrevOutput, + PrevTx, + SignTx, + TxAckInput, + TxAckInputWrapper, + TxAckOutput, + TxAckOutputWrapper, + TxAckPrevInput, + TxAckPrevInputWrapper, + TxAckPrevMeta, + TxAckPrevOutput, + TxAckPrevOutputWrapper, + TxInput, + TxOutput, + TxRequest, + TxRequestDetailsType, + TxRequestSerializedType, +) +from trezor.utils import chunks -from apps.common import coins -from apps.common.keychain import Keychain from apps.bitcoin.keychain import _get_schemas_for_coin from apps.bitcoin.sign_tx import decred, helpers - +from apps.common import coins +from apps.common.keychain import Keychain EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray()) diff --git a/core/tests/test_apps.bitcoin.signtx_grs.py b/core/tests/test_apps.bitcoin.signtx_grs.py index 3c98b60899..9d8c9661d7 100644 --- a/core/tests/test_apps.bitcoin.signtx_grs.py +++ b/core/tests/test_apps.bitcoin.signtx_grs.py @@ -1,34 +1,34 @@ from common import * -from trezor.utils import chunks from trezor.crypto import bip39 -from trezor.messages import SignTx -from trezor.messages import TxAckInput -from trezor.messages import TxAckInputWrapper -from trezor.messages import TxInput -from trezor.messages import TxAckOutput -from trezor.messages import TxAckOutputWrapper -from trezor.messages import TxOutput -from trezor.messages import TxAckPrevMeta -from trezor.messages import PrevTx -from trezor.messages import TxAckPrevInput -from trezor.messages import TxAckPrevInputWrapper -from trezor.messages import PrevInput -from trezor.messages import TxAckPrevOutput -from trezor.messages import TxAckPrevOutputWrapper -from trezor.messages import PrevOutput -from trezor.messages import TxRequest -from trezor.enums.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXFINISHED -from trezor.messages import TxRequestDetailsType -from trezor.messages import TxRequestSerializedType -from trezor.enums import AmountUnit -from trezor.enums import OutputScriptType +from trezor.enums import AmountUnit, OutputScriptType +from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT +from trezor.messages import ( + PrevInput, + PrevOutput, + PrevTx, + SignTx, + TxAckInput, + TxAckInputWrapper, + TxAckOutput, + TxAckOutputWrapper, + TxAckPrevInput, + TxAckPrevInputWrapper, + TxAckPrevMeta, + TxAckPrevOutput, + TxAckPrevOutputWrapper, + TxInput, + TxOutput, + TxRequest, + TxRequestDetailsType, + TxRequestSerializedType, +) +from trezor.utils import chunks -from apps.common import coins -from apps.common.keychain import Keychain from apps.bitcoin.keychain import _get_schemas_for_coin from apps.bitcoin.sign_tx import bitcoinlike, helpers - +from apps.common import coins +from apps.common.keychain import Keychain EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray()) diff --git a/core/tests/test_apps.bitcoin.txweight.py b/core/tests/test_apps.bitcoin.txweight.py index 3fba834e06..8e17132773 100644 --- a/core/tests/test_apps.bitcoin.txweight.py +++ b/core/tests/test_apps.bitcoin.txweight.py @@ -1,17 +1,14 @@ from common import * -from trezor.messages import MultisigRedeemScriptType -from trezor.messages import TxInput -from trezor.messages import TxOutput -from trezor.messages import HDNodeType -from trezor.enums import OutputScriptType from trezor.crypto import bip39 +from trezor.enums import OutputScriptType +from trezor.messages import HDNodeType, MultisigRedeemScriptType, TxInput, TxOutput +from apps.bitcoin.scripts import output_derive_script, output_script_paytoopreturn +from apps.bitcoin.sign_tx.tx_weight import * from apps.common import coins from apps.common.keychain import Keychain from apps.common.paths import AlwaysMatchingSchema -from apps.bitcoin.sign_tx.tx_weight import * -from apps.bitcoin.scripts import output_derive_script, output_script_paytoopreturn class TestCalculateTxWeight(unittest.TestCase): diff --git a/core/tests/test_apps.bitcoin.zcash.zip243.py b/core/tests/test_apps.bitcoin.zcash.zip243.py index 6bd3d16cd5..99aa7ef064 100644 --- a/core/tests/test_apps.bitcoin.zcash.zip243.py +++ b/core/tests/test_apps.bitcoin.zcash.zip243.py @@ -1,12 +1,11 @@ from common import * -from trezor.enums import InputScriptType -from trezor.messages import SignTx -from trezor.messages import TxInput -from trezor.messages import PrevOutput -from apps.common import coins +from trezor.enums import InputScriptType +from trezor.messages import PrevOutput, SignTx, TxInput + from apps.bitcoin.common import SigHashType from apps.bitcoin.writers import get_tx_hash +from apps.common import coins if not utils.BITCOIN_ONLY: from apps.bitcoin.sign_tx.zcash_v4 import Zip243SigHasher diff --git a/core/tests/test_apps.cardano.address.py b/core/tests/test_apps.cardano.address.py index 662fc42ed0..bc05130159 100644 --- a/core/tests/test_apps.cardano.address.py +++ b/core/tests/test_apps.cardano.address.py @@ -1,9 +1,9 @@ from common import * + from trezor import wire from trezor.crypto import cardano, slip39 from trezor.enums import CardanoAddressType -from trezor.messages import CardanoAddressParametersType -from trezor.messages import CardanoBlockchainPointerType +from trezor.messages import CardanoAddressParametersType, CardanoBlockchainPointerType from apps.common import seed from apps.common.paths import HARDENED diff --git a/core/tests/test_apps.cardano.certificate.py b/core/tests/test_apps.cardano.certificate.py index 2512a99bd7..048911a5c3 100644 --- a/core/tests/test_apps.cardano.certificate.py +++ b/core/tests/test_apps.cardano.certificate.py @@ -1,7 +1,8 @@ from common import * + from trezor import wire from trezor.enums import CardanoCertificateType -from trezor.messages import CardanoTxCertificate, CardanoPoolParametersType +from trezor.messages import CardanoPoolParametersType, CardanoTxCertificate from apps.common.paths import HARDENED diff --git a/core/tests/test_apps.cardano.credential.py b/core/tests/test_apps.cardano.credential.py index 73dc556e23..78a60cb1c3 100644 --- a/core/tests/test_apps.cardano.credential.py +++ b/core/tests/test_apps.cardano.credential.py @@ -1,10 +1,10 @@ from common import * -from apps.cardano.helpers.credential import Credential -from apps.common.paths import HARDENED from trezor.enums import CardanoAddressType from trezor.messages import CardanoAddressParametersType, CardanoBlockchainPointerType +from apps.cardano.helpers.credential import Credential +from apps.common.paths import HARDENED CERTIFICATE_POINTER = CardanoBlockchainPointerType( block_index=24157, diff --git a/core/tests/test_apps.cardano.get_public_key.py b/core/tests/test_apps.cardano.get_public_key.py index a235d619e4..10546931bf 100644 --- a/core/tests/test_apps.cardano.get_public_key.py +++ b/core/tests/test_apps.cardano.get_public_key.py @@ -1,9 +1,10 @@ from common import * -from apps.cardano.seed import Keychain -from apps.cardano.get_public_key import _get_public_key from trezor.crypto import cardano, slip39 +from apps.cardano.get_public_key import _get_public_key +from apps.cardano.seed import Keychain + @unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin") class TestCardanoGetPublicKey(unittest.TestCase): diff --git a/core/tests/test_apps.cardano.native_script.py b/core/tests/test_apps.cardano.native_script.py index e05eb222f3..c4c9723536 100644 --- a/core/tests/test_apps.cardano.native_script.py +++ b/core/tests/test_apps.cardano.native_script.py @@ -1,9 +1,11 @@ from common import * + 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 ( diff --git a/core/tests/test_apps.cardano.seed.py b/core/tests/test_apps.cardano.seed.py index 180b400dc0..4b6d771b5e 100644 --- a/core/tests/test_apps.cardano.seed.py +++ b/core/tests/test_apps.cardano.seed.py @@ -1,4 +1,5 @@ from common import * + from trezor.crypto import cardano from apps.common.paths import HARDENED diff --git a/core/tests/test_apps.cardano.sign_tx.py b/core/tests/test_apps.cardano.sign_tx.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core/tests/test_apps.cardano.staking_use_cases.py b/core/tests/test_apps.cardano.staking_use_cases.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core/tests/test_apps.common.cbor.py b/core/tests/test_apps.common.cbor.py index aa2950b3e8..264ab96a76 100644 --- a/core/tests/test_apps.common.cbor.py +++ b/core/tests/test_apps.common.cbor.py @@ -5,8 +5,8 @@ from apps.common.cbor import ( OrderedMap, Tagged, create_array_header, - create_map_header, create_embedded_cbor_bytes_header, + create_map_header, decode, encode, encode_streamed, diff --git a/core/tests/test_apps.common.keychain.py b/core/tests/test_apps.common.keychain.py index 99ac4c6930..8fe0b99b27 100644 --- a/core/tests/test_apps.common.keychain.py +++ b/core/tests/test_apps.common.keychain.py @@ -1,15 +1,15 @@ from common import * -from mock_storage import mock_storage - from storage import cache -from apps.common import safety_checks -from apps.common.paths import PATTERN_SEP5, PathSchema -from apps.common.keychain import LRUCache, Keychain, with_slip44_keychain, get_keychain from trezor import wire from trezor.crypto import bip39 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): def setUp(self): diff --git a/core/tests/test_apps.common.paths.py b/core/tests/test_apps.common.paths.py index ce1a2a1891..fbcc0629b3 100644 --- a/core/tests/test_apps.common.paths.py +++ b/core/tests/test_apps.common.paths.py @@ -1,7 +1,10 @@ from common import * + from trezor.utils import ensure + from apps.common.paths import * + # NOTE: moved into tests not to occupy flash space # in firmware binary, when it is not used in production class NeverMatchingSchema: diff --git a/core/tests/test_apps.common.seed.py b/core/tests/test_apps.common.seed.py index 77abdef5aa..a21e882b85 100644 --- a/core/tests/test_apps.common.seed.py +++ b/core/tests/test_apps.common.seed.py @@ -1,9 +1,10 @@ from common import * +from trezor import wire +from trezor.crypto import bip39 + from apps.common.keychain import Keychain from apps.common.seed import Slip21Node -from trezor import wire -from trezor.crypto import bip39 class TestSeed(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 3db18f16b1..07125416b3 100644 --- a/core/tests/test_apps.eos.get_public_key.py +++ b/core/tests/test_apps.eos.get_public_key.py @@ -3,6 +3,7 @@ from common import * 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 370b616a07..b9fae418c8 100644 --- a/core/tests/test_apps.ethereum.definitions.py +++ b/core/tests/test_apps.ethereum.definitions.py @@ -1,9 +1,12 @@ from common import * -import unittest + import typing as t -from trezor import utils, wire +import unittest from ubinascii import hexlify # noqa: F401 +from trezor import utils, wire + + if not utils.BITCOIN_ONLY: from apps.ethereum import networks, tokens diff --git a/core/tests/test_apps.ethereum.helpers.py b/core/tests/test_apps.ethereum.helpers.py index 2beccdd617..2b051222e8 100644 --- a/core/tests/test_apps.ethereum.helpers.py +++ b/core/tests/test_apps.ethereum.helpers.py @@ -1,4 +1,5 @@ from common import * + from apps.common.paths import HARDENED if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.ethereum.keychain.py b/core/tests/test_apps.ethereum.keychain.py index 2b917d678b..37e9b1797b 100644 --- a/core/tests/test_apps.ethereum.keychain.py +++ b/core/tests/test_apps.ethereum.keychain.py @@ -3,8 +3,9 @@ from common import * import unittest from storage import cache -from trezor import wire, utils +from trezor import utils, wire from trezor.crypto import bip39 + from apps.common.keychain import get_keychain from apps.common.paths import HARDENED diff --git a/core/tests/test_apps.ethereum.sign_typed_data.py b/core/tests/test_apps.ethereum.sign_typed_data.py index 882eae3388..0ab5c73d49 100644 --- a/core/tests/test_apps.ethereum.sign_typed_data.py +++ b/core/tests/test_apps.ethereum.sign_typed_data.py @@ -2,11 +2,13 @@ from common import * from trezor import wire from trezor.wire import context -from trezor.messages import EthereumTypedDataStructAck as ETDSA -from trezor.messages import EthereumStructMember as ESM -from trezor.messages import EthereumFieldType as EFT -from trezor.messages import EthereumTypedDataValueAck from trezor.enums import EthereumDataType as EDT +from trezor.messages import ( + EthereumFieldType as EFT, + EthereumStructMember as ESM, + EthereumTypedDataStructAck as ETDSA, + EthereumTypedDataValueAck, +) 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 d3dc5ef1e1..f8dceb73c8 100644 --- a/core/tests/test_apps.management.recovery_device.py +++ b/core/tests/test_apps.management.recovery_device.py @@ -1,16 +1,17 @@ from common import * -from mock_storage import mock_storage import storage import storage.recovery -from apps.management.recovery_device.recover import process_slip39 from trezor.enums import BackupType + +from apps.management.recovery_device.recover import process_slip39 from apps.management.recovery_device.word_validity import ( - check, - IdentifierMismatch, AlreadyAdded, + IdentifierMismatch, 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.serializer.py b/core/tests/test_apps.monero.serializer.py index dba49456cc..74bb8676c1 100644 --- a/core/tests/test_apps.monero.serializer.py +++ b/core/tests/test_apps.monero.serializer.py @@ -1,6 +1,8 @@ from common import * + from trezor import utils + if not utils.BITCOIN_ONLY: from apps.monero.xmr.serialize.int_serialize import ( dump_uvarint, diff --git a/core/tests/test_apps.nem.address.py b/core/tests/test_apps.nem.address.py index 251cefce7a..b10463cec0 100644 --- a/core/tests/test_apps.nem.address.py +++ b/core/tests/test_apps.nem.address.py @@ -1,4 +1,5 @@ from common import * + from apps.common.paths import HARDENED if not utils.BITCOIN_ONLY: diff --git a/core/tests/test_apps.nem.hdnode.py b/core/tests/test_apps.nem.hdnode.py index 4f506c17f8..2393433a40 100644 --- a/core/tests/test_apps.nem.hdnode.py +++ b/core/tests/test_apps.nem.hdnode.py @@ -1,6 +1,8 @@ from common import * + 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_creation.py b/core/tests/test_apps.nem.mosaic_creation.py index f69a50502d..53008a548b 100644 --- a/core/tests/test_apps.nem.mosaic_creation.py +++ b/core/tests/test_apps.nem.mosaic_creation.py @@ -2,6 +2,7 @@ from common import * from trezor.crypto import hashlib + if not utils.BITCOIN_ONLY: from trezor.messages import ( NEMSignTx, diff --git a/core/tests/test_apps.nem.mosaic_supply_change.py b/core/tests/test_apps.nem.mosaic_supply_change.py index 2debd0319d..855d2f105b 100644 --- a/core/tests/test_apps.nem.mosaic_supply_change.py +++ b/core/tests/test_apps.nem.mosaic_supply_change.py @@ -2,6 +2,7 @@ from common import * from trezor.crypto import hashlib + if not utils.BITCOIN_ONLY: from apps.nem.helpers import * from apps.nem.mosaic import * diff --git a/core/tests/test_apps.nem.multisig.aggregate_modification.py b/core/tests/test_apps.nem.multisig.aggregate_modification.py index e9384620c5..843a43ec8e 100644 --- a/core/tests/test_apps.nem.multisig.aggregate_modification.py +++ b/core/tests/test_apps.nem.multisig.aggregate_modification.py @@ -1,6 +1,8 @@ from common import * + from trezor.crypto import hashlib + if not utils.BITCOIN_ONLY: from trezor.messages import NEMAggregateModification from trezor.messages import NEMCosignatoryModification diff --git a/core/tests/test_apps.nem.namespace.py b/core/tests/test_apps.nem.namespace.py index 8e78c61f73..b634ddbf9b 100644 --- a/core/tests/test_apps.nem.namespace.py +++ b/core/tests/test_apps.nem.namespace.py @@ -2,6 +2,7 @@ from common import * from trezor.crypto import hashlib + if not utils.BITCOIN_ONLY: from apps.nem.helpers import * from apps.nem.namespace import * diff --git a/core/tests/test_apps.nem.transfer.py b/core/tests/test_apps.nem.transfer.py index 480a0188e2..ba28415917 100644 --- a/core/tests/test_apps.nem.transfer.py +++ b/core/tests/test_apps.nem.transfer.py @@ -2,6 +2,7 @@ from common import * from trezor.crypto import hashlib + if not utils.BITCOIN_ONLY: from apps.nem.helpers import * from apps.nem.mosaic import * diff --git a/core/tests/test_apps.stellar.address.py b/core/tests/test_apps.stellar.address.py index dbc477361e..c36674af80 100644 --- a/core/tests/test_apps.stellar.address.py +++ b/core/tests/test_apps.stellar.address.py @@ -1,6 +1,8 @@ from common import * + 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.webauthn.credential.py b/core/tests/test_apps.webauthn.credential.py index 76d31be65a..e23b8d4351 100644 --- a/core/tests/test_apps.webauthn.credential.py +++ b/core/tests/test_apps.webauthn.credential.py @@ -1,11 +1,13 @@ from common import * + import storage import storage.device -from apps.common import mnemonic -from apps.webauthn.credential import Fido2Credential, U2fCredential, _NAME_MAX_LENGTH -from apps.webauthn.fido2 import _distinguishable_cred_list from trezor.crypto.hashlib import sha256 +from apps.common import mnemonic +from apps.webauthn.credential import _NAME_MAX_LENGTH, Fido2Credential, U2fCredential +from apps.webauthn.fido2 import _distinguishable_cred_list + class TestCredential(unittest.TestCase): def test_fido2_credential_decode(self): diff --git a/core/tests/test_apps.zcash.zip244.py b/core/tests/test_apps.zcash.zip244.py index d443cc9245..21053d593e 100644 --- a/core/tests/test_apps.zcash.zip244.py +++ b/core/tests/test_apps.zcash.zip244.py @@ -1,7 +1,9 @@ from common import * -from trezor.messages import TxInput, SignTx, PrevOutput + from trezor.enums import InputScriptType +from trezor.messages import PrevOutput, SignTx, TxInput from trezor.utils import HashWriter + from apps.zcash.hasher import ZcashHasher, blake2b, write_hash from apps.common.coininfo import by_name diff --git a/core/tests/test_storage.cache.py b/core/tests/test_storage.cache.py index e7e963e5e0..e3e030e034 100644 --- a/core/tests/test_storage.cache.py +++ b/core/tests/test_storage.cache.py @@ -1,11 +1,10 @@ from common import * -from mock_storage import mock_storage from storage import cache -from trezor.messages import Initialize -from trezor.messages import EndSession +from trezor.messages import EndSession, Initialize -from apps.base import handle_Initialize, handle_EndSession +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 ee76e0a572..f18a753168 100644 --- a/core/tests/test_storage.py +++ b/core/tests/test_storage.py @@ -1,6 +1,7 @@ from common import * -from trezor import config + from storage import device +from trezor import config class TestConfig(unittest.TestCase): diff --git a/core/tests/test_trezor.config.py b/core/tests/test_trezor.config.py index 201cfcf38c..676d216e5d 100644 --- a/core/tests/test_trezor.config.py +++ b/core/tests/test_trezor.config.py @@ -1,8 +1,8 @@ from common import * +from trezor import config from trezor.crypto import random -from trezor import config PINAPP = 0x00 PINKEY = 0x00 diff --git a/core/tests/test_trezor.crypto.base32.py b/core/tests/test_trezor.crypto.base32.py index 4d62b5ecca..137c972ef4 100644 --- a/core/tests/test_trezor.crypto.base32.py +++ b/core/tests/test_trezor.crypto.base32.py @@ -1,7 +1,9 @@ from common import * + from trezor.crypto import base32 + class TestCryptoBase32(unittest.TestCase): # test vectors from: diff --git a/core/tests/test_trezor.crypto.base58.py b/core/tests/test_trezor.crypto.base58.py index e17c1a90f8..b0087435b8 100644 --- a/core/tests/test_trezor.crypto.base58.py +++ b/core/tests/test_trezor.crypto.base58.py @@ -1,8 +1,7 @@ from common import * -from trezor.crypto.hashlib import ripemd160 - from trezor.crypto import base58 +from trezor.crypto.hashlib import ripemd160 def digestfunc_graphene(x): diff --git a/core/tests/test_trezor.crypto.bech32.py b/core/tests/test_trezor.crypto.bech32.py index 1fd397e457..00d8b1e4cf 100644 --- a/core/tests/test_trezor.crypto.bech32.py +++ b/core/tests/test_trezor.crypto.bech32.py @@ -1,3 +1,5 @@ +from common import * + # Copyright (c) 2017, 2020 Pieter Wuille # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -21,7 +23,6 @@ """Reference tests for segwit adresses""" -from common import * from trezor.crypto import bech32 diff --git a/core/tests/test_trezor.crypto.bip32.py b/core/tests/test_trezor.crypto.bip32.py index 892ee8838d..4f007f07fe 100644 --- a/core/tests/test_trezor.crypto.bip32.py +++ b/core/tests/test_trezor.crypto.bip32.py @@ -2,6 +2,7 @@ from common import * from trezor.crypto import bip32 + SECP256K1_NAME = "secp256k1" HARDENED = 0x80000000 VERSION_PUBLIC = 0x0488B21E diff --git a/core/tests/test_trezor.crypto.cashaddr.py b/core/tests/test_trezor.crypto.cashaddr.py index 560c0a1193..2a9cdd9c6d 100644 --- a/core/tests/test_trezor.crypto.cashaddr.py +++ b/core/tests/test_trezor.crypto.cashaddr.py @@ -1,3 +1,5 @@ +from common import * + # Copyright (c) 2017 Pieter Wuille # Copyright (c) 2018 Pavol Rusnak # @@ -22,7 +24,6 @@ """Reference tests for cashaddr adresses""" -from common import * from trezor.crypto import base58, cashaddr diff --git a/core/tests/test_trezor.crypto.curve.ed25519.py b/core/tests/test_trezor.crypto.curve.ed25519.py index 79fda72b40..72449ef292 100644 --- a/core/tests/test_trezor.crypto.curve.ed25519.py +++ b/core/tests/test_trezor.crypto.curve.ed25519.py @@ -1,7 +1,6 @@ from common import * from trezor.crypto import random - from trezor.crypto.curve import ed25519 diff --git a/core/tests/test_trezor.crypto.slip39.py b/core/tests/test_trezor.crypto.slip39.py index 7eb9365375..3dc0bf09db 100644 --- a/core/tests/test_trezor.crypto.slip39.py +++ b/core/tests/test_trezor.crypto.slip39.py @@ -1,5 +1,7 @@ from common import * -from trezor.crypto import slip39, random + +from trezor.crypto import random, slip39 + from slip39_vectors import vectors diff --git a/core/tests/test_trezor.io.fatfs.py b/core/tests/test_trezor.io.fatfs.py index 63b82db96d..1aa470cdc6 100644 --- a/core/tests/test_trezor.io.fatfs.py +++ b/core/tests/test_trezor.io.fatfs.py @@ -1,6 +1,7 @@ from common import * -from trezorio import sdcard, fatfs +from trezorio import fatfs, sdcard + class TestTrezorIoFatfs(unittest.TestCase): diff --git a/core/tests/test_trezor.io.sdcard.py b/core/tests/test_trezor.io.sdcard.py index 1b59a914d1..229389e8d5 100644 --- a/core/tests/test_trezor.io.sdcard.py +++ b/core/tests/test_trezor.io.sdcard.py @@ -3,6 +3,7 @@ from common import * from trezor import io + class TestTrezorIoSdcard(unittest.TestCase): def test_start(self): self.assertTrue(io.sdcard.is_present()) diff --git a/core/tests/test_trezor.protobuf.py b/core/tests/test_trezor.protobuf.py index f2aad14bc2..c1b756ba33 100644 --- a/core/tests/test_trezor.protobuf.py +++ b/core/tests/test_trezor.protobuf.py @@ -2,10 +2,10 @@ from common import * from trezor import protobuf from trezor.messages import ( - WebAuthnCredential, + DebugLinkMemoryRead, Failure, SignMessage, - DebugLinkMemoryRead, + WebAuthnCredential, ) diff --git a/core/tests/test_trezor.sdcard.py b/core/tests/test_trezor.sdcard.py index ddff4d0b34..3cfcfa8c01 100644 --- a/core/tests/test_trezor.sdcard.py +++ b/core/tests/test_trezor.sdcard.py @@ -2,6 +2,7 @@ from common import * from trezor import io, sdcard + fatfs = io.fatfs diff --git a/core/tests/test_trezor.wire.codec_v1.py b/core/tests/test_trezor.wire.codec_v1.py index 1e2939a4b3..febd9b1d48 100644 --- a/core/tests/test_trezor.wire.codec_v1.py +++ b/core/tests/test_trezor.wire.codec_v1.py @@ -1,6 +1,7 @@ from common import * -from ubinascii import unhexlify + import ustruct +from ubinascii import unhexlify from trezor import io from trezor.loop import wait