Skip to content

Commit dbc09d0

Browse files
committed
tests/basics: Enable tests for list slice getting with 3rd arg.
Also add a test to check case when 3rd arg is 0.
1 parent 4c3c515 commit dbc09d0

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

tests/basics/list_slice.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1-
# test slices; only 2 argument version supported by Micro Python at the moment
1+
# test list slices, getting values
2+
23
x = list(range(10))
34
a = 2
45
b = 4
56
c = 3
67
print(x[:])
78
print(x[::])
8-
#print(x[::c])
9+
print(x[::c])
910
print(x[:b])
1011
print(x[:b:])
11-
#print(x[:b:c])
12+
print(x[:b:c])
1213
print(x[a])
1314
print(x[a:])
1415
print(x[a::])
15-
#print(x[a::c])
16+
print(x[a::c])
1617
print(x[a:b])
1718
print(x[a:b:])
18-
#print(x[a:b:c])
19+
print(x[a:b:c])
1920

2021
# these should not raise IndexError
2122
print([][1:])
2223
print([][-1:])
24+
25+
try:
26+
[][::0]
27+
except ValueError:
28+
print('ValueError')

0 commit comments

Comments
 (0)