Skip to content

Commit e17a55b

Browse files
author
Diptorup Deb
committed
Check for expected deprecation warning
1 parent 27b36b9 commit e17a55b

File tree

1 file changed

+39
-27
lines changed

1 file changed

+39
-27
lines changed

numba_dpex/tests/kernel_tests/test_kernel_launch_params.py

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ def vecadd(a, b, c):
2222

2323

2424
def test_1D_global_range_as_int():
25-
k = vecadd[10]
26-
assert k._global_range == [10]
27-
assert k._local_range is None
25+
with pytest.deprecated_call():
26+
k = vecadd[10]
27+
assert k._global_range == [10]
28+
assert k._local_range is None
2829

2930

3031
def test_1D_global_range_as_one_tuple():
@@ -34,43 +35,49 @@ def test_1D_global_range_as_one_tuple():
3435

3536

3637
def test_1D_global_range_as_list():
37-
k = vecadd[[10]]
38-
assert k._global_range == [10]
39-
assert k._local_range is None
38+
with pytest.deprecated_call():
39+
k = vecadd[[10]]
40+
assert k._global_range == [10]
41+
assert k._local_range is None
4042

4143

4244
def test_1D_global_range_and_1D_local_range1():
43-
k = vecadd[[10, 10]]
44-
assert k._global_range == [10]
45-
assert k._local_range == [10]
45+
with pytest.deprecated_call():
46+
k = vecadd[[10, 10]]
47+
assert k._global_range == [10]
48+
assert k._local_range == [10]
4649

4750

4851
def test_1D_global_range_and_1D_local_range2():
49-
k = vecadd[(10,), (10,)]
50-
assert k._global_range == [10]
51-
assert k._local_range == [10]
52+
with pytest.deprecated_call():
53+
k = vecadd[(10,), (10,)]
54+
assert k._global_range == [10]
55+
assert k._local_range == [10]
5256

5357

5458
def test_2D_global_range_and_2D_local_range1():
55-
k = vecadd[(10, 10), (10, 10)]
56-
assert k._global_range == [10, 10]
57-
assert k._local_range == [10, 10]
59+
with pytest.deprecated_call():
60+
k = vecadd[(10, 10), (10, 10)]
61+
assert k._global_range == [10, 10]
62+
assert k._local_range == [10, 10]
5863

5964

6065
def test_2D_global_range_and_2D_local_range2():
61-
k = vecadd[[10, 10], (10, 10)]
62-
assert k._global_range == [10, 10]
63-
assert k._local_range == [10, 10]
66+
with pytest.deprecated_call():
67+
k = vecadd[[10, 10], (10, 10)]
68+
assert k._global_range == [10, 10]
69+
assert k._local_range == [10, 10]
6470

6571

6672
def test_2D_global_range_and_2D_local_range3():
67-
k = vecadd[(10, 10), [10, 10]]
68-
assert k._global_range == [10, 10]
69-
assert k._local_range == [10, 10]
73+
with pytest.deprecated_call():
74+
k = vecadd[(10, 10), [10, 10]]
75+
assert k._global_range == [10, 10]
76+
assert k._local_range == [10, 10]
7077

7178

7279
def test_2D_global_range_and_2D_local_range4():
73-
k = vecadd[[10, 10], [10, 10]]
80+
k = vecadd[dpex.NdRange((10, 10), (10, 10))]
7481
assert k._global_range == [10, 10]
7582
assert k._local_range == [10, 10]
7683

@@ -119,27 +126,32 @@ def test_unknown_global_range_error():
119126

120127
def test_illegal_kernel_launch_arg1():
121128
with pytest.raises(InvalidKernelLaunchArgsError):
122-
vecadd[()]
129+
with pytest.deprecated_call():
130+
vecadd[()]
123131

124132

125133
def test_illegal_kernel_launch_arg2():
126134
with pytest.raises(InvalidKernelLaunchArgsError):
127-
vecadd[10, 10, []]
135+
with pytest.deprecated_call():
136+
vecadd[10, 10, []]
128137

129138

130139
def test_illegal_range_error1():
131140
with pytest.raises(IllegalRangeValueError):
132-
vecadd[[], []]
141+
with pytest.deprecated_call():
142+
vecadd[[], []]
133143

134144

135145
def test_illegal_range_error2():
136146
with pytest.raises(IllegalRangeValueError):
137-
vecadd[[], 10]
147+
with pytest.deprecated_call():
148+
vecadd[[], 10]
138149

139150

140151
def test_illegal_range_error3():
141152
with pytest.raises(IllegalRangeValueError):
142-
vecadd[(), 10]
153+
with pytest.deprecated_call():
154+
vecadd[(), 10]
143155

144156

145157
if __name__ == "__main__":

0 commit comments

Comments
 (0)