8000
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 af2c4cf commit 09eb7d5Copy full SHA for 09eb7d5
numpy/core/tests/examples/cython/checks.pyx
@@ -30,3 +30,6 @@ def get_dt64_unit(obj):
30
31
def is_integer(obj):
32
return isinstance(obj, (cnp.integer, int))
33
+
34
+def conv_intp(cnp.intp_t val):
35
+ return val
numpy/core/tests/test_cython.py
@@ -122,3 +122,14 @@ def test_abstract_scalars(install_temp):
122
assert checks.is_integer(1)
123
assert checks.is_integer(np.int8(1))
124
assert checks.is_integer(np.uint64(1))
125
126
+def test_conv_intp(install_temp):
127
+ import checks
128
129
+ class myint:
130
+ def __int__(self):
131
+ return 3
132
133
+ # These conversion passes via `__int__`, not `__index__`:
134
+ assert checks.conv_intp(3.) == 3
135
+ assert checks.conv_intp(myint()) == 3
0 commit comments