@@ -30,15 +30,17 @@ def check_does_not_raise(f, category):
30
30
31
31
class TestFloatScalarIndexDeprecation (object ):
32
32
"""
33
- These test that DeprecationWarnings get raised when you
34
- try to use scalar indices that are not integers e.g. a[0.0],
35
- a[1.5, 0].
33
+ These test that `DeprecationWarning`s get raised when you
34
+ try to use scalar indices that are not integers e.g. ` a[0.0]` ,
35
+ ` a[1.5, 0]` .
36
36
37
- grep PyIndex_Check_Or_Unsupported numpy/core/src/multiarray/* for
38
- all the calls to DEPRECATE().
37
+ grep "non-integer scalar" numpy/core/src/multiarray/* for
38
+ all the calls to `DEPRECATE()`, except the one inside
39
+ `_validate_slice_parameter` which handles slicing (but see also
40
+ `TestFloatSliceParameterDeprecation`).
39
41
40
- When 2.4 support is dropped PyIndex_Check_Or_Unsupported should
41
- be removed from npy_pycompat.h and changed to just PyIndex_Check.
42
+ When 2.4 support is dropped ` PyIndex_Check_Or_Unsupported` should
43
+ be removed from npy_pycompat.h and changed to just ` PyIndex_Check` .
42
44
"""
43
45
def setUp (self ):
44
46
warnings .filterwarnings ("error" , message = "non-integer scalar index" ,
@@ -92,6 +94,19 @@ def test_valid_not_deprecated(self):
92
94
93
95
94
96
class TestFloatSliceParameterDeprecation (object ):
97
+ """
98
+ These test that `DeprecationWarning`s get raised when you
99
+ try to use non-integers for slicing, e.g `a[0.0:5]`, `a[::1.5]`,
100
+ etc.
101
+
102
+ When this is changed to an error, `slice_GetIndices` and
103
+ `_validate_slice_parameter` should probably be removed. Calls to
104
+ `slice_GetIndices` should be replaced by the standard Python
105
+ API call `PySlice_GetIndicesEx`, since `slice_GetIndices`
106
+ implements the same thing but with a) int coercion and b) Python
107
+ < 2.3 backwards compatibility (which we have long since dropped
108
+ as of this writing).
109
+ """
95
110
def setUp (self ):
96
111
warnings .filterwarnings ("error" , message = "non-integer slice param" ,
97
112
category = DeprecationWarning )
0 commit comments