Fix some tests I broke. (More to follow.)
diff --git a/Lib/UserString.py b/Lib/UserString.py
index 62e73bb..500cd12 100755
--- a/Lib/UserString.py
+++ b/Lib/UserString.py
@@ -57,6 +57,8 @@
             return self.data >= string
 
     def __contains__(self, char):
+        if isinstance(char, UserString):
+            char = char.data
         return char in self.data
 
     def __len__(self): return len(self.data)
@@ -88,6 +90,8 @@
     def center(self, width, *args):
         return self.__class__(self.data.center(width, *args))
     def count(self, sub, start=0, end=sys.maxint):
+        if isinstance(sub, UserString):
+            sub = sub.data
         return self.data.count(sub, start, end)
     def decode(self, encoding=None, errors=None): # XXX improve this?
         if encoding:
@@ -110,6 +114,8 @@
     def expandtabs(self, tabsize=8):
         return self.__class__(self.data.expandtabs(tabsize))
     def find(self, sub, start=0, end=sys.maxint):
+        if isinstance(sub, UserString):
+            sub = sub.data
         return self.data.find(sub, start, end)
     def index(self, sub, start=0, end=sys.maxint):
         return self.data.index(sub, start, end)
@@ -130,6 +136,10 @@
     def partition(self, sep):
         return self.data.partition(sep)
     def replace(self, old, new, maxsplit=-1):
+        if isinstance(old, UserString):
+            old = old.data
+        if isinstance(new, UserString):
+            new = new.data
         return self.__class__(self.data.replace(old, new, maxsplit))
     def rfind(self, sub, start=0, end=sys.maxint):
         return self.data.rfind(sub, start, end)
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)
 
 
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 22979f6..5cbc652 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -998,7 +998,7 @@
         # expect one request without authorization, then one with
         self.assertEqual(len(http_handler.requests), 2)
         self.assertFalse(http_handler.requests[0].has_header(auth_header))
-        userpass = '%s:%s' % (user, password)
+        userpass = bytes('%s:%s' % (user, password), "ascii")
         auth_hdr_value = 'Basic ' + str(base64.encodestring(userpass)).strip()
         self.assertEqual(http_handler.requests[1].get_header(auth_header),
                          auth_hdr_value)