Skip to content

Commit ee6aec0

Browse files
CCLDArjunhugovk
authored andcommitted
bpo-14322: added test case for invalid update to hmac (python#26636)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 9415569 commit ee6aec0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/test_hmac.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,14 @@ def test_exercise_all_methods(self):
479479
self.fail("Exception raised during normal usage of HMAC class.")
480480

481481

482+
class UpdateTestCase(unittest.TestCase):
483+
@hashlib_helper.requires_hashdigest('sha256')
484+
def test_with_str_update(self):
485+
with self.assertRaises(TypeError):
486+
h = hmac.new(b"key", digestmod='sha256')
487+
h.update("invalid update")
488+
489+
482490
class CopyTestCase(unittest.TestCase):
483491

484492
@hashlib_helper.requires_hashdigest('sha256')

0 commit comments

Comments
 (0)