Skip to content

Commit 2a749f6

Browse files
committed
Removed some redundant and obsolete tests
- Removed from test_floor_ceil_trunc, test_hyperbolic, test_trigonometric, and test_logaddexp - These tests would fail on GPU but never run on CPU, and therefore were not impacting the coverage - These tests focused on aspects of the BinaryElementwiseFunc class rather than the behavior of the operator
1 parent 3371abd commit 2a749f6

File tree

4 files changed

+0
-226
lines changed

4 files changed

+0
-226
lines changed

dpctl/tests/elementwise/test_floor_ceil_trunc.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
assert_raises_regex,
2525
)
2626

27-
import dpctl
2827
import dpctl.tensor as dpt
2928
from dpctl.tests.helper import get_queue_or_skip, skip_if_dtype_not_supported
3029

@@ -92,45 +91,6 @@ def test_floor_ceil_trunc_order(np_call, dpt_call, dtype):
9291
assert_allclose(dpt.asnumpy(Y), expected_Y)
9392

9493

95-
@pytest.mark.parametrize("dpt_call", [dpt.floor, dpt.ceil, dpt.trunc])
96-
def test_floor_ceil_trunc_errors(dpt_call):
97-
get_queue_or_skip()
98-
try:
99-
gpu_queue = dpctl.SyclQueue("gpu")
100-
except dpctl.SyclQueueCreationError:
101-
pytest.skip("SyclQueue('gpu') failed, skipping")
102-
try:
103-
cpu_queue = dpctl.SyclQueue("cpu")
104-
except dpctl.SyclQueueCreationError:
105-
pytest.skip("SyclQueue('cpu') failed, skipping")
106-
107-
x = dpt.zeros(2, sycl_queue=gpu_queue)
108-
y = dpt.empty_like(x, sycl_queue=cpu_queue)
109-
assert_raises_regex(
110-
TypeError,
111-
"Input and output allocation queues are not compatible",
112-
dpt_call,
113-
x,
114-
y,
115-
)
116-
117-
x = dpt.zeros(2)
118-
y = dpt.empty(3)
119-
assert_raises_regex(
120-
TypeError,
121-
"The shape of input and output arrays are inconsistent",
122-
dpt_call,
123-
x,
124-
y,
125-
)
126-
127-
x = dpt.zeros(2, dtype="float32")
128-
y = np.empty_like(x)
129-
assert_raises_regex(
130-
TypeError, "output array must be of usm_ndarray type", dpt_call, x, y
131-
)
132-
133-
13494
@pytest.mark.parametrize("dpt_call", [dpt.floor, dpt.ceil, dpt.trunc])
13595
@pytest.mark.parametrize("dtype", _real_value_dtypes)
13696
def test_floor_ceil_trunc_error_dtype(dpt_call, dtype):

dpctl/tests/elementwise/test_hyperbolic.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import pytest
2121
from numpy.testing import assert_allclose, assert_raises_regex
2222

23-
import dpctl
2423
import dpctl.tensor as dpt
2524
from dpctl.tests.helper import get_queue_or_skip, skip_if_dtype_not_supported
2625

@@ -178,45 +177,6 @@ def test_hyper_order(np_call, dpt_call, dtype):
178177
assert_allclose(dpt.asnumpy(Y), expected_Y, atol=tol, rtol=tol)
179178

180179

181-
@pytest.mark.parametrize("callable", _dpt_funcs)
182-
def test_hyper_errors(callable):
183-
get_queue_or_skip()
184-
try:
185-
gpu_queue = dpctl.SyclQueue("gpu")
186-
except dpctl.SyclQueueCreationError:
187-
pytest.skip("SyclQueue('gpu') failed, skipping")
188-
try:
189-
cpu_queue = dpctl.SyclQueue("cpu")
190-
except dpctl.SyclQueueCreationError:
191-
pytest.skip("SyclQueue('cpu') failed, skipping")
192-
193-
x = dpt.ones(2, sycl_queue=gpu_queue)
194-
y = dpt.empty_like(x, sycl_queue=cpu_queue)
195-
assert_raises_regex(
196-
TypeError,
197-
"Input and output allocation queues are not compatible",
198-
callable,
199-
x,
200-
y,
201-
)
202-
203-
x = dpt.ones(2)
204-
y = dpt.empty(3)
205-
assert_raises_regex(
206-
TypeError,
207-
"The shape of input and output arrays are inconsistent",
208-
callable,
209-
x,
210-
y,
211-
)
212-
213-
x = dpt.ones(2, dtype="float32")
214-
y = np.empty_like(x)
215-
assert_raises_regex(
216-
TypeError, "output array must be of usm_ndarray type", callable, x, y
217-
)
218-
219-
220180
@pytest.mark.parametrize("callable", _dpt_funcs)
221181
@pytest.mark.parametrize("dtype", _all_dtypes)
222182
def test_hyper_error_dtype(callable, dtype):

dpctl/tests/elementwise/test_logaddexp.py

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import dpctl
2424
import dpctl.tensor as dpt
2525
from dpctl.tests.helper import get_queue_or_skip, skip_if_dtype_not_supported
26-
from dpctl.utils import ExecutionPlacementError
2726

2827
from .utils import _compare_dtypes, _no_complex_dtypes, _usm_types
2928

@@ -178,111 +177,6 @@ def test_logaddexp_python_scalar(arr_dt):
178177
assert isinstance(R, dpt.usm_ndarray)
179178

180179

