@@ -1066,6 +1066,14 @@ def test_hmac_digest_digestmod_parameter(self):
10661066 ):
10671067 self .hmac_digest (b'key' , b'msg' , value )
10681068
1069+ @unittest .expectedFailure # TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute 'HMAC'. Did you mean: 'exc_type'?
1070+ def test_internal_types (self ):
1071+ return super ().test_internal_types ()
1072+
1073+ @unittest .expectedFailure # TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute 'hmac_digest'
1074+ def test_digest (self ):
1075+ return super ().test_digest ()
1076+
10691077 @unittest .expectedFailure # TODO: RUSTPYTHON
10701078 def test_constructor (self ):
10711079 return super ().test_constructor ()
@@ -1078,14 +1086,6 @@ def test_constructor_missing_digestmod(self):
10781086 def test_constructor_unknown_digestmod (self ):
10791087 return super ().test_constructor_unknown_digestmod ()
10801088
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-
10891089
10901090class BuiltinConstructorTestCase (ThroughBuiltinAPIMixin ,
10911091 ExtensionConstructorTestCaseMixin ,
@@ -1137,6 +1137,15 @@ def test_properties(self):
11371137 self .assertEqual (h .digest_size , self .digest_size )
11381138 self .assertEqual (h .block_size , self .block_size )
11391139
1140+ def test_copy (self ):
1141+ # Test a generic copy() and the attributes it exposes.
1142+ # See https://github.com/python/cpython/issues/142451.
1143+ h1 = self .hmac_new (b"my secret key" , digestmod = self .digestname )
1144+ h2 = h1 .copy ()
1145+ self .assertEqual (h1 .name , h2 .name )
1146+ self .assertEqual (h1 .digest_size , h2 .digest_size )
1147+ self .assertEqual (h1 .block_size , h2 .block_size )
1148+
11401149 def test_repr (self ):
11411150 # HMAC object representation may differ across implementations
11421151 raise NotImplementedError
@@ -1160,7 +1169,6 @@ def test_repr(self):
11601169
11611170
11621171@hashlib_helper .requires_openssl_hashdigest ('sha256' )
1163- @unittest .skip ("TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute 'HMAC'" )
11641172class OpenSSLSanityTestCase (ThroughOpenSSLAPIMixin , SanityTestCaseMixin ,
11651173 unittest .TestCase ):
11661174
@@ -1257,10 +1265,6 @@ def HMAC(self, key, msg=None):
12571265 def gil_minsize (self ):
12581266 return _hashlib ._GIL_MINSIZE
12591267
1260- @unittest .expectedFailure # TODO: RUSTPYTHON
1261- def test_update (self ):
1262- return super ().test_update ()
1263-
12641268 @unittest .expectedFailure # TODO: RUSTPYTHON; AttributeError: module '_hashlib' has no attribute '_GIL_MINSIZE'
12651269 def test_update_large (self ):
12661270 return super ().test_update_large ()
@@ -1269,6 +1273,10 @@ def test_update_large(self):
12691273 def test_update_exceptions (self ):
12701274 return super ().test_update_exceptions ()
12711275
1276+ @unittest .expectedFailure # TODO: RUSTPYTHON
1277+ def test_update (self ):
1278+ return super ().test_update ()
1279+
12721280
12731281class BuiltinUpdateTestCase (BuiltinModuleMixin ,
12741282 UpdateTestCaseMixin , unittest .TestCase ):
0 commit comments