diff options
author | Damien George <damien.p.george@gmail.com> | 2016-11-26 16:39:25 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-11-26 16:39:25 +1100 |
commit | dbc09d03f62bf2d5ee1661492a4c20a7942f81a9 (patch) | |
tree | 530ac070390dc048ce242f9b5cdb8a72cfb04c1f /tests | |
parent | 4c3c515bd11a3656708d0fb43b4f0d53f576fcc6 (diff) | |
download | micropython-dbc09d03f62bf2d5ee1661492a4c20a7942f81a9.tar.gz micropython-dbc09d03f62bf2d5ee1661492a4c20a7942f81a9.zip |
tests/basics: Enable tests for list slice getting with 3rd arg.
Also add a test to check case when 3rd arg is 0.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/list_slice.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/basics/list_slice.py b/tests/basics/list_slice.py index 3a9a1e05e6..fc08e580a1 100644 --- a/tests/basics/list_slice.py +++ b/tests/basics/list_slice.py @@ -1,22 +1,28 @@ -# test slices; only 2 argument version supported by Micro Python at the moment +# test list slices, getting values + x = list(range(10)) a = 2 b = 4 c = 3 print(x[:]) print(x[::]) -#print(x[::c]) +print(x[::c]) print(x[:b]) print(x[:b:]) -#print(x[:b:c]) +print(x[:b:c]) print(x[a]) print(x[a:]) print(x[a::]) -#print(x[a::c]) +print(x[a::c]) print(x[a:b]) print(x[a:b:]) -#print(x[a:b:c]) +print(x[a:b:c]) # these should not raise IndexError print([][1:]) print([][-1:]) + +try: + [][::0] +except ValueError: + print('ValueError') |