summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_string.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1999-06-15 16:49:11 (GMT)
committerBarry Warsaw <barry@python.org>1999-06-15 16:49:11 (GMT)
commit6e1d78a18149a752618324311339797ce89c7700 (patch)
tree176b37d2f61234bfa6416252c3e94faa2d0f8388 /Lib/test/test_string.py
parentc3be1a3ca1eba20f15a2c171a3f4a5da4d706feb (diff)
downloadcpython-6e1d78a18149a752618324311339797ce89c7700.zip
cpython-6e1d78a18149a752618324311339797ce89c7700.tar.gz
cpython-6e1d78a18149a752618324311339797ce89c7700.tar.bz2
Added a couple of endswith test cases for bugs reported by Timbot.
Also added a short circuit for the regression test suite since CVS insisted on putting this file in the main branch. :(
Diffstat (limited to 'Lib/test/test_string.py')
-rw-r--r--Lib/test/test_string.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py
index 1ec29f8..f291b3f 100644
--- a/Lib/test/test_string.py
+++ b/Lib/test/test_string.py
@@ -1,6 +1,12 @@
from test_support import verbose
import string, sys
+# XXX: kludge... short circuit if strings don't have methods
+try:
+ ''.join
+except AttributeError:
+ raise ImportError
+
def test(name, input, output, *args):
if verbose:
print 'string.%s%s =? %s... ' % (name, (input,) + args, output),
@@ -128,6 +134,8 @@ test('endswith', 'helloworld', 1, 'lowo', 2, 7)
test('endswith', 'helloworld', 1, 'lowo', 3, 7)
test('endswith', 'helloworld', 0, 'lowo', 4, 7)
test('endswith', 'helloworld', 0, 'lowo', 3, 8)
+test('endswith', 'ab', 0, 'ab', 0, 1)
+test('endswith', 'ab', 0, 'ab', 0, 0)
string.whitespace
string.lowercase