@@ -195,6 +195,33 @@ def test_strip(self):
195195 self .checkequal (' hello' , ' hello ' , 'rstrip' )
196196 self .checkequal ('hello' , 'hello' , 'strip' )
197197
198+ # strip/lstrip/rstrip with None arg
199+ self .checkequal ('hello' , ' hello ' , 'strip' , None )
200+ self .checkequal ('hello ' , ' hello ' , 'lstrip' , None )
201+ self .checkequal (' hello' , ' hello ' , 'rstrip' , None )
202+ self .checkequal ('hello' , 'hello' , 'strip' , None )
203+
204+ # strip/lstrip/rstrip with str arg
205+ self .checkequal ('hello' , 'xyzzyhelloxyzzy' , 'strip' , 'xyz' )
206+ self .checkequal ('helloxyzzy' , 'xyzzyhelloxyzzy' , 'lstrip' , 'xyz' )
207+ self .checkequal ('xyzzyhello' , 'xyzzyhelloxyzzy' , 'rstrip' , 'xyz' )
208+ self .checkequal ('hello' , 'hello' , 'strip' , 'xyz' )
209+
210+ # strip/lstrip/rstrip with unicode arg
211+ if test_support .have_unicode :
212+ self .checkequal (unicode ('hello' , 'ascii' ), 'xyzzyhelloxyzzy' ,
213+ 'strip' , unicode ('xyz' , 'ascii' ))
214+ self .checkequal (unicode ('helloxyzzy' , 'ascii' ), 'xyzzyhelloxyzzy' ,
215+ 'lstrip' , unicode ('xyz' , 'ascii' ))
216+ self .checkequal (unicode ('xyzzyhello' , 'ascii' ), 'xyzzyhelloxyzzy' ,
217+ 'rstrip' , unicode ('xyz' , 'ascii' ))
218+ self .checkequal (unicode ('hello' , 'ascii' ), 'hello' ,
219+ 'strip' , unicode ('xyz' , 'ascii' ))
220+
221+ self .checkraises (TypeError , 'hello' , 'strip' , 42 , 42 )
222+ self .checkraises (TypeError , 'hello' , 'lstrip' , 42 , 42 )
223+ self .checkraises (TypeError , 'hello' , 'rstrip' , 42 , 42 )
224+
198225 def test_ljust (self ):
199226 self .checkequal ('abc ' , 'abc' , 'ljust' , 10 )
200227 self .checkequal ('abc ' , 'abc' , 'ljust' , 6 )
@@ -432,34 +459,6 @@ def test_endswith(self):
432459 self .checkraises (TypeError , 'hello' , 'endswith' )
433460 self .checkraises (TypeError , 'hello' , 'endswith' , 42 )
434461
435- def test_strip_args (self ):
436- # strip/lstrip/rstrip with None arg
437- self .checkequal ('hello' , ' hello ' , 'strip' , None )
438- self .checkequal ('hello ' , ' hello ' , 'lstrip' , None )
439- self .checkequal (' hello' , ' hello ' , 'rstrip' , None )
440- self .checkequal ('hello' , 'hello' , 'strip' , None )
441-
442- # strip/lstrip/rstrip with str arg
443- self .checkequal ('hello' , 'xyzzyhelloxyzzy' , 'strip' , 'xyz' )
444- self .checkequal ('helloxyzzy' , 'xyzzyhelloxyzzy' , 'lstrip' , 'xyz' )
445- self .checkequal ('xyzzyhello' , 'xyzzyhelloxyzzy' , 'rstrip' , 'xyz' )
446- self .checkequal ('hello' , 'hello' , 'strip' , 'xyz' )
447-
448- # strip/lstrip/rstrip with unicode arg
449- if test_support .have_unicode :
450- self .checkequal (unicode ('hello' , 'ascii' ), 'xyzzyhelloxyzzy' ,
451- 'strip' , unicode ('xyz' , 'ascii' ))
452- self .checkequal (unicode ('helloxyzzy' , 'ascii' ), 'xyzzyhelloxyzzy' ,
453- 'lstrip' , unicode ('xyz' , 'ascii' ))
454- self .checkequal (unicode ('xyzzyhello' , 'ascii' ), 'xyzzyhelloxyzzy' ,
455- 'rstrip' , unicode ('xyz' , 'ascii' ))
456- self .checkequal (unicode ('hello' , 'ascii' ), 'hello' ,
457- 'strip' , unicode ('xyz' , 'ascii' ))
458-
459- self .checkraises (TypeError , 'hello' , 'strip' , 42 , 42 )
460- self .checkraises (TypeError , 'hello' , 'lstrip' , 42 , 42 )
461- self .checkraises (TypeError , 'hello' , 'rstrip' , 42 , 42 )
462-
463462 def test___contains__ (self ):
464463 self .checkequal (True , '' , '__contains__' , '' ) # vereq('' in '', True)
465464 self .checkequal (True , 'abc' , '__contains__' , '' ) # vereq('' in 'abc', True)
0 commit comments