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 22ccb4a commit 9cc7591Copy full SHA for 9cc7591
py/tests/range.py
@@ -116,4 +116,24 @@ def __index__(self):
116
assert a[b:10] == a[1:10]
117
assert a[10:b:-1] == a[10:1:-1]
118
119
+class NonIntegerIndex:
120
+ def __index__(self):
121
+ return 1.1
122
+
123
+a = range(10)
124
+b = NonIntegerIndex()
125
+try:
126
+ a[b]
127
+except TypeError:
128
+ pass
129
+else:
130
+ assert False, "TypeError not raised"
131
132
133
+ a[b:10]
134
135
136
137
138
139
doc="finished"
0 commit comments