Skip to content

Commit 7f02324

Browse files
authored
Update Lib/test/test_hmac.py to 3.12 version (RustPython#5188)
1 parent d453026 commit 7f02324

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎Lib/test/test_hmac.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,18 @@ def test_with_digestmod_no_default(self):
389389
with self.assertRaisesRegex(TypeError, r'required.*digestmod'):
390390
hmac.HMAC(key, msg=data, digestmod='')
391391

392+
# TODO: RUSTPYTHON
393+
@unittest.expectedFailure
394+
def test_with_fallback(self):
395+
cache = getattr(hashlib, '__builtin_constructor_cache')
396+
try:
397+
cache['foo'] = hashlib.sha256
398+
hexdigest = hmac.digest(b'key', b'message', 'foo').hex()
399+
expected = '6e9ef29b75fffc5b7abae527d58fdadb2fe42e7219011976917343065f58ed4a'
400+
self.assertEqual(hexdigest, expected)
401+
finally:
402+
cache.pop('foo')
403+
392404

393405
class ConstructorTestCase(unittest.TestCase):
394406

0 commit comments

Comments
 (0)