Mercurial > cpython-lru_cache-weakref
diff Lib/test/string_tests.py @ 23145:0ecef8bfbd4b 2.2
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
| author | Anthony Baxter <anthonybaxter@gmail.com> |
|---|---|
| date | Thu, 18 Apr 2002 05:18:56 +0000 |
| parents | 7257e87e0720 |
| children | b08b51dce264 |
line wrap: on
line diff
--- a/Lib/test/string_tests.py Thu Apr 18 05:17:53 2002 +0000 +++ b/Lib/test/string_tests.py Thu Apr 18 05:18:56 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')
