We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a729ac commit 6334991Copy full SHA for 6334991
dpnp/tests/test_memory.py
@@ -0,0 +1,28 @@
1
+import dpctl.tensor as dpt
2
+import numpy
3
+import pytest
4
+
5
+import dpnp
6
+import dpnp.memory as dpm
7
8
9
+class IntUsmData(dpt.usm_ndarray):
10
+ """Class that overrides `usm_data` property in `dpt.usm_ndarray`."""
11
12
+ @property
13
+ def usm_data(self):
14
+ return 1
15
16
17
+class TestCreateData:
18
+ @pytest.mark.parametrize("x", [numpy.ones(4), dpnp.zeros(2)])
19
+ def test_wrong_input_type(self, x):
20
+ with pytest.raises(TypeError):
21
+ dpm.create_data(x)
22
23
+ def test_wrong_usm_data(self):
24
+ a = dpt.ones(10)
25
+ d = IntUsmData(a.shape, buffer=a)
26
27
28
+ dpm.create_data(d)
0 commit comments