Commit 4d7e890
Krzysztof Parzyszek
[testing] Use tuples for numpy indexing (#14476)
Some versions of numpy disallow the following:
>>> import numpy as np
>>> a = np.zeros(10)
>>> b = [slice(None)]
>>> a[b]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis
(`None`) and integer or boolean arrays are valid indices
When b is a tuple, it works fine:
>>> a[tuple(b)]
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])1 parent 99a5734 commit 4d7e890
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
0 commit comments