181-
class MockArray:
182-
def __init__(self, arr):
183-
self.data_ = arr
184-
185-
@property
186-
def __sycl_usm_array_interface__(self):
187-
return self.data_.__sycl_usm_array_interface__
188-
189-
190-
def test_logaddexp_mock_array():
191-
get_queue_or_skip()
192-
a = dpt.arange(10)
193-
b = dpt.ones(10)
194-
c = MockArray(b)
195-
r = dpt.logaddexp(a, c)
196-
assert isinstance(r, dpt.usm_ndarray)
197-
198-
199-
def test_logaddexp_canary_mock_array():
200-
get_queue_or_skip()
201-
a = dpt.arange(10)
202-
203-
class Canary:
204-
def __init__(self):
205-
pass
206-
207-
@property
208-
def __sycl_usm_array_interface__(self):
209-
return None
210-
211-
c = Canary()
212-
with pytest.raises(ValueError):
213-
dpt.logaddexp(a, c)
214-
215-
216-
def test_logaddexp_errors():
217-
get_queue_or_skip()
218-
try:
219-
gpu_queue = dpctl.SyclQueue("gpu")
220-
except dpctl.SyclQueueCreationError:
221-
pytest.skip("SyclQueue('gpu') failed, skipping")
222-
try:
223-
cpu_queue = dpctl.SyclQueue("cpu")
224-
except dpctl.SyclQueueCreationError:
225-
pytest.skip("SyclQueue('cpu') failed, skipping")
226-
227-
ar1 = dpt.ones(2, dtype="float32", sycl_queue=gpu_queue)
228-
ar2 = dpt.ones_like(ar1, sycl_queue=gpu_queue)
229-
y = dpt.empty_like(ar1, sycl_queue=cpu_queue)
230-
assert_raises_regex(
231-
TypeError,
232-
"Input and output allocation queues are not compatible",
233-
dpt.logaddexp,
234-
ar1,
235-
ar2,
236-
y,
237-
)
238-
239-
ar1 = dpt.ones(2, dtype="float32")
240-
ar2 = dpt.ones_like(ar1, dtype="int32")
241-
y = dpt.empty(3)
242-
assert_raises_regex(
243-
TypeError,
244-
"The shape of input and output arrays are inconsistent",
245-
dpt.logaddexp,
246-
ar1,
247-
ar2,
248-
y,
249-
)
250-
251-
ar1 = dpt.ones(2, dtype="float32")
252-
ar2 = dpt.ones_like(ar1, dtype="int32")
253-
y = ar1
254-
assert_raises_regex(
255-
TypeError,
256-
"Input and output arrays have memory overlap",
257-
dpt.logaddexp,
258-
ar1,
259-
ar2,
260-
y,
261-
)
262-
263-
ar1 = np.ones(2, dtype="float32")
264-
ar2 = np.ones_like(ar1, dtype="int32")
265-
assert_raises_regex(
266-
ExecutionPlacementError,
267-
"Execution placement can not be unambiguously inferred.*",
268-
dpt.logaddexp,
269-
ar1,
270-
ar2,
271-
)
272-
273-
ar1 = dpt.ones(2, dtype="float32")
274-
ar2 = dpt.ones_like(ar1, dtype="int32")
275-
y = np.empty_like(ar1)
276-
assert_raises_regex(
277-
TypeError,
278-
"output array must be of usm_ndarray type",
279-
dpt.logaddexp,
280-
ar1,
281-
ar2,
282-
y,
283-
)
284-
285-
286180
@pytest.mark.parametrize("dtype", _no_complex_dtypes)
287181
def test_logaddexp_dtype_error(
288182
dtype,

dpctl/tests/elementwise/test_trigonometric.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import pytest
2121
from numpy.testing import assert_allclose, assert_raises_regex
2222

23-
import dpctl
2423
import dpctl.tensor as dpt
2524
from dpctl.tests.helper import get_queue_or_skip, skip_if_dtype_not_supported
2625

@@ -175,45 +174,6 @@ def test_trig_order(np_call, dpt_call, dtype):
175174
assert_allclose(dpt.asnumpy(Y), expected_Y, atol=tol, rtol=tol)
176175

177176

178-
@pytest.mark.parametrize("callable", _dpt_funcs)
179-
def test_trig_errors(callable):
180-
get_queue_or_skip()
181-
try:
182-
gpu_queue = dpctl.SyclQueue("gpu")
183-
except dpctl.SyclQueueCreationError:
184-
pytest.skip("SyclQueue('gpu') failed, skipping")
185-
try:
186-
cpu_queue = dpctl.SyclQueue("cpu")
187-
except dpctl.SyclQueueCreationError:
188-
pytest.skip("SyclQueue('cpu') failed, skipping")
189-
190-
x = dpt.zeros(2, sycl_queue=gpu_queue)
191-
y = dpt.empty_like(x, sycl_queue=cpu_queue)
192-
assert_raises_regex(
193-
TypeError,
194-
"Input and output allocation queues are not compatible",
195-
callable,
196-
x,
197-
y,
198-
)
199-
200-
x = dpt.zeros(2)
201-
y = dpt.empty(3)
202-
assert_raises_regex(
203-
TypeError,
204-
"The shape of input and output arrays are inconsistent",
205-
callable,
206-
x,
207-
y,
208-
)
209-
210-
x = dpt.zeros(2, dtype="float32")
211-
y = np.empty_like(x)
212-
assert_raises_regex(
213-
TypeError, "output array must be of usm_ndarray type", callable, x, y
214-
)
215-
216-
217177
@pytest.mark.parametrize("callable", _dpt_funcs)
218178
@pytest.mark.parametrize("dtype", _all_dtypes)
219179
def test_trig_error_dtype(callable, dtype):

0 commit comments

Comments
 (0)