5
5
import arrayfire_wrapper .dtypes as dtype
6
6
import arrayfire_wrapper .lib as wrapper
7
7
8
- from . import utility_functions as util
8
+ from tests .utility_functions import check_type_supported , get_all_types , get_float_types
9
+
9
10
10
11
11
12
@pytest .mark .parametrize (
18
19
(random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 )),
19
20
],
20
21
)
21
- @pytest .mark .parametrize ("dtype_name" , util . get_all_types ())
22
+ @pytest .mark .parametrize ("dtype_name" , get_all_types ())
22
23
def test_asin_shape_dtypes (shape : tuple , dtype_name : dtype .Dtype ) -> None :
23
24
"""Test inverse sine operation across all supported data types."""
24
- util . check_type_supported (dtype_name )
25
+ check_type_supported (dtype_name )
25
26
values = wrapper .randu (shape , dtype_name )
26
27
result = wrapper .asin (values )
27
28
assert wrapper .get_dims (result )[0 : len (shape )] == shape , f"failed for shape: { shape } " # noqa
@@ -37,10 +38,10 @@ def test_asin_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
37
38
(random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 )),
38
39
],
39
40
)
40
- @pytest .mark .parametrize ("dtype_name" , util . get_all_types ())
41
+ @pytest .mark .parametrize ("dtype_name" , get_all_types ())
41
42
def test_acos_shape_dtypes (shape : tuple , dtype_name : dtype .Dtype ) -> None :
42
43
"""Test inverse cosine operation across all supported data types."""
43
- util . check_type_supported (dtype_name )
44
+ check_type_supported (dtype_name )
44
45
values = wrapper .randu (shape , dtype_name )
45
46
result = wrapper .acos (values )
46
47
assert wrapper .get_dims (result )[0 : len (shape )] == shape , f"failed for shape: { shape } " # noqa
@@ -56,10 +57,10 @@ def test_acos_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
56
57
(random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 )),
57
58
],
58
59
)
59
- @pytest .mark .parametrize ("dtype_name" , util . get_all_types ())
60
+ @pytest .mark .parametrize ("dtype_name" , get_all_types ())
60
61
def test_atan_shape_dtypes (shape : tuple , dtype_name : dtype .Dtype ) -> None :
61
62
"""Test inverse tan operation across all supported data types."""
62
- util . check_type_supported (dtype_name )
63
+ check_type_supported (dtype_name )
63
64
values = wrapper .randu (shape , dtype_name )
64
65
result = wrapper .atan (values )
65
66
assert wrapper .get_dims (result )[0 : len (shape )] == shape , f"failed for shape: { shape } " # noqa
@@ -75,10 +76,10 @@ def test_atan_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
75
76
(random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 )),
76
77
],
77
78
)
78
- @pytest .mark .parametrize ("dtype_name" , util . get_float_types ())
79
+ @pytest .mark .parametrize ("dtype_name" , get_float_types ())
79
80
def test_atan2_shape_dtypes (shape : tuple , dtype_name : dtype .Dtype ) -> None :
80
81
"""Test inverse tan operation across all supported data types."""
81
- util . check_type_supported (dtype_name )
82
+ check_type_supported (dtype_name )
82
83
if dtype_name == dtype .f16 :
83
84
pytest .skip ()
84
85
lhs = wrapper .randu (shape , dtype_name )
@@ -110,10 +111,10 @@ def test_atan2_unsupported_dtypes(invdtypes: dtype.Dtype) -> None:
110
111
(random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 )),
111
112
],
112
113
)
113
- @pytest .mark .parametrize ("dtype_name" , util . get_all_types ())
114
+ @pytest .mark .parametrize ("dtype_name" , get_all_types ())
114
115
def test_cos_shape_dtypes (shape : tuple , dtype_name : dtype .Dtype ) -> None :
115
116
"""Test cosine operation across all supported data types."""
116
- util . check_type_supported (dtype_name )
117
+ check_type_supported (dtype_name )
117
118
values = wrapper .randu (shape , dtype_name )
118
119
result = wrapper .cos (values )
119
120
assert wrapper .get_dims (result )[0 : len (shape )] == shape , f"failed for shape: { shape } " # noqa
@@ -129,10 +130,10 @@ def test_cos_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
129
130
(random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 )),
130
131
],
131
132
)
132
- @pytest .mark .parametrize ("dtype_name" , util . get_all_types ())
133
+ @pytest .mark .parametrize ("dtype_name" , get_all_types ())
133
134
def test_sin_shape_dtypes (shape : tuple , dtype_name : dtype .Dtype ) -> None :
134
135
"""Test sin operation across all supported data types."""
135
- util . check_type_supported (dtype_name )
136
+ check_type_supported (dtype_name )
136
137
values = wrapper .randu (shape , dtype_name )
137
138
result = wrapper .sin (values )
138
139
assert wrapper .get_dims (result )[0 : len (shape )] == shape , f"failed for shape: { shape } " # noqa
@@ -148,10 +149,10 @@ def test_sin_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
148
149
(random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 ), random .randint (1 , 10 )),
149
150
],
150
151
)
151
- @pytest .mark .parametrize ("dtype_name" , util . get_all_types ())
152
+ @pytest .mark .parametrize ("dtype_name" , get_all_types ())
152
153
def test_tan_shape_dtypes (shape : tuple , dtype_name : dtype .Dtype ) -> None :
153
154
"""Test tan operation across all supported data types."""
154
- util . check_type_supported (dtype_name )
155
+ check_type_supported (dtype_name )
155
156
values = wrapper .randu (shape , dtype_name )
156
157
result = wrapper .tan (values )
157
158
assert wrapper .get_dims (result )[0 : len (shape )] == shape , f"failed for shape: { shape } " # noqa
0 commit comments