Make test_base64 pass.

Change binascii.Error to derive from ValueError
and raise binascii.Error everywhere where values are bad
(why on earth did the old code use TypeError?!?).
This commit is contained in:
Guido van Rossum 2007-05-22 21:56:47 +00:00
parent 0e225aa09b
commit 4581ae5fa2
5 changed files with 268 additions and 232 deletions

View file

@ -118,8 +118,8 @@ class BinASCIITest(unittest.TestCase):
t = binascii.b2a_hex(s)
u = binascii.a2b_hex(t)
self.assertEqual(s, u)
self.assertRaises(TypeError, binascii.a2b_hex, t[:-1])
self.assertRaises(TypeError, binascii.a2b_hex, t[:-1] + b'q')
self.assertRaises(binascii.Error, binascii.a2b_hex, t[:-1])
self.assertRaises(binascii.Error, binascii.a2b_hex, t[:-1] + b'q')
# Verify the treatment of Unicode strings
if test_support.have_unicode: