Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e1d78a

Browse files
committed
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. :(
1 parent c3be1a3 commit 6e1d78a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_string.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
from test_support import verbose
22
import string, sys
33

4+
# XXX: kludge... short circuit if strings don't have methods
5+
try:
6+
''.join
7+
except AttributeError:
8+
raise ImportError
9+
410
def test(name, input, output, *args):
511
if verbose:
612
print 'string.%s%s =? %s... ' % (name, (input,) + args, output),
@@ -128,6 +134,8 @@ def __init__(self): self.seq = [7, 'hello', BadStr()]
128134
test('endswith', 'helloworld', 1, 'lowo', 3, 7)
129135
test('endswith', 'helloworld', 0, 'lowo', 4, 7)
130136
test('endswith', 'helloworld', 0, 'lowo', 3, 8)
137+
test('endswith', 'ab', 0, 'ab', 0, 1)
138+
test('endswith', 'ab', 0, 'ab', 0, 0)
131139

132140
string.whitespace
133141
string.lowercase

0 commit comments

Comments
 (0)