[Python-checkins] python/dist/src/Lib/test string_tests.py,1.10,1.10.16.1

anthonybaxter@sourceforge.net anthonybaxter@sourceforge.net
Wed, 17 Apr 2002 22:18:58 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv13642/Lib/test

Modified Files:
      Tag: release22-maint
	string_tests.py 
Log Message:
backport gvanrossum's patch:

Partially implement SF feature request 444708.

Add optional arg to string methods strip(), lstrip(), rstrip().
The optional arg specifies characters to delete.

Also for UserString.

Still to do:

- Misc/NEWS
- LaTeX docs (I did the docstrings though)
- Unicode methods, and Unicode support in the string methods.

Original patches were:
python/dist/src/Lib/test/string_tests.py:1.12



Index: string_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v
retrieving revision 1.10
retrieving revision 1.10.16.1
diff -C2 -d -r1.10 -r1.10.16.1
*** string_tests.py	17 Aug 2001 18:39:24 -0000	1.10
--- string_tests.py	18 Apr 2002 05:18:56 -0000	1.10.16.1
***************
*** 164,167 ****
--- 164,179 ----
      test('strip', 'hello', 'hello')
  
+     # strip/lstrip/rstrip with None arg
+     test('strip', '   hello   ', 'hello', None)
+     test('lstrip', '   hello   ', 'hello   ', None)
+     test('rstrip', '   hello   ', '   hello', None)
+     test('strip', 'hello', 'hello', None)
+ 
+     # strip/lstrip/rstrip with real arg
+     test('strip', 'xyzzyhelloxyzzy', 'hello', 'xyz')
+     test('lstrip', 'xyzzyhelloxyzzy', 'helloxyzzy', 'xyz')
+     test('rstrip', 'xyzzyhelloxyzzy', 'xyzzyhello', 'xyz')
+     test('strip', 'hello', 'hello', 'xyz')
+ 
      test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS')
      test('translate', 'xyzabcdef', 'xyzxyz', transtable, 'def')