diff options
author | Guido van Rossum <guido@python.org> | 2002-04-13 00:56:08 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-04-13 00:56:08 (GMT) |
commit | 018b0eb0f50a6995922402d87cf9906b62a50252 (patch) | |
tree | 097e9c9b588ea0ce558fde65dbfa7381ab4b2259 /Lib/test | |
parent | 9344b148282b3a40c44102018e8eac86d6613c51 (diff) | |
download | cpython-018b0eb0f50a6995922402d87cf9906b62a50252.zip cpython-018b0eb0f50a6995922402d87cf9906b62a50252.tar.gz cpython-018b0eb0f50a6995922402d87cf9906b62a50252.tar.bz2 |
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.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/string_tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 4b2f0e3..5c8dd93 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -163,6 +163,18 @@ def run_method_tests(test): 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') |