We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86ed164 commit 6ee9326Copy full SHA for 6ee9326
py/tests/range.py
@@ -38,4 +38,32 @@
38
assert b[-2] == 6
39
assert b[-1] == 8
40
41
+a = range(10)
42
+assert a[::-1][0] == 9
43
+assert a[::-1][9] == 0
44
+assert a[0:3][0] == 0
45
+assert a[0:3][2] == 2
46
+assert a[-3:10][0] == 7
47
+assert a[-100:13][0] == 0
48
+assert a[-100:13][9] == 9
49
+
50
+try:
51
+ a[0:3][3]
52
+except IndexError:
53
+ pass
54
+else:
55
+ assert False, "IndexError not raised"
56
57
+ a[100:13][0]
58
59
60
61
62
63
+ a[0:3:0]
64
+except ValueError:
65
66
67
+ assert False, "ValueError not raised"
68
69
doc="finished"
0 commit comments