Mercurial > cpython-lru_cache-weakref
diff Lib/test/string_tests.py @ 23015:202ae5b75cca legacy-trunk
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Sat, 13 Apr 2002 00:56:08 +0000 |
| parents | bccd4613c496 |
| children | 8b1268bc371a |
line wrap: on
line diff
--- a/Lib/test/string_tests.py Fri Apr 12 23:00:08 2002 +0000 +++ b/Lib/test/string_tests.py Sat Apr 13 00:56:08 2002 +0000 @@ -163,6 +163,18 @@ test('rstrip', ' hello ', ' hello') 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')
