Skip to content

Commit ee883e3

Browse files
author
AzeezIsh
committed
Adhered to checkstyle requirements.
1 parent e899f6c commit ee883e3

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tests/test_inclusive.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import arrayfire_wrapper.dtypes as dtype
44
import arrayfire_wrapper.lib as wrapper
5-
from tests.utility_functions import check_type_supported, get_all_types, get_float_types, get_real_types
5+
from tests.utility_functions import check_type_supported, get_all_types, get_real_types
6+
67

78
@pytest.mark.parametrize(
89
"shape",
@@ -24,6 +25,7 @@ def test_accum_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
2425
result = wrapper.accum(values, 0)
2526
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
2627

28+
2729
@pytest.mark.parametrize(
2830
"dim",
2931
[
@@ -39,6 +41,8 @@ def test_accum_dims(dim: int) -> None:
3941
values = wrapper.randu(shape, dtype.f32)
4042
result = wrapper.accum(values, dim)
4143
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
44+
45+
4246
@pytest.mark.parametrize(
4347
"invdim",
4448
[
@@ -54,6 +58,7 @@ def test_accum_invdims(invdim: int) -> None:
5458
result = wrapper.accum(values, invdim)
5559
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
5660

61+
5762
@pytest.mark.parametrize(
5863
"shape",
5964
[
@@ -74,6 +79,7 @@ def test_scan_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
7479
result = wrapper.scan(values, 0, wrapper.BinaryOperator.ADD, True)
7580
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}, dtype {dtype_name}" # noqa
7681

82+
7783
@pytest.mark.parametrize(
7884
"dim",
7985
[
@@ -89,6 +95,8 @@ def test_scan_dims(dim: int) -> None:
8995
values = wrapper.randu(shape, dtype.f32)
9096
result = wrapper.scan(values, dim, wrapper.BinaryOperator.ADD, True)
9197
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for dimension: {dim}" # noqa
98+
99+
92100
@pytest.mark.parametrize(
93101
"invdim",
94102
[
@@ -103,6 +111,8 @@ def test_scan_invdims(invdim: int) -> None:
103111
values = wrapper.randu(shape, dtype.f32)
104112
result = wrapper.scan(values, invdim, wrapper.BinaryOperator.ADD, True)
105113
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
114+
115+
106116
@pytest.mark.parametrize(
107117
"binaryOp",
108118
[
@@ -119,6 +129,7 @@ def test_scan_binaryOp(binaryOp: int) -> None:
119129
result = wrapper.scan(values, 0, wrapper.BinaryOperator(binaryOp), True)
120130
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for operation: {binaryOp}" # noqa
121131

132+
122133
@pytest.mark.parametrize(
123134
"shape",
124135
[
@@ -133,12 +144,19 @@ def test_scan_binaryOp(binaryOp: int) -> None:
133144
def test_scan_by_key_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
134145
"""Test scan_by_key operation across all supported data types."""
135146
check_type_supported(dtype_name)
136-
if dtype_name == dtype.f16 or dtype_name == dtype.f32 or dtype_name == dtype.uint16 or dtype_name == dtype.uint8 or dtype_name == dtype.int16:
147+
if (
148+
dtype_name == dtype.f16
149+
or dtype_name == dtype.f32
150+
or dtype_name == dtype.uint16
151+
or dtype_name == dtype.uint8
152+
or dtype_name == dtype.int16
153+
):
137154
pytest.skip()
138155
values = wrapper.randu(shape, dtype_name)
139156
result = wrapper.scan_by_key(values, values, 0, wrapper.BinaryOperator.ADD, True)
140157
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}, dtype {dtype_name}" # noqa
141158

159+
142160
@pytest.mark.parametrize(
143161
"dim",
144162
[
@@ -155,6 +173,7 @@ def test_scan_by_key_dims(dim: int) -> None:
155173
result = wrapper.scan_by_key(values, values, dim, wrapper.BinaryOperator.ADD, True)
156174
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for dimension: {dim}" # noqa
157175

176+
158177
@pytest.mark.parametrize(
159178
"invdim",
160179
[
@@ -169,6 +188,8 @@ def test_scan_by_key_invdims(invdim: int) -> None:
169188
values = wrapper.randu(shape, dtype.int32)
170189
result = wrapper.scan_by_key(values, values, invdim, wrapper.BinaryOperator.ADD, True)
171190
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape}" # noqa
191+
192+
172193
@pytest.mark.parametrize(
173194
"binaryOp",
174195
[
@@ -185,6 +206,7 @@ def test_scan_by_key_binaryOp(binaryOp: int) -> None:
185206
result = wrapper.scan_by_key(values, values, 0, wrapper.BinaryOperator(binaryOp), True)
186207
assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for operation: {binaryOp}" # noqa
187208

209+
188210
@pytest.mark.parametrize(
189211
"shape",
190212
[

0 commit comments

Comments
 (0)