gh-130149: cleanup refactorization of `test_hmac.py` (#131318) · python/cpython@de8890f · GitHub
Skip to content

Commit de8890f

Browse files
authored
gh-130149: cleanup refactorization of test_hmac.py (#131318)
New features: * refactor `hashlib_helper.requires_hashdigest` in prevision of a future `hashlib_helper.requires_builtin_hashdigest` for built-in hashes only * add `hashlib_helper.requires_openssl_hashdigest` to request OpenSSL hashes, assuming that `_hashlib` exists. Refactoring: * split hmac.copy() test by implementation * update how algorithms are discovered for RFC test cases * simplify how OpenSSL hash digests are requested * refactor hexdigest tests for RFC test vectors * typo fix: `assert_hmac_hexdigest_by_new` -> `assert_hmac_hexdigest_by_name` Improvements: * strengthen contract on `hmac_new_by_name` and `hmac_digest_by_name` * rename mixin classes to better match their responsibility
1 parent 85c04f8 commit de8890f

3 files changed

Lines changed: 256 additions & 140 deletions

File tree

Lib/hmac.py

Lines changed: 1 addition & 0 deletions

Lib/test/support/hashlib_helper.py

Lines changed: 65 additions & 27 deletions

0 commit comments

Comments
 (0)