Skip to content

Commit cf7d9bf

Browse files
Change to test_complex_special_cases
The change is to suppress RuntimeWarning arising from within assert_allclose utility.
1 parent 7c94a33 commit cf7d9bf

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

dpctl/tests/elementwise/test_complex.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616

1717
import itertools
18+
import warnings
1819

1920
import numpy as np
2021
import pytest
@@ -203,12 +204,18 @@ def test_complex_special_cases(dtype):
203204
Xc = dpt.asarray(Xc_np, dtype=dtype, sycl_queue=q)
204205

205206
tol = 8 * dpt.finfo(dtype).resolution
206-
assert_allclose(
207-
dpt.asnumpy(dpt.real(Xc)), np.real(Xc_np), atol=tol, rtol=tol
208-
)
209-
assert_allclose(
210-
dpt.asnumpy(dpt.imag(Xc)), np.imag(Xc_np), atol=tol, rtol=tol
211-
)
212-
assert_allclose(
213-
dpt.asnumpy(dpt.conj(Xc)), np.conj(Xc_np), atol=tol, rtol=tol
214-
)
207+
208+
actual = dpt.real(Xc)
209+
expected = np.real(Xc_np)
210+
assert_allclose(dpt.asnumpy(actual), expected, atol=tol, rtol=tol)
211+
212+
actual = dpt.imag(Xc)
213+
expected = np.imag(Xc_np)
214+
assert_allclose(dpt.asnumpy(actual), expected, atol=tol, rtol=tol)
215+
216+
actual = dpt.conj(Xc)
217+
expected = np.conj(Xc_np)
218+
219+
with warnings.catch_warnings():
220+
warnings.simplefilter("ignore")
221+
assert_allclose(dpt.asnumpy(actual), expected, atol=tol, rtol=tol)

0 commit comments

Comments
 (0)