diff -r 694e2708b4a8 Lib/test/test_hmac.py --- a/Lib/test/test_hmac.py Sun Nov 24 23:13:26 2013 +0200 +++ b/Lib/test/test_hmac.py Mon Nov 25 00:01:51 2013 +0200 @@ -268,7 +268,8 @@ # Standard constructor call. failed = 0 try: - h = hmac.HMAC(b"key") + with support.check_warnings(('', PendingDeprecationWarning)): + h = hmac.HMAC(b"key") except: self.fail("Standard constructor call raised exception.") @@ -287,20 +288,23 @@ def test_withtext(self): # Constructor call with text. try: - h = hmac.HMAC(b"key", b"hash this!") + with support.check_warnings(('', PendingDeprecationWarning)): + h = hmac.HMAC(b"key", b"hash this!") except: self.fail("Constructor call with text argument raised exception.") def test_with_bytearray(self): try: - h = hmac.HMAC(bytearray(b"key"), bytearray(b"hash this!")) + with support.check_warnings(('', PendingDeprecationWarning)): + h = hmac.HMAC(bytearray(b"key"), bytearray(b"hash this!")) self.assertEqual(h.hexdigest(), '34325b639da4cfd95735b381e28cb864') except: self.fail("Constructor call with bytearray arguments raised exception.") def test_with_memoryview_msg(self): try: - h = hmac.HMAC(b"key", memoryview(b"hash this!")) + with support.check_warnings(('', PendingDeprecationWarning)): + h = hmac.HMAC(b"key", memoryview(b"hash this!")) self.assertEqual(h.hexdigest(), '34325b639da4cfd95735b381e28cb864') except: self.fail("Constructor call with memoryview msg raised exception.") @@ -317,14 +321,16 @@ def test_default_is_md5(self): # Testing if HMAC defaults to MD5 algorithm. # NOTE: this whitebox test depends on the hmac class internals - h = hmac.HMAC(b"key") + with support.check_warnings(('', PendingDeprecationWarning)): + h = hmac.HMAC(b"key") self.assertEqual(h.digest_cons, hashlib.md5) def test_exercise_all_methods(self): # Exercising all methods once. # This must not raise any exceptions try: - h = hmac.HMAC(b"my secret key") + with support.check_warnings(('', PendingDeprecationWarning)): + h = hmac.HMAC(b"my secret key") h.update(b"compute the hash of this text!") dig = h.digest() dig = h.hexdigest() @@ -336,7 +342,8 @@ def test_attributes(self): # Testing if attributes are of same type. - h1 = hmac.HMAC(b"key") + with support.check_warnings(('', PendingDeprecationWarning)): + h1 = hmac.HMAC(b"key") h2 = h1.copy() self.assertTrue(h1.digest_cons == h2.digest_cons, "digest constructors don't match.") @@ -347,7 +354,8 @@ def test_realcopy(self): # Testing if the copy method created a real copy. - h1 = hmac.HMAC(b"key") + with support.check_warnings(('', PendingDeprecationWarning)): + h1 = hmac.HMAC(b"key") h2 = h1.copy() # Using id() in case somebody has overridden __eq__/__ne__. self.assertTrue(id(h1) != id(h2), "No real copy of the HMAC instance.") @@ -358,7 +366,8 @@ def test_equality(self): # Testing if the copy has the same digests. - h1 = hmac.HMAC(b"key") + with support.check_warnings(('', PendingDeprecationWarning)): + h1 = hmac.HMAC(b"key") h1.update(b"some random text") h2 = h1.copy() self.assertEqual(h1.digest(), h2.digest(),