https://github.com/python/cpython/commit/c6455ff0fd4a05a5b7ffeccb19a9ae30c66ffbe6
commit: c6455ff0fd4a05a5b7ffeccb19a9ae30c66ffbe6
branch: 3.11
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2024-02-25T10:52:55Z
summary:

[3.11] bpo-14322: added test case for invalid update to hmac (GH-26636) 
(#115905)

Co-authored-by: Arjun <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>

files:
M Lib/test/test_hmac.py

diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
index a39a2c45ebc2e2..1502fba9f3e8b8 100644
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -479,6 +479,14 @@ def test_exercise_all_methods(self):
             self.fail("Exception raised during normal usage of HMAC class.")
 
 
+class UpdateTestCase(unittest.TestCase):
+    @hashlib_helper.requires_hashdigest('sha256')
+    def test_with_str_update(self):
+        with self.assertRaises(TypeError):
+            h = hmac.new(b"key", digestmod='sha256')
+            h.update("invalid update")
+
+
 class CopyTestCase(unittest.TestCase):
 
     @hashlib_helper.requires_hashdigest('sha256')

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to