@@ -23,36 +23,39 @@ def test_longlong_64(char: str) -> None:
2323 assert np .dtype (char ).alignment == 8
2424
2525
26- @pytest .mark .parametrize (
27- ("name_c" , "name_expect" ),
28- [
29- ("byte" , "int8" ),
30- ("short" , "int16" ),
31- ("intc" , "int32" ),
32- ("long" , "int32" if WIN32 else f"int{ SIZE_P } " ),
33- ("intp" , f"int{ SIZE_P } " ),
34- ],
35- )
26+ # --- Integer Aliases ---
27+ _int_aliases = [
28+ ("byte" , "int8" ),
29+ ("short" , "int16" ),
30+ ("intc" , "int32" ),
31+ ("intp" , f"int{ SIZE_P } " ),
32+ # On Windows long is int32 (LLP64), on Linux it matches pointer size (LP64).
33+ ("long" , "int32" if WIN32 else f"int{ SIZE_P } " ),
34+ ]
35+
36+
37+ @pytest .mark .parametrize (("name_c" , "name_expect" ), _int_aliases )
3638def test_alias_integer (name_c : str , name_expect : str ) -> None :
3739 signed_c : type [np .signedinteger ] = getattr (np , name_c )
3840 signed_expect : type [np .signedinteger ] = getattr (np , name_expect )
39- assert signed_c is signed_expect
41+ assert np . dtype ( signed_c ) == np . dtype ( signed_expect )
4042
4143 unsigned_c : type [np .unsignedinteger ] = getattr (np , f"u{ name_c } " )
4244 unsigned_expect : type [np .unsignedinteger ] = getattr (np , f"u{ name_expect } " )
43- assert unsigned_c is unsigned_expect
44-
45-
46- @pytest .mark .parametrize (
47- ("name_c" , "name_expect" ),
48- [
49- ("half" , "float16" ),
50- ("single" , "float32" ),
51- ("double" , "float64" ),
52- ("longdouble" , "float96" if WIN32 else f"float{ SIZE_P + 64 } " ),
53- ],
54- )
45+ assert np .dtype (unsigned_c ) == np .dtype (unsigned_expect )
46+
47+
48+ # --- Floating Point Aliases ---
49+ _float_aliases = [
50+ ("half" , "float16" ),
51+ ("single" , "float32" ),
52+ ("double" , "float64" ),
53+ ("longdouble" , np .dtype (np .longdouble ).name ),
54+ ]
55+
56+
57+ @pytest .mark .parametrize (("name_c" , "name_expect" ), _float_aliases )
5558def test_alias_floating (name_c : str , name_expect : str ) -> None :
5659 floating_c : type [np .floating ] = getattr (np , name_c )
5760 floating_expect : type [np .floating ] = getattr (np , name_expect )
58- assert floating_c is floating_expect
61+ assert np . dtype ( floating_c ) == np . dtype ( floating_expect )
0 commit comments