aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2024-02-29 12:54:19 -0500
committerGitHub <noreply@github.com>2024-02-29 17:54:19 +0000
commit905983fe56bddce6c2aa18dbe52d78c51e8c5285 (patch)
tree8239cc266d89dfe9883816d5f3f9bd78bc20a190 /tests
parent992188efe4b14b6375c7d1c904b9fea04c554317 (diff)
downloadpyca-cryptography-905983fe56bddce6c2aa18dbe52d78c51e8c5285.zip
pyca-cryptography-905983fe56bddce6c2aa18dbe52d78c51e8c5285.tar.gz
pyca-cryptography-905983fe56bddce6c2aa18dbe52d78c51e8c5285.tar.bz2
Upgraded version of ruff (#10509)
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/decrepit/test_3des.py1
-rw-r--r--tests/hazmat/primitives/decrepit/test_rc2.py1
-rw-r--r--tests/hazmat/primitives/test_hashes.py2
-rw-r--r--tests/hazmat/primitives/test_hmac.py2
-rw-r--r--tests/hazmat/primitives/test_padding.py4
-rw-r--r--tests/hazmat/primitives/test_pkcs7.py6
-rw-r--r--tests/hazmat/primitives/test_ssh.py2
-rw-r--r--tests/test_fernet.py2
-rw-r--r--tests/x509/test_x509.py2
-rw-r--r--tests/x509/test_x509_ext.py10
10 files changed, 15 insertions, 17 deletions
diff --git a/tests/hazmat/primitives/decrepit/test_3des.py b/tests/hazmat/primitives/decrepit/test_3des.py
index f64cbd2..2b7a104 100644
--- a/tests/hazmat/primitives/decrepit/test_3des.py
+++ b/tests/hazmat/primitives/decrepit/test_3des.py
@@ -6,7 +6,6 @@
Test using the NIST Test Vectors
"""
-
import binascii
import os
diff --git a/tests/hazmat/primitives/decrepit/test_rc2.py b/tests/hazmat/primitives/decrepit/test_rc2.py
index ecd4ce2..dd2ce5d 100644
--- a/tests/hazmat/primitives/decrepit/test_rc2.py
+++ b/tests/hazmat/primitives/decrepit/test_rc2.py
@@ -6,7 +6,6 @@
Test using the NIST Test Vectors
"""
-
import binascii
import os
diff --git a/tests/hazmat/primitives/test_hashes.py b/tests/hazmat/primitives/test_hashes.py
index 1d09677..092ba9a 100644
--- a/tests/hazmat/primitives/test_hashes.py
+++ b/tests/hazmat/primitives/test_hashes.py
@@ -19,7 +19,7 @@ class TestHashContext:
def test_hash_reject_unicode(self, backend):
m = hashes.Hash(hashes.SHA1(), backend=backend)
with pytest.raises(TypeError):
- m.update("\u00FC") # type: ignore[arg-type]
+ m.update("\u00fc") # type: ignore[arg-type]
def test_hash_algorithm_instance(self, backend):
with pytest.raises(TypeError):
diff --git a/tests/hazmat/primitives/test_hmac.py b/tests/hazmat/primitives/test_hmac.py
index 04c3e85..52d3e8e 100644
--- a/tests/hazmat/primitives/test_hmac.py
+++ b/tests/hazmat/primitives/test_hmac.py
@@ -33,7 +33,7 @@ class TestHMAC:
def test_hmac_reject_unicode(self, backend):
h = hmac.HMAC(b"mykey", hashes.SHA1(), backend=backend)
with pytest.raises(TypeError):
- h.update("\u00FC") # type: ignore[arg-type]
+ h.update("\u00fc") # type: ignore[arg-type]
def test_hmac_algorithm_instance(self, backend):
with pytest.raises(TypeError):
diff --git a/tests/hazmat/primitives/test_padding.py b/tests/hazmat/primitives/test_padding.py
index 1a9a01f..2e20363 100644
--- a/tests/hazmat/primitives/test_padding.py
+++ b/tests/hazmat/primitives/test_padding.py
@@ -62,7 +62,7 @@ class TestPKCS7:
b"111111111111111122222222222222\x02\x02",
),
(128, b"1" * 16, b"1" * 16 + b"\x10" * 16),
- (128, b"1" * 17, b"1" * 17 + b"\x0F" * 15),
+ (128, b"1" * 17, b"1" * 17 + b"\x0f" * 15),
],
)
def test_pad(self, size, unpadded, padded):
@@ -185,7 +185,7 @@ class TestANSIX923:
b"111111111111111122222222222222\x00\x02",
),
(128, b"1" * 16, b"1" * 16 + b"\x00" * 15 + b"\x10"),
- (128, b"1" * 17, b"1" * 17 + b"\x00" * 14 + b"\x0F"),
+ (128, b"1" * 17, b"1" * 17 + b"\x00" * 14 + b"\x0f"),
],
)
def test_pad(self, size, unpadded, padded):
diff --git a/tests/hazmat/primitives/test_pkcs7.py b/tests/hazmat/primitives/test_pkcs7.py
index a929a9e..9a9eab3 100644
--- a/tests/hazmat/primitives/test_pkcs7.py
+++ b/tests/hazmat/primitives/test_pkcs7.py
@@ -91,7 +91,7 @@ class TestPKCS7Loading:
)
def test_load_pkcs7_empty_certificates(self):
- der = b"\x30\x0B\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02"
+ der = b"\x30\x0b\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x07\x02"
with pytest.raises(ValueError):
pkcs7.load_der_pkcs7_certificates(der)
@@ -573,7 +573,7 @@ class TestPKCS7Builder:
assert b"\x06\t*\x86H\x86\xf7\r\x01\t\x0f" in sig_binary
# 2.16.840.1.101.3.4.1.42 (aes256-CBC-PAD) as an ASN.1 DER encoded OID
- aes256_cbc_pad_oid = b"\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x2A"
+ aes256_cbc_pad_oid = b"\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x2a"
# 2.16.840.1.101.3.4.1.22 (aes192-CBC-PAD) as an ASN.1 DER encoded OID
aes192_cbc_pad_oid = b"\x06\x09\x60\x86\x48\x01\x65\x03\x04\x01\x16"
# 2.16.840.1.101.3.4.1.2 (aes128-CBC-PAD) as an ASN.1 DER encoded OID
@@ -730,7 +730,7 @@ class TestPKCS7Builder:
# another in the SignerInfo data structure in the
# `digest_encryption_algorithm` field.
assert (
- sig.count(b"\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01\x01") == 2
+ sig.count(b"\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01") == 2
)
_pkcs7_verify(
serialization.Encoding.DER,
diff --git a/tests/hazmat/primitives/test_ssh.py b/tests/hazmat/primitives/test_ssh.py
index d337256..cda2aad 100644
--- a/tests/hazmat/primitives/test_ssh.py
+++ b/tests/hazmat/primitives/test_ssh.py
@@ -390,7 +390,7 @@ class TestOpenSSHSerialization:
b"\x04" * 65,
),
priv_type=None,
- priv_fields=(b"nistp256", b"\x04" * 65, b"\x7F" * 32),
+ priv_fields=(b"nistp256", b"\x04" * 65, b"\x7f" * 32),
comment=b"comment",
checkval1=b"1234",
checkval2=b"1234",
diff --git a/tests/test_fernet.py b/tests/test_fernet.py
index ef4ef70..7ebab3e 100644
--- a/tests/test_fernet.py
+++ b/tests/test_fernet.py
@@ -138,7 +138,7 @@ class TestFernet:
current_time=int(time.time()),
)
- @pytest.mark.parametrize("message", [b"", b"Abc!", b"\x00\xFF\x00\x80"])
+ @pytest.mark.parametrize("message", [b"", b"Abc!", b"\x00\xff\x00\x80"])
def test_roundtrips(self, message, backend):
f = Fernet(Fernet.generate_key(), backend=backend)
assert f.decrypt(f.encrypt(message)) == message
diff --git a/tests/x509/test_x509.py b/tests/x509/test_x509.py
index 1a6fc7b..e5e941e 100644
--- a/tests/x509/test_x509.py
+++ b/tests/x509/test_x509.py
@@ -5732,7 +5732,7 @@ class TestNameAttribute:
# unicode string of length 2, but > 2 bytes
with pytest.raises(ValueError):
- x509.NameAttribute(NameOID.COUNTRY_NAME, "\U0001F37A\U0001F37A")
+ x509.NameAttribute(NameOID.COUNTRY_NAME, "\U0001f37a\U0001f37a")
def test_invalid_type(self):
with pytest.raises(TypeError):
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py
index fc3e3e0..491271a 100644
--- a/tests/x509/test_x509_ext.py
+++ b/tests/x509/test_x509_ext.py
@@ -5994,11 +5994,11 @@ class TestPrecertificateSignedCertificateTimestampsExtension:
== x509.certificate_transparency.SignatureAlgorithm.ECDSA
)
assert sct.signature == (
- b"\x30\x45\x02\x21\x00\xB8\x03\xAD\x34\xF6\xFC\x0F\x2C\xFF\x84\xA0"
- b"\x86\xE5\xD7\xCF\x5A\xF0\x0A\x07\x62\x6A\x7F\xB3\xA6\x44\x64\xF1"
- b"\x95\xA4\x48\x45\x11\x02\x20\x2F\x61\x8D\x53\x1B\x6F\x4A\xB8\x0A"
- b"\x67\xB2\x07\xE1\x8F\x6D\xAD\xD1\x04\x4A\x5E\xB3\x89\xEF\x7C\x60"
- b"\xC2\x68\x53\xF9\x3D\x1F\x6D"
+ b"\x30\x45\x02\x21\x00\xb8\x03\xad\x34\xf6\xfc\x0f\x2c\xff\x84\xa0"
+ b"\x86\xe5\xd7\xcf\x5a\xf0\x0a\x07\x62\x6a\x7f\xb3\xa6\x44\x64\xf1"
+ b"\x95\xa4\x48\x45\x11\x02\x20\x2f\x61\x8d\x53\x1b\x6f\x4a\xb8\x0a"
+ b"\x67\xb2\x07\xe1\x8f\x6d\xad\xd1\x04\x4a\x5e\xb3\x89\xef\x7c\x60"
+ b"\xc2\x68\x53\xf9\x3d\x1f\x6d"
)
assert sct.extension_bytes == b""