diff -r 9623c83ba489 Lib/test/test_hmac.py --- a/Lib/test/test_hmac.py Wed Jun 27 15:26:26 2012 -0400 +++ b/Lib/test/test_hmac.py Sat Jun 30 08:25:29 2012 -0700 @@ -234,6 +234,18 @@ except: self.fail("Standard constructor call raised exception.") + def test_with_str_key(self): + # Pass a key of type str, which is an error, because it expects a key + # of type bytes + with self.assertRaises(TypeError): + h = hmac.HMAC("key") + + def test_dot_new_with_str_key(self): + # Pass a key of type str, which is an error, because it expects a key + # of type bytes + with self.assertRaises(TypeError): + h = hmac.new("key") + def test_withtext(self): # Constructor call with text. try: