diff options
author | Arjun <ccldarjun@icloud.com> | 2024-02-25 10:33:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-25 10:33:28 (GMT) |
commit | 6550b548138ed996e1098c4271f5b7df56f02ab8 (patch) | |
tree | 63b4ccf3928c564eabf8688fb2ff7b998f5a918a /Lib/test/test_hmac.py | |
parent | a00b41b9e9257e3c779e3ef5d5d5f0cef9223a30 (diff) | |
download | cpython-6550b548138ed996e1098c4271f5b7df56f02ab8.zip cpython-6550b548138ed996e1098c4271f5b7df56f02ab8.tar.gz cpython-6550b548138ed996e1098c4271f5b7df56f02ab8.tar.bz2 |
bpo-14322: added test case for invalid update to hmac (#26636)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_hmac.py')
-rw-r--r-- | Lib/test/test_hmac.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py index a39a2c4..1502fba 100644 --- a/Lib/test/test_hmac.py +++ b/Lib/test/test_hmac.py @@ -479,6 +479,14 @@ class SanityTestCase(unittest.TestCase): 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') |