[3.11] gh-103256: Fix hmac algorithm to support fallback implementation (gh-103286) by miss-islington · Pull Request #103328 · python/cpython
def test_with_fallback(self): cache = getattr(hashlib, '__builtin_constructor_cache') try: cache['foo'] = hashlib.sha256 hexdigest = hmac.digest(b'key', b'message', 'foo').hex() expected = '6e9ef29b75fffc5b7abae527d58fdadb2fe42e7219011976917343065f58ed4a' self.assertEqual(hexdigest, expected) finally: cache.pop('foo')
class ConstructorTestCase(unittest.TestCase):