@@ -52,6 +52,25 @@ def test(method, input, output, *args):
5252 exc = sys .exc_info ()[:2 ]
5353 else :
5454 exc = None
55+ if value == output and type (value ) is type (output ):
56+ # if the original is returned make sure that
57+ # this doesn't happen with subclasses
58+ if value is input :
59+ class usub (unicode ):
60+ def __repr__ (self ):
61+ return 'usub(%r)' % unicode .__repr__ (self )
62+ input = usub (input )
63+ try :
64+ f = getattr (input , method )
65+ value = apply (f , args )
66+ except :
67+ value = sys .exc_type
68+ exc = sys .exc_info ()[:2 ]
69+ if value is input :
70+ if verbose :
71+ print 'no'
72+ print '*' ,f , `input` , `output` , `value`
73+ return
5574 if value != output or type (value ) is not type (output ):
5675 if verbose :
5776 print 'no'
@@ -63,6 +82,7 @@ def test(method, input, output, *args):
6382 print 'yes'
6483
6584test ('capitalize' , u' hello ' , u' hello ' )
85+ test ('capitalize' , u'Hello ' , u'Hello ' )
6686test ('capitalize' , u'hello ' , u'Hello ' )
6787test ('capitalize' , u'aaaa' , u'Aaaa' )
6888test ('capitalize' , u'AaAa' , u'Aaaa' )
@@ -75,6 +95,7 @@ def test(method, input, output, *args):
7595test ('count' , u'aaa' , 0 , 'b' )
7696
7797test ('title' , u' hello ' , u' Hello ' )
98+ test ('title' , u'Hello ' , u'Hello ' )
7899test ('title' , u'hello ' , u'Hello ' )
79100test ('title' , u"fOrMaT thIs aS titLe String" , u'Format This As Title String' )
80101test ('title' , u"fOrMaT,thIs-aS*titLe;String" , u'Format,This-As*Title;String' )
@@ -200,6 +221,7 @@ def __getitem__(self, i): return self.seq[i]
200221test ('expandtabs' , u'abc\r ab\t def\n g\t hi' , u'abc\r ab def\n g hi' , 8 )
201222test ('expandtabs' , u'abc\r ab\t def\n g\t hi' , u'abc\r ab def\n g hi' , 4 )
202223test ('expandtabs' , u'abc\r \n ab\t def\n g\t hi' , u'abc\r \n ab def\n g hi' , 4 )
224+ test ('expandtabs' , u'abc\r \n ab\r \n def\n g\r \n hi' , u'abc\r \n ab\r \n def\n g\r \n hi' , 4 )
203225
204226if 0 :
205227 test ('capwords' , u'abc def ghi' , u'Abc Def Ghi' )
0 commit comments