Skip to content

Commit f001e41

Browse files
committed
PyLong_AsLong only shouts "Deprecated!" on Python>=3.8
1 parent a5a5846 commit f001e41

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/test_builtin_casters.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,10 @@ def cant_convert(v):
300300
assert noconvert(7) == 7
301301
cant_convert(3.14159)
302302
# TODO: Avoid DeprecationWarning in `PyLong_AsLong` (and similar)
303-
with pytest.deprecated_call():
303+
if env.PY >= (3, 8):
304+
with pytest.deprecated_call():
305+
assert convert(Int()) == 42
306+
else:
304307
assert convert(Int()) == 42
305308
requires_conversion(Int())
306309
cant_convert(NotInt())
@@ -332,7 +335,10 @@ def require_implicit(v):
332335

333336
# The implicit conversion from np.float32 is undesirable but currently accepted.
334337
# TODO: Avoid DeprecationWarning in `PyLong_AsLong` (and similar)
335-
with pytest.deprecated_call():
338+
if env.PY >= (3, 8):
339+
with pytest.deprecated_call():
340+
assert convert(np.float32(3.14159)) == 3
341+
else:
336342
assert convert(np.float32(3.14159)) == 3
337343
require_implicit(np.float32(3.14159))
338344

0 commit comments

Comments
 (0)