Skip to content

Commit 0ed66ef

Browse files
committed
Rudimentary in-place op special case tests
1 parent d1d42ab commit 0ed66ef

13 files changed

+1395
-63
lines changed

array_api_tests/function_stubs/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
__all__ = []
1111

12-
from .array_object import __abs__, __add__, __and__, __array_namespace__, __bool__, __dlpack__, __dlpack_device__, __eq__, __float__, __floordiv__, __ge__, __getitem__, __gt__, __index__, __int__, __invert__, __le__, __lshift__, __lt__, __matmul__, __mod__, __mul__, __ne__, __neg__, __or__, __pos__, __pow__, __rshift__, __setitem__, __sub__, __truediv__, __xor__, to_device, dtype, device, mT, ndim, shape, size, T
12+
from .array_object import __abs__, __add__, __and__, __array_namespace__, __bool__, __dlpack__, __dlpack_device__, __eq__, __float__, __floordiv__, __ge__, __getitem__, __gt__, __index__, __int__, __invert__, __le__, __lshift__, __lt__, __matmul__, __mod__, __mul__, __ne__, __neg__, __or__, __pos__, __pow__, __rshift__, __setitem__, __sub__, __truediv__, __xor__, to_device, __iadd__, __radd__, __iand__, __rand__, __ifloordiv__, __rfloordiv__, __ilshift__, __rlshift__, __imatmul__, __rmatmul__, __imod__, __rmod__, __imul__, __rmul__, __ior__, __ror__, __ipow__, __rpow__, __irshift__, __rrshift__, __isub__, __rsub__, __itruediv__, __rtruediv__, __ixor__, __rxor__, dtype, device, mT, ndim, shape, size, T
1313

14-
__all__ += ['__abs__', '__add__', '__and__', '__array_namespace__', '__bool__', '__dlpack__', '__dlpack_device__', '__eq__', '__float__', '__floordiv__', '__ge__', '__getitem__', '__gt__', '__index__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__matmul__', '__mod__', '__mul__', '__ne__', '__neg__', '__or__', '__pos__', '__pow__', '__rshift__', '__setitem__', '__sub__', '__truediv__', '__xor__', 'to_device', 'dtype', 'device', 'mT', 'ndim', 'shape', 'size', 'T']
14+
__all__ += ['__abs__', '__add__', '__and__', '__array_namespace__', '__bool__', '__dlpack__', '__dlpack_device__', '__eq__', '__float__', '__floordiv__', '__ge__', '__getitem__', '__gt__', '__index__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__matmul__', '__mod__', '__mul__', '__ne__', '__neg__', '__or__', '__pos__', '__pow__', '__rshift__', '__setitem__', '__sub__', '__truediv__', '__xor__', 'to_device', '__iadd__', '__radd__', '__iand__', '__rand__', '__ifloordiv__', '__rfloordiv__', '__ilshift__', '__rlshift__', '__imatmul__', '__rmatmul__', '__imod__', '__rmod__', '__imul__', '__rmul__', '__ior__', '__ror__', '__ipow__', '__rpow__', '__irshift__', '__rrshift__', '__isub__', '__rsub__', '__itruediv__', '__rtruediv__', '__ixor__', '__rxor__', 'dtype', 'device', 'mT', 'ndim', 'shape', 'size', 'T']
1515

1616
from .constants import e, inf, nan, pi
1717

@@ -41,9 +41,9 @@
4141

4242
__all__ += ['argmax', 'argmin', 'nonzero', 'where']
4343

44-
from .set_functions import unique_all, unique_inverse, unique_values
44+
from .set_functions import unique_all, unique_counts, unique_inverse, unique_values
4545

46-
__all__ += ['unique_all', 'unique_inverse', 'unique_values']
46+
__all__ += ['unique_all', 'unique_counts', 'unique_inverse', 'unique_values']
4747

4848
from .sorting_functions import argsort, sort
4949

array_api_tests/function_stubs/array_object.py

