From afab74cac202f4632a4d0557d7af856291bd9fbd Mon Sep 17 00:00:00 2001 From: CCLDArjun Date: Wed, 9 Jun 2021 22:39:33 -0700 Subject: [PATCH 1/2] added test for invalid update --- Lib/test/test_hmac.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py index 7cf99735ca39f0..88ce5d6ba01757 100644 --- a/Lib/test/test_hmac.py +++ b/Lib/test/test_hmac.py @@ -469,6 +469,21 @@ 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 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') From 5e99fa47510a1062583f35ee04d8579ffd5069a9 Mon Sep 17 00:00:00 2001 From: Arjun Date: Wed, 9 Jun 2021 22:42:46 -0700 Subject: [PATCH 2/2] oops it got added twice --- Lib/test/test_hmac.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py index 88ce5d6ba01757..504b5677a1564c 100644 --- a/Lib/test/test_hmac.py +++ b/Lib/test/test_hmac.py @@ -477,13 +477,6 @@ def test_with_str_update(self): h.update("invalid update") -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')