| 2065 | |
| 2066 | @pytest.mark.parametrize("axis", [None, 0, (1,), (0, 1)]) |
| 2067 | def test_count_nonzero_obj_axis(axis): |
| 2068 | x = np.random.default_rng().integers(10, size=(15, 16)).astype(object) |
| 2069 | d = da.from_array(x, chunks=(4, 5)) |
| 2070 | |
| 2071 | x_c = np.count_nonzero(x, axis) |
| 2072 | d_c = da.count_nonzero(d, axis) |
| 2073 | |
| 2074 | if d_c.shape == tuple(): |
| 2075 | assert x_c == d_c.compute() |
| 2076 | else: |
| 2077 | ####################################################### |
| 2078 | # Workaround oddness with Windows and object arrays. # |
| 2079 | # # |
| 2080 | # xref: https://github.com/numpy/numpy/issues/9468 # |
| 2081 | ####################################################### |
| 2082 | assert_eq(x_c.astype(np.intp), d_c) |
| 2083 | |
| 2084 | |
| 2085 | def test_count_nonzero_str(): |