Skip to content

Commit f0d854e

Browse files
committed
update TypeError and ValueError tests
1 parent 29bfbf2 commit f0d854e

File tree

2 files changed

+18
-54
lines changed

2 files changed

+18
-54
lines changed

tests/test_mathematical.py

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,7 @@ def test_invalid_dtype(self, dtype):
11991199
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
12001200
dp_out = dpnp.empty(10, dtype=dtype)
12011201

1202-
# TODO: change it to ValueError, when dpctl
1203-
# is being used in internal CI
1204-
with pytest.raises((TypeError, ValueError)):
1202+
with pytest.raises(ValueError):
12051203
dpnp.ceil(dp_array, out=dp_out)
12061204

12071205
@pytest.mark.parametrize("dtype", get_float_dtypes())
@@ -1241,9 +1239,7 @@ def test_invalid_dtype(self, dtype):
12411239
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
12421240
dp_out = dpnp.empty(10, dtype=dtype)
12431241

1244-
# TODO: change it to ValueError, when dpctl
1245-
# is being used in internal CI
1246-
with pytest.raises((TypeError, ValueError)):
1242+
with pytest.raises(ValueError):
12471243
dpnp.floor(dp_array, out=dp_out)
12481244

12491245
@pytest.mark.parametrize("dtype", get_float_dtypes())
@@ -1283,9 +1279,7 @@ def test_invalid_dtype(self, dtype):
12831279
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
12841280
dp_out = dpnp.empty(10, dtype=dtype)
12851281

1286-
# TODO: change it to ValueError, when dpctl
1287-
# is being used in internal CI
1288-
with pytest.raises((TypeError, ValueError)):
1282+
with pytest.raises(ValueError):
12891283
dpnp.trunc(dp_array, out=dp_out)
12901284

12911285
@pytest.mark.parametrize("dtype", get_float_dtypes())
@@ -1336,9 +1330,7 @@ def test_out_dtypes(self, dtype):
13361330
dp_out = dpnp.empty(size, dtype=dpnp.complex64)
13371331
if dtype != dpnp.complex64:
13381332
# dtype of out mismatches types of input arrays
1339-
# TODO: change it to ValueError, when dpctl
1340-
# is being used in internal CI
1341-
with pytest.raises((TypeError, ValueError)):
1333+
with pytest.raises(ValueError):
13421334
dpnp.add(dp_array1, dp_array2, out=dp_out)
13431335

13441336
# allocate new out with expected type
@@ -1435,9 +1427,7 @@ def test_out_dtypes(self, dtype):
14351427
check_dtype = True
14361428
if dtype != dpnp.complex64:
14371429
# dtype of out mismatches types of input arrays
1438-
# TODO: change it to ValueError, when dpctl
1439-
# is being used in internal CI
1440-
with pytest.raises((TypeError, ValueError)):
1430+
with pytest.raises(ValueError):
14411431
dpnp.divide(dp_array1, dp_array2, out=dp_out)
14421432

14431433
# allocate new out with expected type
@@ -1538,9 +1528,7 @@ def test_out_dtypes(self, dtype):
15381528
dp_out = dpnp.empty(size, dtype=dpnp.complex64)
15391529
if dtype != dpnp.complex64:
15401530
# dtype of out mismatches types of input arrays
1541-
# TODO: change it to ValueError, when dpctl
1542-
# is being used in internal CI
1543-
with pytest.raises((TypeError, ValueError)):
1531+
with pytest.raises(ValueError):
15441532
dpnp.floor_divide(dp_array1, dp_array2, out=dp_out)
15451533

15461534
# allocate new out with expected type
@@ -1800,9 +1788,7 @@ def test_out_dtypes(self, dtype):
18001788
dp_out = dpnp.empty(size, dtype=dpnp.float32)
18011789
if dtype != dpnp.float32:
18021790
# dtype of out mismatches types of input arrays
1803-
# TODO: change it to ValueError, when dpctl
1804-
# is being used in internal CI
1805-
with pytest.raises((TypeError, ValueError)):
1791+
with pytest.raises(ValueError):
18061792
dpnp.hypot(dp_array1, dp_array2, out=dp_out)
18071793

18081794
# allocate new out with expected type
@@ -1970,9 +1956,7 @@ def test_out_dtypes(self, dtype):
19701956
dp_out = dpnp.empty(size, dtype=dpnp.complex64)
19711957
if dtype != dpnp.complex64:
19721958
# dtype of out mismatches types of input arrays
1973-
# TODO: change it to ValueError, when dpctl
1974-
# is being used in internal CI
1975-
with pytest.raises((TypeError, ValueError)):
1959+
with pytest.raises(ValueError):
19761960
dpnp.maximum(dp_array1, dp_array2, out=dp_out)
19771961

19781962
# allocate new out with expected type
@@ -2053,9 +2037,7 @@ def test_out_dtypes(self, dtype):
20532037
dp_out = dpnp.empty(size, dtype=dpnp.complex64)
20542038
if dtype != dpnp.complex64:
20552039
# dtype of out mismatches types of input arrays
2056-
# TODO: change it to ValueError, when dpctl
2057-
# is being used in internal CI
2058-
with pytest.raises((TypeError, ValueError)):
2040+
with pytest.raises(ValueError):
20592041
dpnp.minimum(dp_array1, dp_array2, out=dp_out)
20602042

