Skip to content

Add support for Array API in NamedArray #11189

Add support for Array API in NamedArray

Add support for Array API in NamedArray #11189

GitHub Actions / Test Results failed Sep 25, 2024 in 0s

1 errors, 2 867 fail, 1 627 skipped, 15 758 pass in 52m 31s

      8 files  +      6       8 suites  +6   52m 31s ⏱️ + 47m 5s
 20 253 tests +  6 471  15 758 ✅ +11 494   1 627 💤  - 6 343  2 867 ❌ +1 319  1 🔥 +1 
123 368 runs  +109 576  98 443 ✅ +94 179  17 740 💤 +9 760  7 181 ❌ +5 633  4 🔥 +4 

Results for commit c59fb54. ± Comparison against earlier commit 7c278dc.

Annotations

Check failure on line 0 in /

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 2 runs with error: xarray.tests.test_sparse

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
collection failure
collection failure
collection failure
collection failure
#x1B[1m#x1B[31mxarray/tests/test_sparse.py#x1B[0m:70: in __repr__
    return f"obj.{self.meth}(*{self.args}, **{self.kwargs})"
#x1B[1m#x1B[31mxarray/core/common.py#x1B[0m:183: in __repr__
    return formatting.array_repr(self)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/reprlib.py#x1B[0m:21: in wrapper
    result = user_function(self)
#x1B[1m#x1B[31mxarray/core/formatting.py#x1B[0m:698: in array_repr
    nbytes_str = render_human_readable_nbytes(arr.nbytes)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:925: in nbytes
    from xarray.namedarray._array_api._utils import _get_data_namespace
