Skip to content

Commit 576f16b

Browse files
CCLDArjunhugovk
authored andcommitted
bpo-14322: added test case for invalid update to hmac (python#26636)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 777f7cd commit 576f16b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

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)