Skip to content

Commit 591866e

Browse files
authored
Merge 6150308 into 807179a
2 parents 807179a + 6150308 commit 591866e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

dpnp/dpnp_array.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ def __and__(self, other):
192192
# '__array_prepare__',
193193
# '__array_priority__',
194194
# '__array_struct__',
195-
# '__array_ufunc__',
195+
196+
__array_ufunc__ = None
197+
196198
# '__array_wrap__',
197199

198200
def __array_namespace__(self, /, *, api_version=None):

dpnp/tests/test_ndarray.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,27 @@ def test_wrong_api_version(self, api_version):
150150
)
151151

152152

153+
class TestArrayUfunc:
154+
def test_add(self):
155+
a = numpy.ones(10)
156+
b = dpnp.ones(10)
157+
msg = "An array must be any of supported type"
158+
159+
with assert_raises_regex(TypeError, msg):
160+
a + b
161+
162+
with assert_raises_regex(TypeError, msg):
163+
b + a
164+
165+
def test_add_inplace(self):
166+
a = numpy.ones(10)
167+
b = dpnp.ones(10)
168+
with assert_raises_regex(
169+
TypeError, "operand 'dpnp_array' does not support ufuncs"
170+
):
171+
a += b
172+
173+
153174
class TestItem:
154175
@pytest.mark.parametrize("args", [2, 7, (1, 2), (2, 0)])
155176
def test_basic(self, args):

0 commit comments

Comments
 (0)