|
| 1 | +# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +import numpy as np |
| 6 | + |
| 7 | +from awkward._nplikes.typetracer import TypeTracer, TypeTracerArray |
| 8 | + |
| 9 | +nplike = TypeTracer.instance() |
| 10 | + |
| 11 | + |
| 12 | +def test_all(): |
| 13 | + buffer = TypeTracerArray._new(np.dtype("float32"), (4,)) |
| 14 | + result = nplike.all(buffer, axis=None) |
| 15 | + assert isinstance(result, TypeTracerArray) |
| 16 | + assert result.dtype == np.dtype("bool") |
| 17 | + assert result.shape == () |
| 18 | + |
| 19 | + buffer = TypeTracerArray._new(np.dtype("float32"), (4, 3)) |
| 20 | + result = nplike.all(buffer, axis=None) |
| 21 | + assert isinstance(result, TypeTracerArray) |
| 22 | + assert result.dtype == np.dtype("bool") |
| 23 | + assert result.shape == () |
| 24 | + |
| 25 | + |
| 26 | +def test_any(): |
| 27 | + buffer = TypeTracerArray._new(np.dtype("float32"), (4,)) |
| 28 | + result = nplike.any(buffer, axis=None) |
| 29 | + assert isinstance(result, TypeTracerArray) |
| 30 | + assert result.dtype == np.dtype("bool") |
| 31 | + assert result.shape == () |
| 32 | + |
| 33 | + buffer = TypeTracerArray._new(np.dtype("float32"), (4, 3)) |
| 34 | + result = nplike.any(buffer, axis=None) |
| 35 | + assert isinstance(result, TypeTracerArray) |
| 36 | + assert result.dtype == np.dtype("bool") |
| 37 | + assert result.shape == () |
0 commit comments