]> granicus.if.org Git - python/commitdiff
Added a couple of endswith test cases for bugs reported by Timbot.
authorBarry Warsaw <barry@python.org>
Tue, 15 Jun 1999 16:49:11 +0000 (16:49 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 15 Jun 1999 16:49:11 +0000 (16:49 +0000)
Also added a short circuit for the regression test suite since CVS
insisted on putting this file in the main branch. :(

Lib/test/test_string.py

index 1ec29f80ffdfa3919592dd9710bb420c9df4953a..f291b3f91634876c30f210828afbba6df5b4bee2 100644 (file)
@@ -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