Fix some tests I broke. (More to follow.)
diff --git a/Lib/base64.py b/Lib/base64.py
index cec6422..5d42065 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -28,7 +28,8 @@
def _translate(s, altchars):
- assert isinstance(s, bytes), type(s)
+ if not isinstance(s, bytes):
+ raise TypeError("expected bytes, not %s" % s.__class__.__name__)
translation = bytes(range(256))
for k, v in altchars.items():
translation[ord(k)] = v[0]
@@ -323,7 +324,8 @@
def encodestring(s):
"""Encode a string into multiple lines of base-64 data."""
- assert isinstance(s, bytes), repr(s)
+ if not isinstance(s, bytes):
+ raise TypeError("expected bytes, not %s" % s.__class__.__name__)
pieces = []
for i in range(0, len(s), MAXBINSIZE):
chunk = s[i : i + MAXBINSIZE]
@@ -333,7 +335,8 @@
def decodestring(s):
"""Decode a string."""
- assert isinstance(s, bytes), repr(s)
+ if not isinstance(s, bytes):
+ raise TypeError("expected bytes, not %s" % s.__class__.__name__)
return binascii.a2b_base64(s)