1
1
import sys
2
+ import platform
2
3
3
4
import pytest
4
5
12
13
_REF = {np .inf : 'inf' , - np .inf : '-inf' , np .nan : 'nan' }
13
14
14
15
15
- @pytest .mark .parametrize ('tp' , [np .float32 , np .double , np .longdouble ])
16
+ # longdouble printing issue on aarch64, see gh-23974
17
+ if platform .machine () == 'aarch64' :
18
+ _real_dtypes = [np .float32 , np .double ]
19
+ _complex_dtypes = [np .complex64 , np .cdouble ]
20
+ else :
21
+ _real_dtypes = [np .float32 , np .double , np .longdouble ]
22
+ _complex_dtypes = [np .complex64 , np .cdouble , np .clongdouble ]
23
+ @pytest .mark .parametrize ('tp' , _real_dtypes )
16
24
def test_float_types (tp ):
17
25
""" Check formatting.
18
26
@@ -34,7 +42,7 @@ def test_float_types(tp):
34
42
err_msg = 'Failed str formatting for type %s' % tp )
35
43
36
44
37
- @pytest .mark .parametrize ('tp' , [ np . float32 , np . double , np . longdouble ] )
45
+ @pytest .mark .parametrize ('tp' , _real_dtypes )
38
46
def test_nan_inf_float (tp ):
39
47
""" Check formatting of nan & inf.
40
48
@@ -48,7 +56,7 @@ def test_nan_inf_float(tp):
48
56
err_msg = 'Failed str formatting for type %s' % tp )
49
57
50
58
51
- @pytest .mark .parametrize ('tp' , [ np . complex64 , np . cdouble , np . clongdouble ] )
59
+ @pytest .mark .parametrize ('tp' , _complex_dtypes )
52
60
def test_complex_types (tp ):
53
61
"""Check formatting of complex types.
54
62
@@ -74,7 +82,7 @@ def test_complex_types(tp):
74
82
err_msg = 'Failed str formatting for type %s' % tp )
75
83
76
84
77
- @pytest .mark .parametrize ('dtype' , [ np . complex64 , np . cdouble , np . clongdouble ] )
85
+ @pytest .mark .parametrize ('dtype' , _complex_dtypes )
78
86
def test_complex_inf_nan (dtype ):
79
87
"""Check inf/nan formatting of complex types."""
80
88
TESTS = {
@@ -119,7 +127,7 @@ def _test_redirected_print(x, tp, ref=None):
119
127
err_msg = 'print failed for type%s' % tp )
120
128
121
129
122
- @pytest .mark .parametrize ('tp' , [ np . float32 , np . double , np . longdouble ] )
130
+ @pytest .mark .parametrize ('tp' , _real_dtypes )
123
131
def test_float_type_print (tp ):
124
132
"""Check formatting when using print """
125
133
for x in [0 , 1 , - 1 , 1e20 ]:
@@ -135,7 +143,7 @@ def test_float_type_print(tp):
135
143
_test_redirected_print (float (1e16 ), tp , ref )
136
144
137
145
138
- @pytest .mark .parametrize ('tp' , [ np . complex64 , np . cdouble , np . clongdouble ] )
146
+ @pytest .mark .parametrize ('tp' , _complex_dtypes )
139
147
def test_complex_type_print (tp ):
140
148
"""Check formatting when using print """
141
149
# We do not create complex with inf/nan directly because the feature is
0 commit comments