+157-1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,162 @@ def to_device(self: array, device: device, /, *, stream: Optional[Union[int, Any
211211
"""
212212
pass
213213

214+
def __iadd__(self: array, other: Union[int, float, array], /) -> array:
215+
"""
216+
Note: __iadd__ is a method of the array object.
217+
"""
218+
pass
219+
220+
def __radd__(self: array, other: Union[int, float, array], /) -> array:
221+
"""
222+
Note: __radd__ is a method of the array object.
223+
"""
224+
pass
225+
226+
def __iand__(self: array, other: Union[int, bool, array], /) -> array:
227+
"""
228+
Note: __iand__ is a method of the array object.
229+
"""
230+
pass
231+
232+
def __rand__(self: array, other: Union[int, bool, array], /) -> array:
233+
"""
234+
Note: __rand__ is a method of the array object.
235+
"""
236+
pass
237+
238+
def __ifloordiv__(self: array, other: Union[int, float, array], /) -> array:
239+
"""
240+
Note: __ifloordiv__ is a method of the array object.
241+
"""
242+
pass
243+
244+
def __rfloordiv__(self: array, other: Union[int, float, array], /) -> array:
245+
"""
246+
Note: __rfloordiv__ is a method of the array object.
247+
"""
248+
pass
249+
250+
def __ilshift__(self: array, other: Union[int, array], /) -> array:
251+
"""
252+
Note: __ilshift__ is a method of the array object.
253+
"""
254+
pass
255+
256+
def __rlshift__(self: array, other: Union[int, array], /) -> array:
257+
"""
258+
Note: __rlshift__ is a method of the array object.
259+
"""
260+
pass
261+
262+
def __imatmul__(self: array, other: array, /) -> array:
263+
"""
264+
Note: __imatmul__ is a method of the array object.
265+
"""
266+
pass
267+
268+
def __rmatmul__(self: array, other: array, /) -> array:
269+
"""
270+
Note: __rmatmul__ is a method of the array object.
271+
"""
272+
pass
273+
274+
def __imod__(self: array, other: Union[int, float, array], /) -> array:
275+
"""
276+
Note: __imod__ is a method of the array object.
277+
"""
278+
pass
279+
280+
def __rmod__(self: array, other: Union[int, float, array], /) -> array:
281+
"""
282+
Note: __rmod__ is a method of the array object.
283+
"""
284+
pass
285+
286+
def __imul__(self: array, other: Union[int, float, array], /) -> array:
287+
"""
288+
Note: __imul__ is a method of the array object.
289+
"""
290+
pass
291+
292+
def __rmul__(self: array, other: Union[int, float, array], /) -> array:
293+
"""
294+
Note: __rmul__ is a method of the array object.
295+
"""
296+
pass
297+
298+
def __ior__(self: array, other: Union[int, bool, array], /) -> array:
299+
"""
300+
Note: __ior__ is a method of the array object.
301+
"""
302+
pass
303+
304+
def __ror__(self: array, other: Union[int, bool, array], /) -> array:
305+
"""
306+
Note: __ror__ is a method of the array object.
307+
"""
308+
pass
309+
310+
def __ipow__(self: array, other: Union[int, float, array], /) -> array:
311+
"""
312+
Note: __ipow__ is a method of the array object.
313+
"""
314+
pass
315+
316+
def __rpow__(self: array, other: Union[int, float, array], /) -> array:
317+
"""
318+
Note: __rpow__ is a method of the array object.
319+
"""
320+
pass
321+
322+
def __irshift__(self: array, other: Union[int, array], /) -> array:
323+
"""
324+
Note: __irshift__ is a method of the array object.
325+
"""
326+
pass
327+
328+
def __rrshift__(self: array, other: Union[int, array], /) -> array:
329+
"""
330+
Note: __rrshift__ is a method of the array object.
331+
"""
332+
pass
333+
334+
def __isub__(self: array, other: Union[int, float, array], /) -> array:
335+
"""
336+
Note: __isub__ is a method of the array object.
337+
"""
338+
pass
339+
340+
def __rsub__(self: array, other: Union[int, float, array], /) -> array:
341+
"""
342+
Note: __rsub__ is a method of the array object.
343+
"""
344+
pass
345+
346+
def __itruediv__(self: array, other: Union[int, float, array], /) -> array:
347+
"""
348+
Note: __itruediv__ is a method of the array object.
349+
"""
350+
pass
351+
352+
def __rtruediv__(self: array, other: Union[int, float, array], /) -> array:
353+
"""
354+
Note: __rtruediv__ is a method of the array object.
355+
"""
356+
pass
357+
358+
def __ixor__(self: array, other: Union[int, bool, array], /) -> array:
359+
"""
360+
Note: __ixor__ is a method of the array object.
361+
"""
362+
pass
363+
364+
def __rxor__(self: array, other: Union[int, bool, array], /) -> array:
365+
"""
366+
Note: __rxor__ is a method of the array object.
367+
"""
368+
pass
369+
214370
# Note: dtype is an attribute of the array object.
215371
dtype: dtype = None
216372

@@ -232,4 +388,4 @@ def to_device(self: array, device: device, /, *, stream: Optional[Union[int, Any
232388
# Note: T is an attribute of the array object.
233389
T: array = None
234390

235-
__all__ = ['__abs__', '__add__', '__and__', '__array_namespace__', '__bool__', '__dlpack__', '__dlpack_device__', '__eq__', '__float__', '__floordiv__', '__ge__', '__getitem__', '__gt__', '__index__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__matmul__', '__mod__', '__mul__', '__ne__', '__neg__', '__or__', '__pos__', '__pow__', '__rshift__', '__setitem__', '__sub__', '__truediv__', '__xor__', 'to_device', 'dtype', 'device', 'mT', 'ndim', 'shape', 'size', 'T']
391+
__all__ = ['__abs__', '__add__', '__and__', '__array_namespace__', '__bool__', '__dlpack__', '__dlpack_device__', '__eq__', '__float__', '__floordiv__', '__ge__', '__getitem__', '__gt__', '__index__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__matmul__', '__mod__', '__mul__', '__ne__', '__neg__', '__or__', '__pos__', '__pow__', '__rshift__', '__setitem__', '__sub__', '__truediv__', '__xor__', 'to_device', '__iadd__', '__radd__', '__iand__', '__rand__', '__ifloordiv__', '__rfloordiv__', '__ilshift__', '__rlshift__', '__imatmul__', '__rmatmul__', '__imod__', '__rmod__', '__imul__', '__rmul__', '__ior__', '__ror__', '__ipow__', '__rpow__', '__irshift__', '__rrshift__', '__isub__', '__rsub__', '__itruediv__', '__rtruediv__', '__ixor__', '__rxor__', 'dtype', 'device', 'mT', 'ndim', 'shape', 'size', 'T']

array_api_tests/function_stubs/set_functions.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
def unique_all(x: array, /) -> Tuple[array, array, array, array]:
1616
pass
1717

18+
def unique_counts(x: array, /) -> Tuple[array, array]:
19+
pass
20+
1821
def unique_inverse(x: array, /) -> Tuple[array, array]:
1922
pass
2023

2124
def unique_values(x: array, /) -> array:
2225
pass
2326

24-
__all__ = ['unique_all', 'unique_inverse', 'unique_values']
27+
__all__ = ['unique_all', 'unique_counts', 'unique_inverse', 'unique_values']

array_api_tests/special_cases/test___abs__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Special cases tests for x.__abs__.
2+
Special cases tests for __abs__.
33
44
These tests are generated from the special cases listed in the spec.
55

array_api_tests/special_cases/test___add__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Special cases tests for x.__add__.
2+
Special cases tests for __add__.
33
44
These tests are generated from the special cases listed in the spec.
55

0 commit comments

Comments
 (0)