Skip to content

Commit 311b5f5

Browse files
committed
Fix runtime test failures on Windows (AMD64) with NumPy 2.3
- Update alias checks in test_ctype_assumptions.py - Use np.dtype() comparison instead of 'is' identity check to handle NumPy 2.0+ distinct type classes - Account for Windows AMD64 where np.long maps to int32 and np.longdouble maps to float64
1 parent 3316253 commit 311b5f5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/numpy-stubs/@test/runtime/test_ctype_assumptions.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,19 @@ def test_longlong_64(char: str) -> None:
2828
[
2929
("byte", "int8"),
3030
("short", "int16"),
31+
("intc", np.dtype(np.intc).name),
3132
("intp", np.dtype(np.intp).name),
33+
("long", np.dtype(np.long).name),
3234
],
3335
)
3436
def test_alias_integer(name_c: str, name_expect: str) -> None:
3537
signed_c: type[np.signedinteger] = getattr(np, name_c)
3638
signed_expect: type[np.signedinteger] = getattr(np, name_expect)
37-
assert signed_c is signed_expect
39+
assert np.dtype(signed_c) == np.dtype(signed_expect)
3840

3941
unsigned_c: type[np.unsignedinteger] = getattr(np, f"u{name_c}")
4042
unsigned_expect: type[np.unsignedinteger] = getattr(np, f"u{name_expect}")
41-
assert unsigned_c is unsigned_expect
43+
assert np.dtype(unsigned_c) == np.dtype(unsigned_expect)
4244

4345

4446
@pytest.mark.parametrize(
@@ -47,10 +49,10 @@ def test_alias_integer(name_c: str, name_expect: str) -> None:
4749
("half", "float16"),
4850
("single", "float32"),
4951
("double", "float64"),
50-
52+
("longdouble", np.dtype(np.longdouble).name),
5153
],
5254
)
5355
def test_alias_floating(name_c: str, name_expect: str) -> None:
5456
floating_c: type[np.floating] = getattr(np, name_c)
5557
floating_expect: type[np.floating] = getattr(np, name_expect)
56-
assert floating_c is floating_expect
58+
assert np.dtype(floating_c) == np.dtype(floating_expect)

0 commit comments

Comments
 (0)