#x1B[1m#x1B[31mxarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mxarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: in __getattr__
    raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE   AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE   `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE   The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE       https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_hooks.py#x1B[0m:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_manager.py#x1B[0m:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:245: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:462: in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_hooks.py#x1B[0m:574: in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_manager.py#x1B[0m:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:115: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:1236: in parametrize
    ids = self._resolve_parameter_set_ids(
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:1355: in _resolve_parameter_set_ids
    return id_maker.make_unique_parameterset_ids()
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:897: in make_unique_parameterset_ids
    resolved_ids = list(self._resolve_ids())
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:932: in _resolve_ids
    yield "-".join(
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:933: in <genexpr>
    self._idval(val, argname, idx)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:939: in _idval
    idval = self._idval_from_function(val, argname, idx)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:961: in _idval_from_function
    raise ValueError(msg) from e
#x1B[1m#x1B[31mE   ValueError: xarray/tests/test_sparse.py::test_variable_method: error raised while trying to determine id of parameter 'func' at position 22#x1B[0m
#x1B[1m#x1B[31mxarray/tests/test_sparse.py#x1B[0m:70: in __repr__
    return f"obj.{self.meth}(*{self.args}, **{self.kwargs})"
#x1B[1m#x1B[31mxarray/core/common.py#x1B[0m:183: in __repr__
    return formatting.array_repr(self)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/reprlib.py#x1B[0m:21: in wrapper
    result = user_function(self)
#x1B[1m#x1B[31mxarray/core/formatting.py#x1B[0m:698: in array_repr
    nbytes_str = render_human_readable_nbytes(arr.nbytes)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:925: in nbytes
    from xarray.namedarray._array_api._utils import _get_data_namespace
#x1B[1m#x1B[31mxarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mxarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: in __getattr__
    raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE   AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE   `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE   The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE       https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_hooks.py#x1B[0m:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_manager.py#x1B[0m:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:245: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:462: in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_hooks.py#x1B[0m:574: in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_manager.py#x1B[0m:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:115: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:1236: in parametrize
    ids = self._resolve_parameter_set_ids(
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:1355: in _resolve_parameter_set_ids
    return id_maker.make_unique_parameterset_ids()
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:897: in make_unique_parameterset_ids
    resolved_ids = list(self._resolve_ids())
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:932: in _resolve_ids
    yield "-".join(
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:933: in <genexpr>
    self._idval(val, argname, idx)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:939: in _idval
    idval = self._idval_from_function(val, argname, idx)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:961: in _idval_from_function
    raise ValueError(msg) from e
#x1B[1m#x1B[31mE   ValueError: xarray/tests/test_sparse.py::test_variable_method: error raised while trying to determine id of parameter 'func' at position 22#x1B[0m
#x1B[1m#x1B[31mxarray/tests/test_sparse.py#x1B[0m:70: in __repr__
    return f"obj.{self.meth}(*{self.args}, **{self.kwargs})"
#x1B[1m#x1B[31mxarray/core/common.py#x1B[0m:183: in __repr__
    return formatting.array_repr(self)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/reprlib.py#x1B[0m:21: in wrapper
    result = user_function(self)
#x1B[1m#x1B[31mxarray/core/formatting.py#x1B[0m:698: in array_repr
    nbytes_str = render_human_readable_nbytes(arr.nbytes)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:925: in nbytes
    from xarray.namedarray._array_api._utils import _get_data_namespace
#x1B[1m#x1B[31mxarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mxarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: in __getattr__
    raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE   AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE   `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE   The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE       https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_hooks.py#x1B[0m:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_manager.py#x1B[0m:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:245: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:462: in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_hooks.py#x1B[0m:574: in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_manager.py#x1B[0m:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:115: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:1236: in parametrize
    ids = self._resolve_parameter_set_ids(
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:1355: in _resolve_parameter_set_ids
    return id_maker.make_unique_parameterset_ids()
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:897: in make_unique_parameterset_ids
    resolved_ids = list(self._resolve_ids())
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:932: in _resolve_ids
    yield "-".join(
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:933: in <genexpr>
    self._idval(val, argname, idx)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:939: in _idval
    idval = self._idval_from_function(val, argname, idx)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:961: in _idval_from_function
    raise ValueError(msg) from e
#x1B[1m#x1B[31mE   ValueError: xarray/tests/test_sparse.py::test_variable_method: error raised while trying to determine id of parameter 'func' at position 22#x1B[0m
#x1B[1m#x1B[31mxarray/tests/test_sparse.py#x1B[0m:70: in __repr__
    return f"obj.{self.meth}(*{self.args}, **{self.kwargs})"
#x1B[1m#x1B[31mxarray/core/common.py#x1B[0m:183: in __repr__
    return formatting.array_repr(self)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/reprlib.py#x1B[0m:21: in wrapper
    result = user_function(self)
#x1B[1m#x1B[31mxarray/core/formatting.py#x1B[0m:698: in array_repr
    nbytes_str = render_human_readable_nbytes(arr.nbytes)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:925: in nbytes
    from xarray.namedarray._array_api._utils import _get_data_namespace
#x1B[1m#x1B[31mxarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mxarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: in __getattr__
    raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE   AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE   `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE   The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE       https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_hooks.py#x1B[0m:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_manager.py#x1B[0m:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:245: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:462: in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_hooks.py#x1B[0m:574: in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/pluggy/_manager.py#x1B[0m:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:115: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:1236: in parametrize
    ids = self._resolve_parameter_set_ids(
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:1355: in _resolve_parameter_set_ids
    return id_maker.make_unique_parameterset_ids()
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:897: in make_unique_parameterset_ids
    resolved_ids = list(self._resolve_ids())
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:932: in _resolve_ids
    yield "-".join(
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:933: in <genexpr>
    self._idval(val, argname, idx)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:939: in _idval
    idval = self._idval_from_function(val, argname, idx)
#x1B[1m#x1B[31m../../../micromamba/envs/xarray-tests/lib/python3.10/site-packages/_pytest/python.py#x1B[0m:961: in _idval_from_function
    raise ValueError(msg) from e
#x1B[1m#x1B[31mE   ValueError: xarray/tests/test_sparse.py::test_variable_method: error raised while trying to determine id of parameter 'func' at position 22#x1B[0m

Check warning on line 0 in xarray.tests.test_assertions

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_assert_allclose[Dataset] (xarray.tests.test_assertions)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
obj1 = <xarray.Dataset> Size: 32B
Dimensions:  (x: 2, y: 2)
Dimensions without coordinates: x, y
Data variables:
    a        (x) float64 16B 1e-17 2.0
    b        (y) float64 16B -2e-18 2.0
obj2 = <xarray.Dataset> Size: 32B
Dimensions:  (x: 2, y: 2)
Dimensions without coordinates: x, y
Data variables:
    a        (x) int64 16B 0 2
    b        (y) int64 16B 0 1

    @pytest.mark.parametrize(
        "obj1,obj2",
        (
            pytest.param(
                xr.Variable("x", [1e-17, 2]), xr.Variable("x", [0, 3]), id="Variable"
            ),
            pytest.param(
                xr.DataArray([1e-17, 2], dims="x"),
                xr.DataArray([0, 3], dims="x"),
                id="DataArray",
            ),
            pytest.param(
                xr.Dataset({"a": ("x", [1e-17, 2]), "b": ("y", [-2e-18, 2])}),
                xr.Dataset({"a": ("x", [0, 2]), "b": ("y", [0, 1])}),
                id="Dataset",
            ),
            pytest.param(
                xr.DataArray(np.array("a", dtype="|S1")),
                xr.DataArray(np.array("b", dtype="|S1")),
                id="DataArray_with_character_dtype",
            ),
        ),
    )
    def test_assert_allclose(obj1, obj2) -> None:
        with pytest.raises(AssertionError):
>           xr.testing.assert_allclose(obj1, obj2)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_assertions.py#x1B[0m:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/formatting.py#x1B[0m:1025: in diff_dataset_repr
    diff_data_vars_repr(a.data_vars, b.data_vars, compat, col_width=col_width)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/formatting.py#x1B[0m:858: in _diff_mapping_repr
    summarizer(k, a_mapping[k], col_width, **a_summarizer_kwargs[k]),
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/formatting.py#x1B[0m:345: in summarize_variable
    nbytes_str = f" {render_human_readable_nbytes(variable.nbytes)}"
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:925: in nbytes
    from xarray.namedarray._array_api._utils import _get_data_namespace
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_assertions

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_ensure_warnings_not_elevated[assert_duckarray_equal] (xarray.tests.test_assertions)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
func = 'assert_duckarray_equal'

    @pytest.mark.parametrize(
        "func",
        [
            "assert_equal",
            "assert_identical",
            "assert_allclose",
            "assert_duckarray_equal",
            "assert_duckarray_allclose",
        ],
    )
    def test_ensure_warnings_not_elevated(func) -> None:
        # make sure warnings are not elevated to errors in the assertion functions
        # e.g. by @pytest.mark.filterwarnings("error")
        # see https://github.com/pydata/xarray/pull/4760#issuecomment-774101639
    
        # define a custom Variable class that raises a warning in assert_*
        class WarningVariable(xr.Variable):
            @property  # type: ignore[misc]
            def dims(self):
                warnings.warn("warning in test", stacklevel=2)
                return super().dims
    
            def __array__(
                self, dtype: np.typing.DTypeLike = None, /, *, copy: bool | None = None
            ) -> np.ndarray:
                warnings.warn("warning in test", stacklevel=2)
                return super().__array__(dtype, copy=copy)
    
        a = WarningVariable("x", [1])
        b = WarningVariable("x", [2])
    
        with warnings.catch_warnings(record=True) as w:
            # elevate warnings to errors
            warnings.filterwarnings("error")
            with pytest.raises(AssertionError):
>               getattr(xr.testing, func)(a, b)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_assertions.py#x1B[0m:189: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:314: in array_equiv
    flag_array = (arr1 == arr2) | (isnull(arr1) & isnull(arr2))
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:137: in isnull
    xp = get_array_namespace(data)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in get_array_namespace
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in <setcomp>
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_dataset.TestDataset

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_copy_coords[False-expected_orig1] (xarray.tests.test_dataset.TestDataset)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
self = <xarray.tests.test_dataset.TestDataset object at 0x7f50a07bbca0>
deep = False
expected_orig = <xarray.DataArray 'a' (a: 2)> Size: 16B
array([999,   2])
Coordinates:
  * a        (a) int64 16B 999 2

    @pytest.mark.xfail(raises=AssertionError)
    @pytest.mark.parametrize(
        "deep, expected_orig",
        [
            [
                True,
                xr.DataArray(
                    xr.IndexVariable("a", np.array([1, 2])),
                    coords={"a": [1, 2]},
                    dims=["a"],
                ),
            ],
            [
                False,
                xr.DataArray(
                    xr.IndexVariable("a", np.array([999, 2])),
                    coords={"a": [999, 2]},
                    dims=["a"],
                ),
            ],
        ],
    )
    def test_copy_coords(self, deep, expected_orig) -> None:
        """The test fails for the shallow copy, and apparently only on Windows
        for some reason. In windows coords seem to be immutable unless it's one
        dataset deep copied from another."""
        ds = xr.DataArray(
            np.ones([2, 2, 2]),
            coords={"a": [1, 2], "b": ["x", "y"], "c": [0, 1]},
            dims=["a", "b", "c"],
            name="value",
        ).to_dataset()
        ds_cp = ds.copy(deep=deep)
        new_a = np.array([999, 2])
        ds_cp.coords["a"] = ds_cp.a.copy(data=new_a)
    
        expected_cp = xr.DataArray(
            xr.IndexVariable("a", new_a),
            coords={"a": [999, 2]},
            dims=["a"],
        )
        assert_identical(ds_cp.coords["a"], expected_cp)
    
>       assert_identical(ds.coords["a"], expected_orig)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_dataset.py#x1B[0m:3024: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/formatting.py#x1B[0m:975: in diff_array_repr
    diff_coords_repr(a.coords, b.coords, compat, col_width=col_width)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/formatting.py#x1B[0m:918: in diff_coords_repr
    return _diff_mapping_repr(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/formatting.py#x1B[0m:858: in _diff_mapping_repr
    summarizer(k, a_mapping[k], col_width, **a_summarizer_kwargs[k]),
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/formatting.py#x1B[0m:345: in summarize_variable
    nbytes_str = f" {render_human_readable_nbytes(variable.nbytes)}"
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:925: in nbytes
    from xarray.namedarray._array_api._utils import _get_data_namespace
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_apply_missing_dims (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
def test_apply_missing_dims() -> None:
        ## Single arg
    
        def add_one(a, core_dims, on_missing_core_dim):
            return apply_ufunc(
                lambda x: x + 1,
                a,
                input_core_dims=core_dims,
                output_core_dims=core_dims,
                on_missing_core_dim=on_missing_core_dim,
            )
    
        array = np.arange(6).reshape(2, 3)
        variable = xr.Variable(["x", "y"], array)
        variable_no_y = xr.Variable(["x", "z"], array)
    
        ds = xr.Dataset({"x_y": variable, "x_z": variable_no_y})
    
        # Check the standard stuff works OK
        assert_identical(
            add_one(ds[["x_y"]], core_dims=[["y"]], on_missing_core_dim="raise"),
            ds[["x_y"]] + 1,
        )
    
        # `raise` — should raise on a missing dim
        with pytest.raises(ValueError):
>           add_one(ds, core_dims=[["y"]], on_missing_core_dim="raise")

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_computation.py#x1B[0m:286: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_computation.py#x1B[0m:264: in add_one
    return apply_ufunc(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/computation.py#x1B[0m:1265: in apply_ufunc
    return apply_dataset_vfunc(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/computation.py#x1B[0m:536: in apply_dataset_vfunc
    result_vars = apply_dict_of_variables_vfunc(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/computation.py#x1B[0m:458: in apply_dict_of_variables_vfunc
    core_dim_present = _check_core_dims(signature, variable_args, name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/computation.py#x1B[0m:435: in _check_core_dims
    message += f"Missing core dims {set(core_dims) - set(variable_arg.dims)} from arg number {i + 1} on a variable named `{name}`:\n{variable_arg}\n\n"
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/common.py#x1B[0m:205: in __format__
    return self.__repr__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/common.py#x1B[0m:183: in __repr__
    return formatting.array_repr(self)
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/reprlib.py#x1B[0m:21: in wrapper
    result = user_function(self)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/formatting.py#x1B[0m:698: in array_repr
    nbytes_str = render_human_readable_nbytes(arr.nbytes)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:925: in nbytes
    from xarray.namedarray._array_api._utils import _get_data_namespace
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_from_array_with_explicitly_indexed (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
AssertionError: assert False
 +  where False = isinstance(array([[[ 0.,  1.,  2.,  3.,  4.],\n        [ 5.,  6.,  7.,  8.,  9.],\n        [10., 11., 12., 13., 14.],\n        [15.,...      [45., 46., 47., 48., 49.],\n        [50., 51., 52., 53., 54.],\n        [55., 56., 57., 58., 59.]]], dtype=float32), CustomArrayIndexable)
 +    where array([[[ 0.,  1.,  2.,  3.,  4.],\n        [ 5.,  6.,  7.,  8.,  9.],\n        [10., 11., 12., 13., 14.],\n        [15.,...      [45., 46., 47., 48., 49.],\n        [50., 51., 52., 53., 54.],\n        [55., 56., 57., 58., 59.]]], dtype=float32) = <Namedarray, shape=(3, 4, 5), dims=('x', 'y', 'z'), dtype=float32, data=[[[ 0.  1.  2.  3.  4.]\n  [ 5.  6.  7.  8.  9..... 36. 37. 38. 39.]]\n\n [[40. 41. 42. 43. 44.]\n  [45. 46. 47. 48. 49.]\n  [50. 51. 52. 53. 54.]\n  [55. 56. 57. 58. 59.]]]>.data
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781773a9e0>
random_inputs = array([[[ 0.,  1.,  2.,  3.,  4.],
        [ 5.,  6.,  7.,  8.,  9.],
        [10., 11., 12., 13., 14.],
        [15.,...      [45., 46., 47., 48., 49.],
        [50., 51., 52., 53., 54.],
        [55., 56., 57., 58., 59.]]], dtype=float32)

    def test_from_array_with_explicitly_indexed(
        self, random_inputs: np.ndarray[Any, Any]
    ) -> None:
        array: CustomArray[Any, Any]
        array = CustomArray(random_inputs)
        output: NamedArray[Any, Any]
        output = from_array(("x", "y", "z"), array)
        assert isinstance(output.data, np.ndarray)
    
        array2: CustomArrayIndexable[Any, Any]
        array2 = CustomArrayIndexable(random_inputs)
        output2: NamedArray[Any, Any]
        output2 = from_array(("x", "y", "z"), array2)
>       assert isinstance(output2.data, CustomArrayIndexable)
#x1B[1m#x1B[31mE       AssertionError: assert False#x1B[0m
#x1B[1m#x1B[31mE        +  where False = isinstance(array([[[ 0.,  1.,  2.,  3.,  4.],\n        [ 5.,  6.,  7.,  8.,  9.],\n        [10., 11., 12., 13., 14.],\n        [15.,...      [45., 46., 47., 48., 49.],\n        [50., 51., 52., 53., 54.],\n        [55., 56., 57., 58., 59.]]], dtype=float32), CustomArrayIndexable)#x1B[0m
#x1B[1m#x1B[31mE        +    where array([[[ 0.,  1.,  2.,  3.,  4.],\n        [ 5.,  6.,  7.,  8.,  9.],\n        [10., 11., 12., 13., 14.],\n        [15.,...      [45., 46., 47., 48., 49.],\n        [50., 51., 52., 53., 54.],\n        [55., 56., 57., 58., 59.]]], dtype=float32) = <Namedarray, shape=(3, 4, 5), dims=('x', 'y', 'z'), dtype=float32, data=[[[ 0.  1.  2.  3.  4.]\n  [ 5.  6.  7.  8.  9..... 36. 37. 38. 39.]]\n\n [[40. 41. 42. 43. 44.]\n  [45. 46. 47. 48. 49.]\n  [50. 51. 52. 53. 54.]\n  [55. 56. 57. 58. 59.]]]>.data#x1B[0m

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:265: AssertionError

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 7 runs failed: test_real_and_imag (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for macOS-3.10/pytest.xml [took 0s]
Raw output
ValueError: matrix transpose with ndim < 2 is undefined
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f88b4748bb0>

    def test_real_and_imag(self) -> None:
        expected_real: np.ndarray[Any, np.dtype[np.float64]]
        expected_real = np.arange(3, dtype=np.float64)
    
        expected_imag: np.ndarray[Any, np.dtype[np.float64]]
        expected_imag = -np.arange(3, dtype=np.float64)
    
        arr: np.ndarray[Any, np.dtype[np.complex128]]
        arr = expected_real + 1j * expected_imag
    
        named_array: NamedArray[Any, np.dtype[np.complex128]]
        named_array = NamedArray(["x"], arr)
    
>       actual_real: duckarray[Any, np.dtype[np.float64]] = named_array.real.data

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:280: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1038: in real
    if isinstance(self._data, _arrayapi):
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/typing.py#x1B[0m:1506: in __instancecheck__
    if all(hasattr(instance, attr) and
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <set_iterator object at 0x7f88a2b63b40>

>   if all(hasattr(instance, attr) and
            # All *methods* can be blocked by setting them to None.
            (not callable(getattr(cls, attr, None)) or
             getattr(instance, attr) is not None)
            for attr in _get_protocol_attrs(cls)):
#x1B[1m#x1B[31mE           ValueError: matrix transpose with ndim < 2 is undefined#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/typing.py#x1B[0m:1506: ValueError

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_duck_array_class (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
TypeError: a (<class 'xarray.tests.test_namedarray.CustomArrayIndexable'>) is not a valid _arrayfunction or _arrayapi. Missing following attrs:
_arrayfunction - {'real', '__array_ufunc__', '__array_function__', 'imag'}
_arrayapi - {'mT', 'to_device', 'device'}
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532e710>

    def test_duck_array_class(self) -> None:
        numpy_a: NDArray[np.int64]
        numpy_a = np.array([2.1, 4], dtype=np.dtype(np.int64))
        check_duck_array_typevar(numpy_a)
    
        masked_a: np.ma.MaskedArray[Any, np.dtype[np.int64]]
        masked_a = np.ma.asarray([2.1, 4], dtype=np.dtype(np.int64))  # type: ignore[no-untyped-call]
        check_duck_array_typevar(masked_a)
    
        custom_a: CustomArrayIndexable[Any, np.dtype[np.int64]]
        custom_a = CustomArrayIndexable(numpy_a)
>       check_duck_array_typevar(custom_a)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:382: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <xarray.tests.test_namedarray.CustomArrayIndexable object at 0x7f7813e3e710>

    def check_duck_array_typevar(a: duckarray[Any, _DType]) -> duckarray[Any, _DType]:
        # Mypy checks a is valid:
        b: duckarray[Any, _DType] = a
    
        # Runtime check if valid:
        if isinstance(b, _arrayfunction_or_api):
            return b
        else:
            missing_attrs = ""
            actual_attrs = set(dir(b))
            for t in _arrayfunction_or_api:
                if sys.version_info >= (3, 13):
                    # https://github.com/python/cpython/issues/104873
                    from typing import get_protocol_members
    
                    expected_attrs = get_protocol_members(t)
                elif sys.version_info >= (3, 12):
                    expected_attrs = t.__protocol_attrs__
                else:
                    from typing import _get_protocol_attrs  # type: ignore[attr-defined]
    
                    expected_attrs = _get_protocol_attrs(t)
    
                missing_attrs_ = expected_attrs - actual_attrs
                if missing_attrs_:
                    missing_attrs += f"{t.__name__} - {missing_attrs_}\n"
>           raise TypeError(
                f"a ({type(a)}) is not a valid _arrayfunction or _arrayapi. "
                "Missing following attrs:\n"
                f"{missing_attrs}"
            )
#x1B[1m#x1B[31mE           TypeError: a (<class 'xarray.tests.test_namedarray.CustomArrayIndexable'>) is not a valid _arrayfunction or _arrayapi. Missing following attrs:#x1B[0m
#x1B[1m#x1B[31mE           _arrayfunction - {'real', '__array_ufunc__', '__array_function__', 'imag'}#x1B[0m
#x1B[1m#x1B[31mE           _arrayapi - {'mT', 'to_device', 'device'}#x1B[0m

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:115: TypeError

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 7 runs failed: test_duck_array_class_array_api (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for macOS-3.10/pytest.xml [took 0s]
Raw output
ValueError: x must be at least 2-dimensional for matrix_transpose
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f0de0050f40>

    def test_duck_array_class_array_api(self) -> None:
        # Test numpy's array api:
        nxp = pytest.importorskip("array_api_strict", minversion="1.0")
    
        # TODO: nxp doesn't use dtype typevars, so can only use Any for the moment:
        arrayapi_a: duckarray[Any, Any]  #  duckarray[Any, np.dtype[np.int64]]
        arrayapi_a = nxp.asarray([2.1, 4], dtype=nxp.int64)
>       check_duck_array_typevar(arrayapi_a)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:391: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:94: in check_duck_array_typevar
    if isinstance(b, _arrayfunction_or_api):
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/typing.py#x1B[0m:1506: in __instancecheck__
    if all(hasattr(instance, attr) and
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/typing.py#x1B[0m:1506: in <genexpr>
    if all(hasattr(instance, attr) and
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/array_api_strict/_array_object.py#x1B[0m:1105: in mT
    return matrix_transpose(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = Array([2, 4], dtype=array_api_strict.int64)

    def matrix_transpose(x: Array, /) -> Array:
        if x.ndim < 2:
>           raise ValueError("x must be at least 2-dimensional for matrix_transpose")
#x1B[1m#x1B[31mE           ValueError: x must be at least 2-dimensional for matrix_transpose#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/array_api_strict/linalg.py#x1B[0m:229: ValueError

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_expand_dims[None-3-expected_shape0-expected_dims0] (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532dc90>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>
dim = None, expected_ndim = 3, expected_shape = (1, 2, 5)
expected_dims = (None, 'x', 'y')

    @pytest.mark.parametrize(
        "dim,expected_ndim,expected_shape,expected_dims",
        [
            (None, 3, (1, 2, 5), (None, "x", "y")),
            (_default, 3, (1, 2, 5), ("dim_2", "x", "y")),
            ("z", 3, (1, 2, 5), ("z", "x", "y")),
        ],
    )
    def test_expand_dims(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
        dim: _Dim | Default,
        expected_ndim: int,
        expected_shape: _ShapeLike,
        expected_dims: _DimsLike,
    ) -> None:
>       result = target.expand_dims(dim=dim)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:527: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_expand_dims[dim1-3-expected_shape1-expected_dims1] (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532d960>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>
dim = <Default>, expected_ndim = 3, expected_shape = (1, 2, 5)
expected_dims = ('dim_2', 'x', 'y')

    @pytest.mark.parametrize(
        "dim,expected_ndim,expected_shape,expected_dims",
        [
            (None, 3, (1, 2, 5), (None, "x", "y")),
            (_default, 3, (1, 2, 5), ("dim_2", "x", "y")),
            ("z", 3, (1, 2, 5), ("z", "x", "y")),
        ],
    )
    def test_expand_dims(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
        dim: _Dim | Default,
        expected_ndim: int,
        expected_shape: _ShapeLike,
        expected_dims: _DimsLike,
    ) -> None:
>       result = target.expand_dims(dim=dim)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:527: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_expand_dims[z-3-expected_shape2-expected_dims2] (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532d7b0>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>
dim = 'z', expected_ndim = 3, expected_shape = (1, 2, 5)
expected_dims = ('z', 'x', 'y')

    @pytest.mark.parametrize(
        "dim,expected_ndim,expected_shape,expected_dims",
        [
            (None, 3, (1, 2, 5), (None, "x", "y")),
            (_default, 3, (1, 2, 5), ("dim_2", "x", "y")),
            ("z", 3, (1, 2, 5), ("z", "x", "y")),
        ],
    )
    def test_expand_dims(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
        dim: _Dim | Default,
        expected_ndim: int,
        expected_shape: _ShapeLike,
        expected_dims: _DimsLike,
    ) -> None:
>       result = target.expand_dims(dim=dim)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:527: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_permute_dims[dims0-expected_sizes0] (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532cbe0>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>
dims = (), expected_sizes = {'x': 2, 'y': 5}

    @pytest.mark.parametrize(
        "dims, expected_sizes",
        [
            ((), {"y": 5, "x": 2}),
            (["y", "x"], {"y": 5, "x": 2}),
            (["y", ...], {"y": 5, "x": 2}),
        ],
    )
    def test_permute_dims(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
        dims: _DimsLike,
        expected_sizes: dict[_Dim, _IntOrUnknown],
    ) -> None:
>       actual = target.permute_dims(*dims)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:546: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1487: in permute_dims
    from xarray.namedarray._array_api import permute_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_permute_dims[dims1-expected_sizes1] (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532cc40>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>
dims = ['y', 'x'], expected_sizes = {'x': 2, 'y': 5}

    @pytest.mark.parametrize(
        "dims, expected_sizes",
        [
            ((), {"y": 5, "x": 2}),
            (["y", "x"], {"y": 5, "x": 2}),
            (["y", ...], {"y": 5, "x": 2}),
        ],
    )
    def test_permute_dims(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
        dims: _DimsLike,
        expected_sizes: dict[_Dim, _IntOrUnknown],
    ) -> None:
>       actual = target.permute_dims(*dims)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:546: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1487: in permute_dims
    from xarray.namedarray._array_api import permute_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_permute_dims[dims2-expected_sizes2] (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532cdc0>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>
dims = ['y', Ellipsis], expected_sizes = {'x': 2, 'y': 5}

    @pytest.mark.parametrize(
        "dims, expected_sizes",
        [
            ((), {"y": 5, "x": 2}),
            (["y", "x"], {"y": 5, "x": 2}),
            (["y", ...], {"y": 5, "x": 2}),
        ],
    )
    def test_permute_dims(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
        dims: _DimsLike,
        expected_sizes: dict[_Dim, _IntOrUnknown],
    ) -> None:
>       actual = target.permute_dims(*dims)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:546: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1487: in permute_dims
    from xarray.namedarray._array_api import permute_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_permute_dims_errors (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532d780>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>

    def test_permute_dims_errors(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
    ) -> None:
        with pytest.raises(ValueError, match=r"'y'.*permuted list"):
            dims = ["y"]
>           target.permute_dims(*dims)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:555: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1487: in permute_dims
    from xarray.namedarray._array_api import permute_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_broadcast_to[broadcast_dims1-3] (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532d060>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>
broadcast_dims = {'x': 2, 'y': 5, 'z': 2}, expected_ndim = 3

    @pytest.mark.parametrize(
        "broadcast_dims,expected_ndim",
        [
            ({"x": 2, "y": 5}, 2),
            ({"x": 2, "y": 5, "z": 2}, 3),
            ({"w": 1, "x": 2, "y": 5}, 3),
        ],
    )
    def test_broadcast_to(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
        broadcast_dims: Mapping[_Dim, int],
        expected_ndim: int,
    ) -> None:
        expand_dims = set(broadcast_dims.keys()) - set(target.dims)
        # loop over expand_dims and call .expand_dims(dim=dim) in a loop
        for dim in expand_dims:
>           target = target.expand_dims(dim=dim)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:574: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 7 runs failed: test_broadcast_to[broadcast_dims2-3] (xarray.tests.test_namedarray.TestNamedArray)

artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7f781532d2d0>
target = <Namedarray, shape=(2, 5), dims=('x', 'y'), dtype=float64, data=[[0.  0.5 1.  1.5 2. ]
 [2.5 3.  3.5 4.  4.5]]>
broadcast_dims = {'w': 1, 'x': 2, 'y': 5}, expected_ndim = 3

    @pytest.mark.parametrize(
        "broadcast_dims,expected_ndim",
        [
            ({"x": 2, "y": 5}, 2),
            ({"x": 2, "y": 5, "z": 2}, 3),
            ({"w": 1, "x": 2, "y": 5}, 3),
        ],
    )
    def test_broadcast_to(
        self,
        target: NamedArray[Any, np.dtype[np.float32]],
        broadcast_dims: Mapping[_Dim, int],
        expected_ndim: int,
    ) -> None:
        expand_dims = set(broadcast_dims.keys()) - set(target.dims)
        # loop over expand_dims and call .expand_dims(dim=dim) in a loop
        for dim in expand_dims:
>           target = target.expand_dims(dim=dim)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_namedarray.py#x1B[0m:574: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
>           warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE           FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:300: FutureWarning

Check warning on line 0 in xarray.tests.test_rolling.TestDataArrayRolling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_rolling_reduce[numbagg-dask-std-1-1-False-2] (xarray.tests.test_rolling.TestDataArrayRolling)

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x7f89c11b5b10>
da = <xarray.DataArray (time: 11)> Size: 88B
dask.array<xarray-<this-array>, shape=(11,), dtype=float64, chunksize=(11,), chunktype=numpy.ndarray>
Dimensions without coordinates: time
center = False, min_periods = 1, window = 2, name = 'std'
compute_backend = 'numbagg'

    @pytest.mark.parametrize("da", (1, 2), indirect=True)
    @pytest.mark.parametrize("center", (True, False))
    @pytest.mark.parametrize("min_periods", (None, 1, 2, 3))
    @pytest.mark.parametrize("window", (1, 2, 3, 4))
    @pytest.mark.parametrize("name", ("sum", "mean", "std", "max"))
    def test_rolling_reduce(
        self, da, center, min_periods, window, name, compute_backend
    ) -> None:
        if min_periods is not None and window < min_periods:
            min_periods = window
    
        if da.isnull().sum() > 1 and window == 1:
            # this causes all nan slices
            window = 2
    
        rolling_obj = da.rolling(time=window, center=center, min_periods=min_periods)
    
        # add nan prefix to numpy methods to get similar # behavior as bottleneck
>       actual = rolling_obj.reduce(getattr(np, f"nan{name}"))

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in get_array_namespace
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in <setcomp>
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_rolling.TestDataArrayRolling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_rolling_reduce[numbagg-dask-std-1-2-True-1] (xarray.tests.test_rolling.TestDataArrayRolling)

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x7f89c11b5c00>
da = <xarray.DataArray (a: 3, time: 21, x: 4)> Size: 2kB
dask.array<xarray-<this-array>, shape=(3, 21, 4), dtype=float64, c...ates:
  * time     (time) datetime64[ns] 168B 2000-01-01 2000-01-02 ... 2000-01-21
Dimensions without coordinates: a, x
center = True, min_periods = 1, window = 1, name = 'std'
compute_backend = 'numbagg'

    @pytest.mark.parametrize("da", (1, 2), indirect=True)
    @pytest.mark.parametrize("center", (True, False))
    @pytest.mark.parametrize("min_periods", (None, 1, 2, 3))
    @pytest.mark.parametrize("window", (1, 2, 3, 4))
    @pytest.mark.parametrize("name", ("sum", "mean", "std", "max"))
    def test_rolling_reduce(
        self, da, center, min_periods, window, name, compute_backend
    ) -> None:
        if min_periods is not None and window < min_periods:
            min_periods = window
    
        if da.isnull().sum() > 1 and window == 1:
            # this causes all nan slices
            window = 2
    
        rolling_obj = da.rolling(time=window, center=center, min_periods=min_periods)
    
        # add nan prefix to numpy methods to get similar # behavior as bottleneck
>       actual = rolling_obj.reduce(getattr(np, f"nan{name}"))

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in get_array_namespace
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in <setcomp>
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_rolling.TestDataArrayRolling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_rolling_reduce[numbagg-dask-std-1-2-True-2] (xarray.tests.test_rolling.TestDataArrayRolling)

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x7f89c11b5cf0>
da = <xarray.DataArray (time: 11)> Size: 88B
dask.array<xarray-<this-array>, shape=(11,), dtype=float64, chunksize=(11,), chunktype=numpy.ndarray>
Dimensions without coordinates: time
center = True, min_periods = 1, window = 2, name = 'std'
compute_backend = 'numbagg'

    @pytest.mark.parametrize("da", (1, 2), indirect=True)
    @pytest.mark.parametrize("center", (True, False))
    @pytest.mark.parametrize("min_periods", (None, 1, 2, 3))
    @pytest.mark.parametrize("window", (1, 2, 3, 4))
    @pytest.mark.parametrize("name", ("sum", "mean", "std", "max"))
    def test_rolling_reduce(
        self, da, center, min_periods, window, name, compute_backend
    ) -> None:
        if min_periods is not None and window < min_periods:
            min_periods = window
    
        if da.isnull().sum() > 1 and window == 1:
            # this causes all nan slices
            window = 2
    
        rolling_obj = da.rolling(time=window, center=center, min_periods=min_periods)
    
        # add nan prefix to numpy methods to get similar # behavior as bottleneck
>       actual = rolling_obj.reduce(getattr(np, f"nan{name}"))

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in get_array_namespace
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in <setcomp>
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_rolling.TestDataArrayRolling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_rolling_reduce[numbagg-dask-std-1-2-False-1] (xarray.tests.test_rolling.TestDataArrayRolling)

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x7f89c11b5de0>
da = <xarray.DataArray (a: 3, time: 21, x: 4)> Size: 2kB
dask.array<xarray-<this-array>, shape=(3, 21, 4), dtype=float64, c...ates:
  * time     (time) datetime64[ns] 168B 2000-01-01 2000-01-02 ... 2000-01-21
Dimensions without coordinates: a, x
center = False, min_periods = 1, window = 1, name = 'std'
compute_backend = 'numbagg'

    @pytest.mark.parametrize("da", (1, 2), indirect=True)
    @pytest.mark.parametrize("center", (True, False))
    @pytest.mark.parametrize("min_periods", (None, 1, 2, 3))
    @pytest.mark.parametrize("window", (1, 2, 3, 4))
    @pytest.mark.parametrize("name", ("sum", "mean", "std", "max"))
    def test_rolling_reduce(
        self, da, center, min_periods, window, name, compute_backend
    ) -> None:
        if min_periods is not None and window < min_periods:
            min_periods = window
    
        if da.isnull().sum() > 1 and window == 1:
            # this causes all nan slices
            window = 2
    
        rolling_obj = da.rolling(time=window, center=center, min_periods=min_periods)
    
        # add nan prefix to numpy methods to get similar # behavior as bottleneck
>       actual = rolling_obj.reduce(getattr(np, f"nan{name}"))

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in get_array_namespace
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in <setcomp>
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_rolling.TestDataArrayRolling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_rolling_reduce[numbagg-dask-std-1-2-False-2] (xarray.tests.test_rolling.TestDataArrayRolling)

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x7f89c11b5ed0>
da = <xarray.DataArray (time: 11)> Size: 88B
dask.array<xarray-<this-array>, shape=(11,), dtype=float64, chunksize=(11,), chunktype=numpy.ndarray>
Dimensions without coordinates: time
center = False, min_periods = 1, window = 2, name = 'std'
compute_backend = 'numbagg'

    @pytest.mark.parametrize("da", (1, 2), indirect=True)
    @pytest.mark.parametrize("center", (True, False))
    @pytest.mark.parametrize("min_periods", (None, 1, 2, 3))
    @pytest.mark.parametrize("window", (1, 2, 3, 4))
    @pytest.mark.parametrize("name", ("sum", "mean", "std", "max"))
    def test_rolling_reduce(
        self, da, center, min_periods, window, name, compute_backend
    ) -> None:
        if min_periods is not None and window < min_periods:
            min_periods = window
    
        if da.isnull().sum() > 1 and window == 1:
            # this causes all nan slices
            window = 2
    
        rolling_obj = da.rolling(time=window, center=center, min_periods=min_periods)
    
        # add nan prefix to numpy methods to get similar # behavior as bottleneck
>       actual = rolling_obj.reduce(getattr(np, f"nan{name}"))

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in get_array_namespace
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in <setcomp>
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_rolling.TestDataArrayRolling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_rolling_reduce[numbagg-dask-std-1-3-True-1] (xarray.tests.test_rolling.TestDataArrayRolling)

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x7f89c11b5fc0>
da = <xarray.DataArray (a: 3, time: 21, x: 4)> Size: 2kB
dask.array<xarray-<this-array>, shape=(3, 21, 4), dtype=float64, c...ates:
  * time     (time) datetime64[ns] 168B 2000-01-01 2000-01-02 ... 2000-01-21
Dimensions without coordinates: a, x
center = True, min_periods = 1, window = 1, name = 'std'
compute_backend = 'numbagg'

    @pytest.mark.parametrize("da", (1, 2), indirect=True)
    @pytest.mark.parametrize("center", (True, False))
    @pytest.mark.parametrize("min_periods", (None, 1, 2, 3))
    @pytest.mark.parametrize("window", (1, 2, 3, 4))
    @pytest.mark.parametrize("name", ("sum", "mean", "std", "max"))
    def test_rolling_reduce(
        self, da, center, min_periods, window, name, compute_backend
    ) -> None:
        if min_periods is not None and window < min_periods:
            min_periods = window
    
        if da.isnull().sum() > 1 and window == 1:
            # this causes all nan slices
            window = 2
    
        rolling_obj = da.rolling(time=window, center=center, min_periods=min_periods)
    
        # add nan prefix to numpy methods to get similar # behavior as bottleneck
>       actual = rolling_obj.reduce(getattr(np, f"nan{name}"))

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in get_array_namespace
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in <setcomp>
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError

Check warning on line 0 in xarray.tests.test_rolling.TestDataArrayRolling

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 7 runs failed: test_rolling_reduce[numbagg-dask-std-1-3-True-2] (xarray.tests.test_rolling.TestDataArrayRolling)

artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x7f89c11b60b0>
da = <xarray.DataArray (time: 11)> Size: 88B
dask.array<xarray-<this-array>, shape=(11,), dtype=float64, chunksize=(11,), chunktype=numpy.ndarray>
Dimensions without coordinates: time
center = True, min_periods = 1, window = 2, name = 'std'
compute_backend = 'numbagg'

    @pytest.mark.parametrize("da", (1, 2), indirect=True)
    @pytest.mark.parametrize("center", (True, False))
    @pytest.mark.parametrize("min_periods", (None, 1, 2, 3))
    @pytest.mark.parametrize("window", (1, 2, 3, 4))
    @pytest.mark.parametrize("name", ("sum", "mean", "std", "max"))
    def test_rolling_reduce(
        self, da, center, min_periods, window, name, compute_backend
    ) -> None:
        if min_periods is not None and window < min_periods:
            min_periods = window
    
        if da.isnull().sum() > 1 and window == 1:
            # this causes all nan slices
            window = 2
    
        rolling_obj = da.rolling(time=window, center=center, min_periods=min_periods)
    
        # add nan prefix to numpy methods to get similar # behavior as bottleneck
>       actual = rolling_obj.reduce(getattr(np, f"nan{name}"))

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in get_array_namespace
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:65: in <setcomp>
    namespaces = {_get_array_namespace(t) for t in values}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_dtypes.py#x1B[0m:18: in <module>
    bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

attr = 'bool'

    def __getattr__(attr):
        # Warn for expired attributes, and return a dummy function
        # that always raises an exception.
        import warnings
        try:
            msg = __expired_functions__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
            def _expired(*args, **kwds):
                raise RuntimeError(msg)
    
            return _expired
    
        # Emit warnings for deprecated attributes
        try:
            val, msg = __deprecated_attrs__[attr]
        except KeyError:
            pass
        else:
            warnings.warn(msg, DeprecationWarning, stacklevel=2)
            return val
    
        if attr in __future_scalars__:
            # And future warnings for those that will change, but also give
            # the AttributeError
            warnings.warn(
                f"In the future `np.{attr}` will be defined as the "
                "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
        if attr in __former_attrs__:
>           raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE           AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE           `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m

#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.10/site-packages/numpy/__init__.py#x1B[0m:305: AttributeError