29
29
)
30
30
31
31
32
- types = [s16 , s32 , s64 , u8 , u16 , u32 , u64 , f16 , f32 , f64 , c32 , c64 ]
32
+ all_types = [s16 , s32 , s64 , u8 , u16 , u32 , u64 , f16 , f32 , f64 , c32 , c64 ]
33
33
34
34
35
35
@pytest .mark .parametrize (
@@ -66,7 +66,6 @@ def test_constant_complex_shape(shape: tuple) -> None:
66
66
"""Test if constant_complex creates an array with the correct shape."""
67
67
dtype = c32
68
68
69
- dtype = c32
70
69
rand_array = wrapper .randu ((1 , 1 ), dtype )
71
70
number = wrapper .get_scalar (rand_array , dtype )
72
71
@@ -167,11 +166,11 @@ def test_constant_ulong_shape_invalid() -> None:
167
166
168
167
@pytest .mark .parametrize (
169
168
"dtype" ,
170
- types ,
169
+ all_types ,
171
170
)
172
171
def test_constant_dtype (dtype : Dtype ) -> None :
173
172
"""Test if constant creates an array with the correct dtype."""
174
- if dtype in [ c32 , c64 ] or ( dtype == f64 and not wrapper . get_dbl_support () ):
173
+ if is_cmplx_type ( dtype ) or not is_system_supported ( dtype ):
175
174
pytest .skip ()
176
175
177
176
rand_array = wrapper .randu ((1 , 1 ), dtype )
@@ -186,11 +185,11 @@ def test_constant_dtype(dtype: Dtype) -> None:
186
185
187
186
@pytest .mark .parametrize (
188
187
"dtype" ,
189
- types ,
188
+ all_types ,
190
189
)
191
190
def test_constant_complex_dtype (dtype : Dtype ) -> None :
192
191
"""Test if constant_complex creates an array with the correct dtype."""
193
- if dtype not in [ c32 , c64 ] or (dtype == c64 and not wrapper . get_dbl_support () ):
192
+ if not is_cmplx_type (dtype ) or not is_system_supported ( dtype ):
194
193
pytest .skip ()
195
194
196
195
rand_array = wrapper .randu ((1 , 1 ), dtype )
@@ -234,3 +233,14 @@ def test_constant_ulong_dtype() -> None:
234
233
assert c_api_value_to_dtype (wrapper .get_type (result )) == dtype
235
234
else :
236
235
pytest .skip ()
236
+
237
+
238
+ def is_cmplx_type (dtype : Dtype ) -> bool :
239
+ return dtype == c32 or dtype == c64
240
+
241
+
242
+ def is_system_supported (dtype : Dtype ) -> bool :
243
+ if dtype in [f64 , c64 ] and not wrapper .get_dbl_support ():
244
+ return False
245
+
246
+ return True
0 commit comments