[Python-checkins] python/dist/src/Lib/test string_tests.py,1.11,1.12

gvanrossum@sourceforge.net gvanrossum@sourceforge.net
Fri, 12 Apr 2002 17:56:10 -0700


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

Modified Files:
	string_tests.py 
Log Message:
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.




Index: string_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** string_tests.py	29 Mar 2002 16:00:13 -0000	1.11
--- string_tests.py	13 Apr 2002 00:56:08 -0000	1.12
***************
*** 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')