Exclude code from coverage#2272
Conversation
|
Array API standard conformance tests for dpnp=0.17.0dev4=py312he4f9c94_19 ran successfully. |
antonwolfy
left a comment
There was a problem hiding this comment.
LGTM! Thank you @vlad-perevezentsev
|
Regarding the rest of the uncovered lines
dpnp/dpnp_iface_sorting.py
|
It is not actually true. It might be covered, like: a = dpnp.ones(10)
b = numpy.ones(10)
b @ a
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[4], line 1
----> 1 b @ a
File ~/code/dpnp/dpnp/dpnp_array.py:547, in dpnp_array.__rmatmul__(self, other)
545 def __rmatmul__(self, other):
546 """Return ``value@self``."""
--> 547 return dpnp.matmul(other, self)
File ~/code/dpnp/dpnp/dpnp_iface_linearalgebra.py:857, in matmul(x1, x2, out, casting, order, dtype, subok, signature, axes, axis)
852 if axis is not None:
853 raise NotImplementedError(
854 "axis keyword argument is only supported by its default value."
855 )
--> 857 return dpnp_matmul(
858 x1,
859 x2,
860 out=out,
861 casting=casting,
862 order=order,
863 dtype=dtype,
864 axes=axes,
865 )
File ~/code/dpnp/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py:765, in dpnp_matmul(x1, x2, out, casting, order, dtype, axes)
746 def dpnp_matmul(
747 x1,
748 x2,
(...)
755 axes=None,
756 ):
757 """
758 Return the matrix product of two arrays.
759
(...)
762
763 """
--> 765 dpnp.check_supported_arrays_type(x1, x2)
766 res_usm_type, exec_q = get_usm_allocations([x1, x2])
767 _validate_out_array(out, exec_q)
File ~/code/dpnp/dpnp/dpnp_iface.py:400, in check_supported_arrays_type(scalar_type, all_scalars, *arrays)
397 if scalar_type and dpnp.isscalar(a):
398 continue
--> 400 raise TypeError(
401 f"An array must be any of supported type, but got {type(a)}"
402 )
404 if len(arrays) > 0 and not (all_scalars or any_is_array):
405 raise TypeError(
406 "At least one input must be of supported array type, "
407 "but got all scalars."
408 )
TypeError: An array must be any of supported type, but got <class 'numpy.ndarray'>As you can see from the call stack there is For testing of positive use case you need something like: a = dpnp.ones(10)
b = dpnp.ones(10)
class A(dpnp.ndarray):
def __init__(self, x):
self._array_obj = x.get_array()
def __matmul__(self, other):
return NotImplemented
a1 = A(a)
a1 @ b
# Out: array(10.) |
We need to add tests for them. It is an interface functions. |
|
The rest uncovered functions can be left unchanged, because we will rework them when remove the backend. |
This PR continues #2268 and suggests excluding some lines of code from coverage using
pragma:: no coverto increase the coverage statistic