()
| 2051 | |
| 2052 | |
| 2053 | def test_count_nonzero_obj(): |
| 2054 | x = np.random.default_rng().integers(10, size=(15, 16)).astype(object) |
| 2055 | d = da.from_array(x, chunks=(4, 5)) |
| 2056 | |
| 2057 | x_c = np.count_nonzero(x) |
| 2058 | d_c = da.count_nonzero(d) |
| 2059 | |
| 2060 | if d_c.shape == tuple(): |
| 2061 | assert x_c == d_c.compute() |
| 2062 | else: |
| 2063 | assert_eq(x_c, d_c) |
| 2064 | |
| 2065 | |
| 2066 | @pytest.mark.parametrize("axis", [None, 0, (1,), (0, 1)]) |