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)