mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Add tests for list self-assigns. (Sorry, this should have been here
before JPython 1.0 came out.)
This commit is contained in:
parent
0fd00334c6
commit
affd77f71e
1 changed files with 13 additions and 0 deletions
|
|
@ -134,6 +134,19 @@ class C: pass
|
|||
if min([1,2]) <> 1 or max([1,2]) <> 2: raise TestFailed, 'min/max list'
|
||||
if 0 in [0,1,2] and 1 in [0,1,2] and 2 in [0,1,2] and 3 not in [0,1,2]: pass
|
||||
else: raise TestFailed, 'in/not in list'
|
||||
a = [1, 2, 3, 4, 5]
|
||||
a[:-1] = a
|
||||
if a != [1, 2, 3, 4, 5, 5]:
|
||||
raise TestFailed, "list self-slice-assign (head)"
|
||||
a = [1, 2, 3, 4, 5]
|
||||
a[1:] = a
|
||||
if a != [1, 1, 2, 3, 4, 5]:
|
||||
raise TestFailed, "list self-slice-assign (tail)"
|
||||
a = [1, 2, 3, 4, 5]
|
||||
a[1:-1] = a
|
||||
if a != [1, 1, 2, 3, 4, 5, 5]:
|
||||
raise TestFailed, "list self-slice-assign (center)"
|
||||
|
||||
|
||||
print '6.5.3a Additional list operations'
|
||||
a = [0,1,2,3,4]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue