diff options
author | Guido van Rossum <guido@python.org> | 2003-04-14 20:58:14 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-14 20:58:14 (GMT) |
commit | 3a3cca5b820084d759b06aed84b1070a56786af5 (patch) | |
tree | 81809e367df89b0dbb4255be3316b7083ca31e45 /Lib | |
parent | b43f15e1ce34deac45eb173db5f12d3d979cf08e (diff) | |
download | cpython-3a3cca5b820084d759b06aed84b1070a56786af5.zip cpython-3a3cca5b820084d759b06aed84b1070a56786af5.tar.gz cpython-3a3cca5b820084d759b06aed84b1070a56786af5.tar.bz2 |
- list.insert(i, x) now interprets negative i as it would be
interpreted by slicing, so negative values count from the end of the
list. This was the only place where such an interpretation was not
placed on a list index.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_types.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index f2a7ccd..49f58e0 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -345,6 +345,11 @@ a.insert(0, -2) a.insert(1, -1) a.insert(2,0) if a != [-2,-1,0,0,1,2]: raise TestFailed, 'list insert' +b = a[:] +b.insert(-2, "foo") +b.insert(-200, "left") +b.insert(200, "right") +if b != ["left",-2,-1,0,0,"foo",1,2,"right"]: raise TestFailed, 'list insert2' if a.count(0) != 2: raise TestFailed, ' list count' if a.index(0) != 2: raise TestFailed, 'list index' a.remove(0) |