20612043
# allocate new out with expected type
@@ -2136,9 +2118,7 @@ def test_out_dtypes(self, dtype):
21362118
dp_out = dpnp.empty(size, dtype=dpnp.complex64)
21372119
if dtype != dpnp.complex64:
21382120
# dtype of out mismatches types of input arrays
2139-
# TODO: change it to ValueError, when dpctl
2140-
# is being used in internal CI
2141-
with pytest.raises((TypeError, ValueError)):
2121+
with pytest.raises(ValueError):
21422122
dpnp.multiply(dp_array1, dp_array2, out=dp_out)
21432123

21442124
# allocate new out with expected type
@@ -2233,9 +2213,7 @@ def test_out_dtypes(self, dtype):
22332213
dp_out = dpnp.empty(size, dtype=dpnp.complex64)
22342214
if dtype != dpnp.complex64:
22352215
# dtype of out mismatches types of input arrays
2236-
# TODO: change it to ValueError, when dpctl
2237-
# is being used in internal CI
2238-
with pytest.raises((TypeError, ValueError)):
2216+
with pytest.raises(ValueError):
22392217
dpnp.power(dp_array1, dp_array2, out=dp_out)
22402218

22412219
# allocate new out with expected type

tests/test_umath.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ def test_invalid_dtype(self, func_params, dtype):
209209
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
210210
dp_out = dpnp.empty(10, dtype=dtype)
211211

212-
# TODO: change it to ValueError, when dpctl
213-
# is being used in internal CI
214-
with pytest.raises((TypeError, ValueError)):
212+
with pytest.raises(ValueError):
215213
getattr(dpnp, func_name)(dp_array, out=dp_out)
216214

217215
@pytest.mark.parametrize(
@@ -256,9 +254,7 @@ def test_invalid_dtype(self, dtype):
256254
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
257255
dp_out = dpnp.empty(10, dtype=dtype)
258256

259-
# TODO: change it to ValueError, when dpctl
260-
# is being used in internal CI
261-
with pytest.raises((TypeError, ValueError)):
257+
with pytest.raises(ValueError):
262258
dpnp.cbrt(dp_array, out=dp_out)
263259

264260
@pytest.mark.parametrize(
@@ -295,9 +291,7 @@ def test_invalid_dtype(self, dtype):
295291
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
296292
dp_out = dpnp.empty(10, dtype=dtype)
297293

298-
# TODO: change it to ValueError, when dpctl
299-
# is being used in internal CI
300-
with pytest.raises((TypeError, ValueError)):
294+
with pytest.raises(ValueError):
301295
dpnp.rsqrt(dp_array, out=dp_out)
302296

303297
@pytest.mark.parametrize(
@@ -338,9 +332,7 @@ def test_invalid_dtype(self, dtype):
338332
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
339333
dp_out = dpnp.empty(10, dtype=dtype)
340334

341-
# TODO: change it to ValueError, when dpctl
342-
# is being used in internal CI
343-
with pytest.raises((TypeError, ValueError)):
335+
with pytest.raises(ValueError):
344336
dpnp.square(dp_array, out=dp_out)
345337

346338
@pytest.mark.parametrize(
@@ -423,9 +415,7 @@ def test_invalid_dtype(self, dtype):
423415
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
424416
dp_out = dpnp.empty(10, dtype=dtype)
425417

426-
# TODO: change it to ValueError, when dpctl
427-
# is being used in internal CI
428-
with pytest.raises((TypeError, ValueError)):
418+
with pytest.raises(ValueError):
429419
dpnp.arctan2(dp_array, dp_array, out=dp_out)
430420

431421
@pytest.mark.parametrize(
@@ -461,9 +451,7 @@ def test_invalid_dtype(self, dtype):
461451
dpnp_dtype = get_all_dtypes(no_complex=True, no_none=True)[-1]
462452
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
463453
dp_out = dpnp.empty(10, dtype=dtype)
464-
# TODO: change it to ValueError, when dpctl
465-
# is being used in internal CI
466-
with pytest.raises((TypeError, ValueError)):
454+
with pytest.raises(ValueError):
467455
dpnp.copysign(dp_array, dp_array, out=dp_out)
468456

469457
@pytest.mark.parametrize(
@@ -499,9 +487,7 @@ def test_invalid_dtype(self, dtype):
499487
dpnp_dtype = get_all_dtypes(no_complex=True, no_none=True)[-1]
500488
dp_array = dpnp.arange(10, dtype=dpnp_dtype)
501489
dp_out = dpnp.empty(10, dtype=dtype)
502-
# TODO: change it to ValueError, when dpctl
503-
# is being used in internal CI
504-
with pytest.raises((TypeError, ValueError)):
490+
with pytest.raises(ValueError):
505491
dpnp.logaddexp(dp_array, dp_array, out=dp_out)
506492

507493
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)