diff options
| author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-31 22:01:03 (GMT) |
|---|---|---|
| committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-31 22:01:03 (GMT) |
| commit | 6257a7bbb2660ae75c44f2e71d7ac2ce73900f74 (patch) | |
| tree | 6f010065c95f2d5617f56e07ba2628be21cf9d7a /Lib/test/test_hmac.py | |
| parent | ad5983364966b49c277b495112ae41c6ae2d01ed (diff) | |
| download | cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.zip cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.tar.gz cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.tar.bz2 | |
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
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 30bb4fe..cd148e9 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('a', '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('a', 'b', digestmod=MockCrazyHash) - except RuntimeWarning: - pass - else: self.fail('Expected warning about small block_size') |
