summaryrefslogtreecommitdiff
path: root/tests/hazmat/primitives
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2022-12-20 21:44:47 -0500
committerGitHub <noreply@github.com>2022-12-21 09:44:47 +0700
commit7ff729ecf2ffeffc8442811a7ad5c8a9ab24351c (patch)
treed76a1971dcfa7ccf567bae9032799c475a955207 /tests/hazmat/primitives
parent4868142f4193c441b4995f54c70caad7b06dc093 (diff)
downloadcryptography-7ff729ecf2ffeffc8442811a7ad5c8a9ab24351c.tar.gz
Switch from flake8 to ruff (#7920)
It's more than 60x faster.
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r--tests/hazmat/primitives/fixtures_dsa.py1
-rw-r--r--tests/hazmat/primitives/fixtures_ec.py1
-rw-r--r--tests/hazmat/primitives/fixtures_rsa.py1
-rw-r--r--tests/hazmat/primitives/test_3des.py2
-rw-r--r--tests/hazmat/primitives/test_aead.py2
-rw-r--r--tests/hazmat/primitives/test_aes.py2
-rw-r--r--tests/hazmat/primitives/test_aes_gcm.py2
-rw-r--r--tests/hazmat/primitives/test_arc4.py2
-rw-r--r--tests/hazmat/primitives/test_block.py4
-rw-r--r--tests/hazmat/primitives/test_blowfish.py2
-rw-r--r--tests/hazmat/primitives/test_camellia.py2
-rw-r--r--tests/hazmat/primitives/test_cast5.py2
-rw-r--r--tests/hazmat/primitives/test_chacha20.py2
-rw-r--r--tests/hazmat/primitives/test_cmac.py11
-rw-r--r--tests/hazmat/primitives/test_concatkdf.py6
-rw-r--r--tests/hazmat/primitives/test_dh.py2
-rw-r--r--tests/hazmat/primitives/test_dsa.py4
-rw-r--r--tests/hazmat/primitives/test_ec.py4
-rw-r--r--tests/hazmat/primitives/test_hash_vectors.py2
-rw-r--r--tests/hazmat/primitives/test_hashes.py2
-rw-r--r--tests/hazmat/primitives/test_hkdf.py5
-rw-r--r--tests/hazmat/primitives/test_hkdf_vectors.py2
-rw-r--r--tests/hazmat/primitives/test_hmac.py2
-rw-r--r--tests/hazmat/primitives/test_hmac_vectors.py2
-rw-r--r--tests/hazmat/primitives/test_idea.py2
-rw-r--r--tests/hazmat/primitives/test_kbkdf.py2
-rw-r--r--tests/hazmat/primitives/test_kbkdf_vectors.py2
-rw-r--r--tests/hazmat/primitives/test_keywrap.py2
-rw-r--r--tests/hazmat/primitives/test_pbkdf2hmac_vectors.py2
-rw-r--r--tests/hazmat/primitives/test_rsa.py31
-rw-r--r--tests/hazmat/primitives/test_scrypt.py8
-rw-r--r--tests/hazmat/primitives/test_seed.py2
-rw-r--r--tests/hazmat/primitives/test_serialization.py10
-rw-r--r--tests/hazmat/primitives/test_sm4.py2
-rw-r--r--tests/hazmat/primitives/twofactor/test_hotp.py5
-rw-r--r--tests/hazmat/primitives/twofactor/test_totp.py5
-rw-r--r--tests/hazmat/primitives/utils.py2
37 files changed, 57 insertions, 85 deletions
diff --git a/tests/hazmat/primitives/fixtures_dsa.py b/tests/hazmat/primitives/fixtures_dsa.py
index eca0ec431..6675a2c10 100644
--- a/tests/hazmat/primitives/fixtures_dsa.py
+++ b/tests/hazmat/primitives/fixtures_dsa.py
@@ -9,7 +9,6 @@ from cryptography.hazmat.primitives.asymmetric.dsa import (
DSAPublicNumbers,
)
-
DSA_KEY_1024 = DSAPrivateNumbers(
public_numbers=DSAPublicNumbers(
parameter_numbers=DSAParameterNumbers(
diff --git a/tests/hazmat/primitives/fixtures_ec.py b/tests/hazmat/primitives/fixtures_ec.py
index 317c2ab24..fa671ac55 100644
--- a/tests/hazmat/primitives/fixtures_ec.py
+++ b/tests/hazmat/primitives/fixtures_ec.py
@@ -5,7 +5,6 @@
from cryptography.hazmat.primitives.asymmetric import ec
-
EC_KEY_SECT571R1 = ec.EllipticCurvePrivateNumbers(
private_value=int(
"213997069697108634621868251335076179190383272087548888968788698953"
diff --git a/tests/hazmat/primitives/fixtures_rsa.py b/tests/hazmat/primitives/fixtures_rsa.py
index f6b5c3b9f..09b32ab00 100644
--- a/tests/hazmat/primitives/fixtures_rsa.py
+++ b/tests/hazmat/primitives/fixtures_rsa.py
@@ -8,7 +8,6 @@ from cryptography.hazmat.primitives.asymmetric.rsa import (
RSAPublicNumbers,
)
-
RSA_KEY_512 = RSAPrivateNumbers(
p=int(
"d57846898d5c0de249c08467586cb458fa9bc417cdf297f73cfc52281b787cd9", 16
diff --git a/tests/hazmat/primitives/test_3des.py b/tests/hazmat/primitives/test_3des.py
index ea39a2102..007ecfe21 100644
--- a/tests/hazmat/primitives/test_3des.py
+++ b/tests/hazmat/primitives/test_3des.py
@@ -14,8 +14,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import generate_encrypt_test
from ...utils import load_nist_vectors
+from .utils import generate_encrypt_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_aead.py b/tests/hazmat/primitives/test_aead.py
index b7a4aedf3..98ebae866 100644
--- a/tests/hazmat/primitives/test_aead.py
+++ b/tests/hazmat/primitives/test_aead.py
@@ -17,13 +17,13 @@ from cryptography.hazmat.primitives.ciphers.aead import (
ChaCha20Poly1305,
)
-from .utils import _load_all_params
from ...utils import (
load_nist_ccm_vectors,
load_nist_vectors,
load_vectors_from_file,
raises_unsupported_algorithm,
)
+from .utils import _load_all_params
class FakeData(bytes):
diff --git a/tests/hazmat/primitives/test_aes.py b/tests/hazmat/primitives/test_aes.py
index 9d68ef202..5798aefc6 100644
--- a/tests/hazmat/primitives/test_aes.py
+++ b/tests/hazmat/primitives/test_aes.py
@@ -10,9 +10,9 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, base, modes
-from .utils import _load_all_params, generate_encrypt_test
from ...doubles import DummyMode
from ...utils import load_nist_vectors
+from .utils import _load_all_params, generate_encrypt_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_aes_gcm.py b/tests/hazmat/primitives/test_aes_gcm.py
index 9220e9e09..c1154a962 100644
--- a/tests/hazmat/primitives/test_aes_gcm.py
+++ b/tests/hazmat/primitives/test_aes_gcm.py
@@ -10,8 +10,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, base, modes
-from .utils import generate_aead_test
from ...utils import load_nist_vectors
+from .utils import generate_aead_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_arc4.py b/tests/hazmat/primitives/test_arc4.py
index 5bc23f92e..b589518ad 100644
--- a/tests/hazmat/primitives/test_arc4.py
+++ b/tests/hazmat/primitives/test_arc4.py
@@ -10,8 +10,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms
-from .utils import generate_stream_encryption_test
from ...utils import load_nist_vectors
+from .utils import generate_stream_encryption_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py
index fa2c4f52a..b831de176 100644
--- a/tests/hazmat/primitives/test_block.py
+++ b/tests/hazmat/primitives/test_block.py
@@ -15,12 +15,12 @@ from cryptography.hazmat.primitives.ciphers import (
modes,
)
+from ...doubles import DummyCipherAlgorithm, DummyMode
+from ...utils import raises_unsupported_algorithm
from .utils import (
generate_aead_exception_test,
generate_aead_tag_exception_test,
)
-from ...doubles import DummyCipherAlgorithm, DummyMode
-from ...utils import raises_unsupported_algorithm
class TestCipher:
diff --git a/tests/hazmat/primitives/test_blowfish.py b/tests/hazmat/primitives/test_blowfish.py
index 4ff8c1f2c..b8f34dfce 100644
--- a/tests/hazmat/primitives/test_blowfish.py
+++ b/tests/hazmat/primitives/test_blowfish.py
@@ -10,8 +10,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import generate_encrypt_test
from ...utils import load_nist_vectors
+from .utils import generate_encrypt_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_camellia.py b/tests/hazmat/primitives/test_camellia.py
index 8ec75510b..d6f1fca86 100644
--- a/tests/hazmat/primitives/test_camellia.py
+++ b/tests/hazmat/primitives/test_camellia.py
@@ -10,8 +10,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import generate_encrypt_test
from ...utils import load_cryptrec_vectors, load_nist_vectors
+from .utils import generate_encrypt_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_cast5.py b/tests/hazmat/primitives/test_cast5.py
index 6c6f0c884..a6f186a3c 100644
--- a/tests/hazmat/primitives/test_cast5.py
+++ b/tests/hazmat/primitives/test_cast5.py
@@ -10,8 +10,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import generate_encrypt_test
from ...utils import load_nist_vectors
+from .utils import generate_encrypt_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_chacha20.py b/tests/hazmat/primitives/test_chacha20.py
index 4dd1b08cd..5337465b9 100644
--- a/tests/hazmat/primitives/test_chacha20.py
+++ b/tests/hazmat/primitives/test_chacha20.py
@@ -11,8 +11,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms
-from .utils import _load_all_params
from ...utils import load_nist_vectors
+from .utils import _load_all_params
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_cmac.py b/tests/hazmat/primitives/test_cmac.py
index 9596705b1..c9e7fdd88 100644
--- a/tests/hazmat/primitives/test_cmac.py
+++ b/tests/hazmat/primitives/test_cmac.py
@@ -7,10 +7,7 @@ import binascii
import pytest
-from cryptography.exceptions import (
- AlreadyFinalized,
- InvalidSignature,
-)
+from cryptography.exceptions import AlreadyFinalized, InvalidSignature
from cryptography.hazmat.primitives.ciphers.algorithms import (
AES,
ARC4,
@@ -18,11 +15,7 @@ from cryptography.hazmat.primitives.ciphers.algorithms import (
)
from cryptography.hazmat.primitives.cmac import CMAC
-from ...utils import (
- load_nist_vectors,
- load_vectors_from_file,
-)
-
+from ...utils import load_nist_vectors, load_vectors_from_file
vectors_aes128 = load_vectors_from_file(
"CMAC/nist-800-38b-aes128.txt", load_nist_vectors
diff --git a/tests/hazmat/primitives/test_concatkdf.py b/tests/hazmat/primitives/test_concatkdf.py
index bd0117ce1..f0dd18828 100644
--- a/tests/hazmat/primitives/test_concatkdf.py
+++ b/tests/hazmat/primitives/test_concatkdf.py
@@ -9,8 +9,10 @@ import pytest
from cryptography.exceptions import AlreadyFinalized, InvalidKey
from cryptography.hazmat.primitives import hashes
-from cryptography.hazmat.primitives.kdf.concatkdf import ConcatKDFHMAC
-from cryptography.hazmat.primitives.kdf.concatkdf import ConcatKDFHash
+from cryptography.hazmat.primitives.kdf.concatkdf import (
+ ConcatKDFHash,
+ ConcatKDFHMAC,
+)
class TestConcatKDFHash:
diff --git a/tests/hazmat/primitives/test_dh.py b/tests/hazmat/primitives/test_dh.py
index 6e708676b..9a28d6114 100644
--- a/tests/hazmat/primitives/test_dh.py
+++ b/tests/hazmat/primitives/test_dh.py
@@ -13,9 +13,9 @@ import pytest
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import dh
-from .fixtures_dh import FFDH3072_P
from ...doubles import DummyKeySerializationEncryption
from ...utils import load_nist_vectors, load_vectors_from_file
+from .fixtures_dh import FFDH3072_P
# RFC 3526
P_1536 = int(
diff --git a/tests/hazmat/primitives/test_dsa.py b/tests/hazmat/primitives/test_dsa.py
index 424ffcee5..4ad4e9317 100644
--- a/tests/hazmat/primitives/test_dsa.py
+++ b/tests/hazmat/primitives/test_dsa.py
@@ -17,14 +17,14 @@ from cryptography.hazmat.primitives.asymmetric.utils import (
encode_dss_signature,
)
-from .fixtures_dsa import DSA_KEY_1024, DSA_KEY_2048, DSA_KEY_3072
-from .utils import skip_fips_traditional_openssl
from ...doubles import DummyHashAlgorithm, DummyKeySerializationEncryption
from ...utils import (
load_fips_dsa_key_pair_vectors,
load_fips_dsa_sig_vectors,
load_vectors_from_file,
)
+from .fixtures_dsa import DSA_KEY_1024, DSA_KEY_2048, DSA_KEY_3072
+from .utils import skip_fips_traditional_openssl
_ALGORITHMS_DICT: typing.Dict[str, hashes.HashAlgorithm] = {
"SHA1": hashes.SHA1(),
diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py
index 3d488be17..142024459 100644
--- a/tests/hazmat/primitives/test_ec.py
+++ b/tests/hazmat/primitives/test_ec.py
@@ -20,8 +20,6 @@ from cryptography.hazmat.primitives.asymmetric.utils import (
encode_dss_signature,
)
-from .fixtures_ec import EC_KEY_SECP384R1
-from .utils import skip_fips_traditional_openssl
from ...doubles import DummyKeySerializationEncryption
from ...utils import (
load_fips_ecdsa_key_pair_vectors,
@@ -31,6 +29,8 @@ from ...utils import (
load_vectors_from_file,
raises_unsupported_algorithm,
)
+from .fixtures_ec import EC_KEY_SECP384R1
+from .utils import skip_fips_traditional_openssl
_HASH_TYPES: typing.Dict[str, typing.Type[hashes.HashAlgorithm]] = {
"SHA-1": hashes.SHA1,
diff --git a/tests/hazmat/primitives/test_hash_vectors.py b/tests/hazmat/primitives/test_hash_vectors.py
index d5916f061..bde811186 100644
--- a/tests/hazmat/primitives/test_hash_vectors.py
+++ b/tests/hazmat/primitives/test_hash_vectors.py
@@ -10,8 +10,8 @@ import pytest
from cryptography.hazmat.primitives import hashes
-from .utils import _load_all_params, generate_hash_test
from ...utils import load_hash_vectors, load_nist_vectors
+from .utils import _load_all_params, generate_hash_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_hashes.py b/tests/hazmat/primitives/test_hashes.py
index 37744e745..1d096772a 100644
--- a/tests/hazmat/primitives/test_hashes.py
+++ b/tests/hazmat/primitives/test_hashes.py
@@ -10,9 +10,9 @@ import pytest
from cryptography.exceptions import AlreadyFinalized, _Reasons
from cryptography.hazmat.primitives import hashes
-from .utils import generate_base_hash_test
from ...doubles import DummyHashAlgorithm
from ...utils import raises_unsupported_algorithm
+from .utils import generate_base_hash_test
class TestHashContext:
diff --git a/tests/hazmat/primitives/test_hkdf.py b/tests/hazmat/primitives/test_hkdf.py
index cc001baf5..0bd5c97c4 100644
--- a/tests/hazmat/primitives/test_hkdf.py
+++ b/tests/hazmat/primitives/test_hkdf.py
@@ -12,10 +12,7 @@ from cryptography.exceptions import AlreadyFinalized, InvalidKey
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.hkdf import HKDF, HKDFExpand
-from ...utils import (
- load_nist_vectors,
- load_vectors_from_file,
-)
+from ...utils import load_nist_vectors, load_vectors_from_file
class TestHKDF:
diff --git a/tests/hazmat/primitives/test_hkdf_vectors.py b/tests/hazmat/primitives/test_hkdf_vectors.py
index 711d1b5ec..080aa1b5b 100644
--- a/tests/hazmat/primitives/test_hkdf_vectors.py
+++ b/tests/hazmat/primitives/test_hkdf_vectors.py
@@ -9,8 +9,8 @@ import pytest
from cryptography.hazmat.primitives import hashes
-from .utils import generate_hkdf_test
from ...utils import load_nist_vectors
+from .utils import generate_hkdf_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_hmac.py b/tests/hazmat/primitives/test_hmac.py
index 414385c5d..818ff2a7d 100644
--- a/tests/hazmat/primitives/test_hmac.py
+++ b/tests/hazmat/primitives/test_hmac.py
@@ -14,9 +14,9 @@ from cryptography.exceptions import (
)
from cryptography.hazmat.primitives import hashes, hmac
-from .utils import generate_base_hmac_test
from ...doubles import DummyHashAlgorithm
from ...utils import raises_unsupported_algorithm
+from .utils import generate_base_hmac_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_hmac_vectors.py b/tests/hazmat/primitives/test_hmac_vectors.py
index 703065a55..790993a34 100644
--- a/tests/hazmat/primitives/test_hmac_vectors.py
+++ b/tests/hazmat/primitives/test_hmac_vectors.py
@@ -9,8 +9,8 @@ import pytest
from cryptography.hazmat.primitives import hashes, hmac
-from .utils import generate_hmac_test
from ...utils import load_hash_vectors
+from .utils import generate_hmac_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_idea.py b/tests/hazmat/primitives/test_idea.py
index d591fe4e7..9817d5444 100644
--- a/tests/hazmat/primitives/test_idea.py
+++ b/tests/hazmat/primitives/test_idea.py
@@ -10,8 +10,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import generate_encrypt_test
from ...utils import load_nist_vectors
+from .utils import generate_encrypt_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_kbkdf.py b/tests/hazmat/primitives/test_kbkdf.py
index bb8ebea0d..4329e3df6 100644
--- a/tests/hazmat/primitives/test_kbkdf.py
+++ b/tests/hazmat/primitives/test_kbkdf.py
@@ -11,9 +11,9 @@ from cryptography.exceptions import AlreadyFinalized, InvalidKey, _Reasons
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers import algorithms
from cryptography.hazmat.primitives.kdf.kbkdf import (
- CounterLocation,
KBKDFCMAC,
KBKDFHMAC,
+ CounterLocation,
Mode,
)
diff --git a/tests/hazmat/primitives/test_kbkdf_vectors.py b/tests/hazmat/primitives/test_kbkdf_vectors.py
index fef75fe21..cab817bf4 100644
--- a/tests/hazmat/primitives/test_kbkdf_vectors.py
+++ b/tests/hazmat/primitives/test_kbkdf_vectors.py
@@ -5,8 +5,8 @@
import os
-from .utils import generate_kbkdf_counter_mode_test
from ...utils import load_nist_kbkdf_vectors
+from .utils import generate_kbkdf_counter_mode_test
class TestCounterKDFCounterMode:
diff --git a/tests/hazmat/primitives/test_keywrap.py b/tests/hazmat/primitives/test_keywrap.py
index b2fa05d74..7dfb80901 100644
--- a/tests/hazmat/primitives/test_keywrap.py
+++ b/tests/hazmat/primitives/test_keywrap.py
@@ -11,8 +11,8 @@ import pytest
from cryptography.hazmat.primitives import keywrap
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import _load_all_params
from ...utils import load_nist_vectors
+from .utils import _load_all_params
class TestAESKeyWrap:
diff --git a/tests/hazmat/primitives/test_pbkdf2hmac_vectors.py b/tests/hazmat/primitives/test_pbkdf2hmac_vectors.py
index f092894f5..60d2f864d 100644
--- a/tests/hazmat/primitives/test_pbkdf2hmac_vectors.py
+++ b/tests/hazmat/primitives/test_pbkdf2hmac_vectors.py
@@ -7,8 +7,8 @@ import pytest
from cryptography.hazmat.primitives import hashes
-from .utils import generate_pbkdf2_test
from ...utils import load_nist_vectors
+from .utils import generate_pbkdf2_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py
index 7a4b2f1e3..919331caf 100644
--- a/tests/hazmat/primitives/test_rsa.py
+++ b/tests/hazmat/primitives/test_rsa.py
@@ -15,16 +15,25 @@ from cryptography.exceptions import (
_Reasons,
)
from cryptography.hazmat.primitives import hashes, serialization
-from cryptography.hazmat.primitives.asymmetric import (
- padding,
- rsa,
- utils as asym_utils,
-)
+from cryptography.hazmat.primitives.asymmetric import padding, rsa
+from cryptography.hazmat.primitives.asymmetric import utils as asym_utils
from cryptography.hazmat.primitives.asymmetric.rsa import (
RSAPrivateNumbers,
RSAPublicNumbers,
)
+from ...doubles import (
+ DummyAsymmetricPadding,
+ DummyHashAlgorithm,
+ DummyKeySerializationEncryption,
+)
+from ...utils import (
+ load_nist_vectors,
+ load_pkcs1_vectors,
+ load_rsa_nist_vectors,
+ load_vectors_from_file,
+ raises_unsupported_algorithm,
+)
from .fixtures_rsa import (
RSA_KEY_1024,
RSA_KEY_1025,
@@ -48,18 +57,6 @@ from .utils import (
generate_rsa_verification_test,
skip_fips_traditional_openssl,
)
-from ...doubles import (
- DummyAsymmetricPadding,
- DummyHashAlgorithm,
- DummyKeySerializationEncryption,
-)
-from ...utils import (
- load_nist_vectors,
- load_pkcs1_vectors,
- load_rsa_nist_vectors,
- load_vectors_from_file,
- raises_unsupported_algorithm,
-)
class DummyMGF(padding.MGF):
diff --git a/tests/hazmat/primitives/test_scrypt.py b/tests/hazmat/primitives/test_scrypt.py
index 6e95a1f26..4b4641854 100644
--- a/tests/hazmat/primitives/test_scrypt.py
+++ b/tests/hazmat/primitives/test_scrypt.py
@@ -8,12 +8,8 @@ import os
import pytest
-from cryptography.exceptions import (
- AlreadyFinalized,
- InvalidKey,
-)
-from cryptography.hazmat.primitives.kdf.scrypt import Scrypt, _MEM_LIMIT
-
+from cryptography.exceptions import AlreadyFinalized, InvalidKey
+from cryptography.hazmat.primitives.kdf.scrypt import _MEM_LIMIT, Scrypt
from tests.utils import (
load_nist_vectors,
load_vectors_from_file,
diff --git a/tests/hazmat/primitives/test_seed.py b/tests/hazmat/primitives/test_seed.py
index eb0b88c2a..9f68bc3fb 100644
--- a/tests/hazmat/primitives/test_seed.py
+++ b/tests/hazmat/primitives/test_seed.py
@@ -10,8 +10,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import generate_encrypt_test
from ...utils import load_nist_vectors
+from .utils import generate_encrypt_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py
index 3a08d5570..3f1a55c23 100644
--- a/tests/hazmat/primitives/test_serialization.py
+++ b/tests/hazmat/primitives/test_serialization.py
@@ -39,15 +39,11 @@ from cryptography.hazmat.primitives.serialization import (
)
from cryptography.hazmat.primitives.serialization.pkcs12 import PBES
-
-from .fixtures_rsa import RSA_KEY_2048
-from .test_ec import _skip_curve_unsupported
-from .utils import (
- _check_dsa_private_numbers,
- _check_rsa_private_numbers,
-)
from ...doubles import DummyKeySerializationEncryption
from ...utils import load_vectors_from_file, raises_unsupported_algorithm
+from .fixtures_rsa import RSA_KEY_2048
+from .test_ec import _skip_curve_unsupported
+from .utils import _check_dsa_private_numbers, _check_rsa_private_numbers
def _skip_fips_format(key_path, password, backend):
diff --git a/tests/hazmat/primitives/test_sm4.py b/tests/hazmat/primitives/test_sm4.py
index 07b0cc7f7..13d9b5051 100644
--- a/tests/hazmat/primitives/test_sm4.py
+++ b/tests/hazmat/primitives/test_sm4.py
@@ -9,8 +9,8 @@ import pytest
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import generate_encrypt_test
from ...utils import load_nist_vectors
+from .utils import generate_encrypt_test
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py
index d1c6cb530..31e01a495 100644
--- a/tests/hazmat/primitives/twofactor/test_hotp.py
+++ b/tests/hazmat/primitives/twofactor/test_hotp.py
@@ -12,10 +12,7 @@ from cryptography.hazmat.primitives.hashes import MD5, SHA1
from cryptography.hazmat.primitives.twofactor import InvalidToken
from cryptography.hazmat.primitives.twofactor.hotp import HOTP
-from ....utils import (
- load_nist_vectors,
- load_vectors_from_file,
-)
+from ....utils import load_nist_vectors, load_vectors_from_file
vectors = load_vectors_from_file("twofactor/rfc-4226.txt", load_nist_vectors)
diff --git a/tests/hazmat/primitives/twofactor/test_totp.py b/tests/hazmat/primitives/twofactor/test_totp.py
index 3c8d6b372..f68a8339c 100644
--- a/tests/hazmat/primitives/twofactor/test_totp.py
+++ b/tests/hazmat/primitives/twofactor/test_totp.py
@@ -9,10 +9,7 @@ from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.twofactor import InvalidToken
from cryptography.hazmat.primitives.twofactor.totp import TOTP
-from ....utils import (
- load_nist_vectors,
- load_vectors_from_file,
-)
+from ....utils import load_nist_vectors, load_vectors_from_file
vectors = load_vectors_from_file("twofactor/rfc-6238.txt", load_nist_vectors)
diff --git a/tests/hazmat/primitives/utils.py b/tests/hazmat/primitives/utils.py
index c8021cc2f..aac7296e6 100644
--- a/tests/hazmat/primitives/utils.py
+++ b/tests/hazmat/primitives/utils.py
@@ -26,9 +26,9 @@ from cryptography.hazmat.primitives.ciphers import (
from cryptography.hazmat.primitives.ciphers.modes import GCM
from cryptography.hazmat.primitives.kdf.hkdf import HKDF, HKDFExpand
from cryptography.hazmat.primitives.kdf.kbkdf import (
- CounterLocation,
KBKDFCMAC,
KBKDFHMAC,
+ CounterLocation,
Mode,
)
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC