diff options
Diffstat (limited to 'Lib/test/test_hmac.py')
-rw-r--r-- | Lib/test/test_hmac.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py index fb78eba..4de0620 100644 --- a/Lib/test/test_hmac.py +++ b/Lib/test/test_hmac.py @@ -213,19 +213,13 @@ class TestVectorsTestCase(unittest.TestCase): with warnings.catch_warnings(): warnings.simplefilter('error', RuntimeWarning) - try: + with self.assertRaises(RuntimeWarning): hmac.HMAC(b'a', b'b', digestmod=MockCrazyHash) - except RuntimeWarning: - pass - else: self.fail('Expected warning about missing block_size') MockCrazyHash.block_size = 1 - try: + with self.assertRaises(RuntimeWarning): hmac.HMAC(b'a', b'b', digestmod=MockCrazyHash) - except RuntimeWarning: - pass - else: self.fail('Expected warning about small block_size') |