https://github.com/python/cpython/commit/6550b548138ed996e1098c4271f5b7df56f02ab8
commit: 6550b548138ed996e1098c4271f5b7df56f02ab8
branch: main
author: Arjun <[email protected]>
committer: hugovk <[email protected]>
date: 2024-02-25T03:33:28-07:00
summary:

bpo-14322: added test case for invalid update to hmac (#26636)

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