Skip to content

Commit b3cd2a6

Browse files
Copilotmoreal
andcommitted
Mark expected failures in test_hmac (27 TODOs)
Co-authored-by: moreal <26626194+moreal@users.noreply.github.com>
1 parent ca0f07d commit b3cd2a6

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

Lib/test/test_hmac.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,46 @@ class OpenSSLRFCTestCase(OpenSSLAssertersMixin,
804804
The underlying hash functions are also OpenSSL-based.
805805
"""
806806

807+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
808+
def test_md5_rfc2202(self):
809+
return super().test_md5_rfc2202()
810+
811+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
812+
def test_sha1_rfc2202(self):
813+
return super().test_sha1_rfc2202()
814+
815+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
816+
def test_sha2_224_rfc4231(self):
817+
return super().test_sha2_224_rfc4231()
818+
819+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
820+
def test_sha2_256_rfc4231(self):
821+
return super().test_sha2_256_rfc4231()
822+
823+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
824+
def test_sha2_384_rfc4231(self):
825+
return super().test_sha2_384_rfc4231()
826+
827+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
828+
def test_sha2_512_rfc4231(self):
829+
return super().test_sha2_512_rfc4231()
830+
831+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
832+
def test_sha3_224_nist(self):
833+
return super().test_sha3_224_nist()
834+
835+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
836+
def test_sha3_256_nist(self):
837+
return super().test_sha3_256_nist()
838+
839+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
840+
def test_sha3_384_nist(self):
841+
return super().test_sha3_384_nist()
842+
843+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
844+
def test_sha3_512_nist(self):
845+
return super().test_sha3_512_nist()
846+
807847

808848
class BuiltinRFCTestCase(BuiltinAssertersMixin,
809849
NamedHashFunctionsTrait,
@@ -1017,6 +1057,7 @@ def obj_type(self):
10171057
def exc_type(self):
10181058
return _hashlib.UnsupportedDigestmodError
10191059

1060+
@unittest.expectedFailure # TODO: RUSTPYTHON
10201061
def test_hmac_digest_digestmod_parameter(self):
10211062
for value in [object, 'unknown', 1234, None]:
10221063
with (
@@ -1025,6 +1066,26 @@ def test_hmac_digest_digestmod_parameter(self):
10251066
):
10261067
self.hmac_digest(b'key', b'msg', value)
10271068

1069+
@unittest.expectedFailure # TODO: RUSTPYTHON
1070+
def test_constructor(self):
1071+
return super().test_constructor()
1072+
1073+
@unittest.expectedFailure # TODO: RUSTPYTHON
1074+
def test_constructor_missing_digestmod(self):
1075+
return super().test_constructor_missing_digestmod()
1076+
1077+
@unittest.expectedFailure # TODO: RUSTPYTHON
1078+
def test_constructor_unknown_digestmod(self):
1079+
return super().test_constructor_unknown_digestmod()
1080+
1081+
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute 'HMAC'. Did you mean: 'exc_type'?
1082+
def test_internal_types(self):
1083+
return super().test_internal_types()
1084+
1085+
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute 'hmac_digest'
1086+
def test_digest(self):
1087+
return super().test_digest()
1088+
10281089

10291090
class BuiltinConstructorTestCase(ThroughBuiltinAPIMixin,
10301091
ExtensionConstructorTestCaseMixin,
@@ -1099,6 +1160,7 @@ def test_repr(self):
10991160

11001161

11011162
@hashlib_helper.requires_openssl_hashdigest('sha256')
1163+
@unittest.skip("TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute 'HMAC'")
11021164
class OpenSSLSanityTestCase(ThroughOpenSSLAPIMixin, SanityTestCaseMixin,
11031165
unittest.TestCase):
11041166

@@ -1195,6 +1257,18 @@ def HMAC(self, key, msg=None):
11951257
def gil_minsize(self):
11961258
return _hashlib._GIL_MINSIZE
11971259

1260+
@unittest.expectedFailure # TODO: RUSTPYTHON
1261+
def test_update(self):
1262+
return super().test_update()
1263+
1264+
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute '_GIL_MINSIZE'
1265+
def test_update_large(self):
1266+
return super().test_update_large()
1267+
1268+
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: a bytes-like object is required, not 'NoneType'
1269+
def test_update_exceptions(self):
1270+
return super().test_update_exceptions()
1271+
11981272

11991273
class BuiltinUpdateTestCase(BuiltinModuleMixin,
12001274
UpdateTestCaseMixin, unittest.TestCase):
@@ -1246,6 +1320,7 @@ def test_realcopy(self):
12461320
self.assertNotEqual(id(h1._inner), id(h2._inner))
12471321
self.assertNotEqual(id(h1._outer), id(h2._outer))
12481322

1323+
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: a bytes-like object is required, not 'NoneType'
12491324
def test_equality(self):
12501325
# Testing if the copy has the same digests.
12511326
h1 = hmac.HMAC(b"key", digestmod="sha256")
@@ -1254,6 +1329,7 @@ def test_equality(self):
12541329
self.assertEqual(h1.digest(), h2.digest())
12551330
self.assertEqual(h1.hexdigest(), h2.hexdigest())
12561331

1332+
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: a bytes-like object is required, not 'NoneType'
12571333
def test_equality_new(self):
12581334
# Testing if the copy has the same digests with hmac.new().
12591335
h1 = hmac.new(b"key", digestmod="sha256")
@@ -1299,6 +1375,14 @@ class OpenSSLCopyTestCase(ExtensionCopyTestCase, unittest.TestCase):
12991375
def init(self, h):
13001376
h._init_openssl_hmac(b"key", b"msg", digestmod="sha256")
13011377

1378+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
1379+
def test_attributes(self):
1380+
return super().test_attributes()
1381+
1382+
@unittest.expectedFailure # TODO: RUSTPYTHON; _hashlib.UnsupportedDigestmodError: unsupported hash type
1383+
def test_realcopy(self):
1384+
return super().test_realcopy()
1385+
13021386

13031387
@hashlib_helper.requires_builtin_hmac()
13041388
class BuiltinCopyTestCase(ExtensionCopyTestCase, unittest.TestCase):
@@ -1430,11 +1514,19 @@ def test_compare_digest_func(self):
14301514
else:
14311515
self.assertIs(self.compare_digest, operator_compare_digest)
14321516

1517+
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: TypeError not raised by compare_digest
1518+
def test_exceptions(self):
1519+
return super().test_exceptions()
1520+
14331521

14341522
@hashlib_helper.requires_hashlib()
14351523
class OpenSSLCompareDigestTestCase(CompareDigestMixin, unittest.TestCase):
14361524
compare_digest = openssl_compare_digest
14371525

1526+
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: TypeError not raised by compare_digest
1527+
def test_exceptions(self):
1528+
return super().test_exceptions()
1529+
14381530

14391531
class OperatorCompareDigestTestCase(CompareDigestMixin, unittest.TestCase):
14401532
compare_digest = operator_compare_digest
@@ -1491,6 +1583,7 @@ def digest(self):
14911583
hmac.HMAC(b'a', b'b', digestmod=MockCrazyHash)
14921584
self.fail('Expected warning about small block_size')
14931585

1586+
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute 'hmac_digest'
14941587
@hashlib_helper.requires_hashdigest('sha256')
14951588
def test_with_fallback(self):
14961589
cache = getattr(hashlib, '__builtin_constructor_cache')

0 commit comments

Comments
 (0)