Skip to content

Commit 90b77c6

Browse files
AzeezIshAzeezIsh
and
AzeezIsh
authored
Trigonometry Testing (#44)
* Updated imports and checkstyle changes --------- Co-authored-by: AzeezIsh <[email protected]>
1 parent b849435 commit 90b77c6

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

tests/test_trig.py

+15-16
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
import arrayfire_wrapper.dtypes as dtype
66
import arrayfire_wrapper.lib as wrapper
7-
8-
from . import utility_functions as util
7+
from tests.utility_functions import check_type_supported, get_all_types, get_float_types
98

109

1110
@pytest.mark.parametrize(
@@ -18,10 +17,10 @@
1817
(random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
1918
],
2019
)
21-
@pytest.mark.parametrize("dtype_name", util.get_all_types())
20+
@pytest.mark.parametrize("dtype_name", get_all_types())
2221
def test_asin_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
2322
"""Test inverse sine operation across all supported data types."""
24-
util.check_type_supported(dtype_name)
23+
check_type_supported(dtype_name)
2524
values = wrapper.randu(shape, dtype_name)
2625
result = wrapper.asin(values)
2726
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
@@ -37,10 +36,10 @@ def test_asin_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
3736
(random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
3837
],
3938
)
40-
@pytest.mark.parametrize("dtype_name", util.get_all_types())
39+
@pytest.mark.parametrize("dtype_name", get_all_types())
4140
def test_acos_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
4241
"""Test inverse cosine operation across all supported data types."""
43-
util.check_type_supported(dtype_name)
42+
check_type_supported(dtype_name)
4443
values = wrapper.randu(shape, dtype_name)
4544
result = wrapper.acos(values)
4645
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
@@ -56,10 +55,10 @@ def test_acos_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
5655
(random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
5756
],
5857
)
59-
@pytest.mark.parametrize("dtype_name", util.get_all_types())
58+
@pytest.mark.parametrize("dtype_name", get_all_types())
6059
def test_atan_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
6160
"""Test inverse tan operation across all supported data types."""
62-
util.check_type_supported(dtype_name)
61+
check_type_supported(dtype_name)
6362
values = wrapper.randu(shape, dtype_name)
6463
result = wrapper.atan(values)
6564
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
@@ -75,10 +74,10 @@ def test_atan_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
7574
(random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
7675
],
7776
)
78-
@pytest.mark.parametrize("dtype_name", util.get_float_types())
77+
@pytest.mark.parametrize("dtype_name", get_float_types())
7978
def test_atan2_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
8079
"""Test inverse tan operation across all supported data types."""
81-
util.check_type_supported(dtype_name)
80+
check_type_supported(dtype_name)
8281
if dtype_name == dtype.f16:
8382
pytest.skip()
8483
lhs = wrapper.randu(shape, dtype_name)
@@ -110,10 +109,10 @@ def test_atan2_unsupported_dtypes(invdtypes: dtype.Dtype) -> None:
110109
(random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
111110
],
112111
)
113-
@pytest.mark.parametrize("dtype_name", util.get_all_types())
112+
@pytest.mark.parametrize("dtype_name", get_all_types())
114113
def test_cos_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
115114
"""Test cosine operation across all supported data types."""
116-
util.check_type_supported(dtype_name)
115+
check_type_supported(dtype_name)
117116
values = wrapper.randu(shape, dtype_name)
118117
result = wrapper.cos(values)
119118
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
@@ -129,10 +128,10 @@ def test_cos_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
129128
(random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
130129
],
131130
)
132-
@pytest.mark.parametrize("dtype_name", util.get_all_types())
131+
@pytest.mark.parametrize("dtype_name", get_all_types())
133132
def test_sin_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
134133
"""Test sin operation across all supported data types."""
135-
util.check_type_supported(dtype_name)
134+
check_type_supported(dtype_name)
136135
values = wrapper.randu(shape, dtype_name)
137136
result = wrapper.sin(values)
138137
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
@@ -148,10 +147,10 @@ def test_sin_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
148147
(random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
149148
],
150149
)
151-
@pytest.mark.parametrize("dtype_name", util.get_all_types())
150+
@pytest.mark.parametrize("dtype_name", get_all_types())
152151
def test_tan_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
153152
"""Test tan operation across all supported data types."""
154-
util.check_type_supported(dtype_name)
153+
check_type_supported(dtype_name)
155154
values = wrapper.randu(shape, dtype_name)
156155
result = wrapper.tan(values)
157156
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa

0 commit comments

Comments
 (0)