mirror of
https://github.com/python/cpython.git
synced 2025-09-20 15:40:32 +00:00
Added more tests of join
This commit is contained in:
parent
cbfa5cbcc8
commit
d5258681e7
1 changed files with 9 additions and 0 deletions
|
@ -67,6 +67,15 @@ class Sequence:
|
||||||
test('join', ['a', 'b', 'c', 'd'], 'a b c d')
|
test('join', ['a', 'b', 'c', 'd'], 'a b c d')
|
||||||
test('join', ('a', 'b', 'c', 'd'), 'abcd', '')
|
test('join', ('a', 'b', 'c', 'd'), 'abcd', '')
|
||||||
test('join', Sequence(), 'w x y z')
|
test('join', Sequence(), 'w x y z')
|
||||||
|
test('join', 7, TypeError)
|
||||||
|
|
||||||
|
class BadStr:
|
||||||
|
def __str__(self): raise RuntimeError
|
||||||
|
|
||||||
|
class BadSeq(Sequence):
|
||||||
|
def __init__(self): self.seq = [7, 'hello', BadStr()]
|
||||||
|
|
||||||
|
test('join', BadSeq(), RuntimeError)
|
||||||
|
|
||||||
# try a few long ones
|
# try a few long ones
|
||||||
print string.join(['x' * 100] * 100, ':')
|
print string.join(['x' * 100] * 100, ':')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue