Skip to content

Add support for Array API in NamedArray #11183

Add support for Array API in NamedArray

Add support for Array API in NamedArray #11183

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

2 errors, 2 867 fail, 1 627 skipped, 15 757 pass in 1h 27m 42s

     10 files  +     10       10 suites  +10   1h 27m 42s ⏱️ + 1h 27m 42s
 20 253 tests + 20 253   15 757 ✅ + 15 757   1 627 💤 + 1 627   2 867 ❌ + 2 867   2 🔥 + 2 
158 021 runs  +158 021  125 205 ✅ +125 205  19 898 💤 +19 898  12 904 ❌ +12 904  14 🔥 +14 

Results for commit ec3880e. ± Comparison against earlier commit e8b2b4e.

Annotations

Check warning on line 0 in xarray.tests.test_array_api

See this annotation in the file changed.

@github-actions github-actions / Test Results

5 out of 8 runs failed: test_aggregation (xarray.tests.test_array_api)

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 Windows-3.10/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
arrays = (<xarray.DataArray (x: 2, y: 3)> Size: 48B
array([[ 1.,  2.,  3.],
       [ 4.,  5., nan]])
Coordinates:
  * x        ...nan]], dtype=array_api_strict.float64)
Coordinates:
  * x        (x) int64 16B 10 20
Dimensions without coordinates: y)

    def test_aggregation(arrays: tuple[xr.DataArray, xr.DataArray]) -> None:
        np_arr, xp_arr = arrays
        expected = np_arr.sum()
>       actual = xp_arr.sum()

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_array_api.py#x1B[0m:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_aggregations.py#x1B[0m:1857: in sum
    return self.reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:3837: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1678: in reduce
    result = super().reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1396: in reduce
    return from_array(dims, data, attrs=self._attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:212: in from_array
    if isinstance(data, _arrayfunction_or_api):
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/typing.py#x1B[0m:2025: in __instancecheck__
    if all(hasattr(instance, attr) and
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/typing.py#x1B[0m:2025: in <genexpr>
    if all(hasattr(instance, attr) and
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/site-packages/array_api_strict/_array_object.py#x1B[0m:1178: in mT
    return matrix_transpose(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = Array(15., dtype=array_api_strict.float64)

    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.11/site-packages/array_api_strict/_linear_algebra_functions.py#x1B[0m:50: ValueError

Check warning on line 0 in xarray.tests.test_array_api

See this annotation in the file changed.

@github-actions github-actions / Test Results

5 out of 8 runs failed: test_aggregation_skipna (xarray.tests.test_array_api)

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 Windows-3.10/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
arrays = (<xarray.DataArray (x: 2, y: 3)> Size: 48B
array([[ 1.,  2.,  3.],
       [ 4.,  5., nan]])
Coordinates:
  * x        ...nan]], dtype=array_api_strict.float64)
Coordinates:
  * x        (x) int64 16B 10 20
Dimensions without coordinates: y)

    def test_aggregation_skipna(arrays) -> None:
        np_arr, xp_arr = arrays
        expected = np_arr.sum(skipna=False)
>       actual = xp_arr.sum(skipna=False)

#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_array_api.py#x1B[0m:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_aggregations.py#x1B[0m:1857: in sum
    return self.reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:3837: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1678: in reduce
    result = super().reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1396: in reduce
    return from_array(dims, data, attrs=self._attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:212: in from_array
    if isinstance(data, _arrayfunction_or_api):
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/typing.py#x1B[0m:2025: in __instancecheck__
    if all(hasattr(instance, attr) and
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/typing.py#x1B[0m:2025: in <genexpr>
    if all(hasattr(instance, attr) and
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/site-packages/array_api_strict/_array_object.py#x1B[0m:1178: in mT
    return matrix_transpose(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = Array(nan, dtype=array_api_strict.float64)

    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.11/site-packages/array_api_strict/_linear_algebra_functions.py#x1B[0m:50: ValueError

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 9 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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[31mD:\a\xarray\xarray\xarray\tests\test_assertions.py#x1B[0m:189: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\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[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:137: in isnull
    xp = get_array_namespace(data)
#x1B[1m#x1B[31mD:\a\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[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:324: 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 9 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_dataset.TestDataset

See this annotation in the file changed.

@github-actions github-actions / Test Results

1 out of 9 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 0x7fb6861ec190>
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_namedarray.TestNamedArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 9 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 Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-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 0x7ffa627ace90>
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 9 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 0x7ffa627ac310>

    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.11/typing.py#x1B[0m:2025: in __instancecheck__
    if all(hasattr(instance, attr) and
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <set_iterator object at 0x7ffa5eae44c0>

>   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.11/typing.py#x1B[0m:2025: 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 9 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 Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-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 - {'__array_ufunc__', '__array_function__', 'imag', 'real'}
_arrayapi - {'to_device', 'device', 'mT'}
self = <xarray.tests.test_namedarray.TestNamedArray object at 0x7ffa6273e250>

    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 0x7ffa5df83750>

    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 - {'__array_ufunc__', '__array_function__', 'imag', 'real'}#x1B[0m
#x1B[1m#x1B[31mE           _arrayapi - {'to_device', 'device', 'mT'}#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

5 out of 9 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 Windows-3.10/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 0x7ffa6273e890>

    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.11/typing.py#x1B[0m:2025: in __instancecheck__
    if all(hasattr(instance, attr) and
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/typing.py#x1B[0m:2025: in <genexpr>
    if all(hasattr(instance, attr) and
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/site-packages/array_api_strict/_array_object.py#x1B[0m:1178: 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.11/site-packages/array_api_strict/_linear_algebra_functions.py#x1B[0m:50: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x000002546018ED50>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:527: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x000002546018F020>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:527: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x0000023BECB2D190>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:527: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x0000020B47B533E0>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:546: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1487: in permute_dims
    from xarray.namedarray._array_api import permute_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x0000023BECB2D670>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:546: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1487: in permute_dims
    from xarray.namedarray._array_api import permute_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x0000020B47B53650>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:546: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1487: in permute_dims
    from xarray.namedarray._array_api import permute_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x000002546018F9B0>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:555: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1487: in permute_dims
    from xarray.namedarray._array_api import permute_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x0000020B47B53DA0>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:574: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

4 out of 9 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]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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 0x0000023BECB2DF70>
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[31mD:\a\xarray\xarray\xarray\tests\test_namedarray.py#x1B[0m:574: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:1593: in expand_dims
    from xarray.namedarray._array_api import expand_dims
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

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

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 Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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_rolling.TestDataArrayRolling object at 0x7efd48baa110>
da = <xarray.DataArray (time: 11)> Size: 88B
array([ 0., nan,  1.,  2., nan,  3.,  4.,  5., nan,  6.,  7.])
Dimensions without coordinates: time
center = True, min_periods = 1, window = 4, 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:214: in astype
    return xp.astype(data, dtype, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_data_type_functions.py#x1B[0m:62: in astype
    if isinstance(x._data, _arrayapi):
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/typing.py#x1B[0m:2025: in __instancecheck__
    if all(hasattr(instance, attr) and
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <set_iterator object at 0x7efd3d981f40>

>   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.11/typing.py#x1B[0m:2025: ValueError

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

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 9 runs failed: test_rolling_reduce[numbagg-numpy-std-4-1-False-1] (xarray.tests.test_rolling.TestDataArrayRolling)

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 Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x0000020B4A981B80>
da = <xarray.DataArray (a: 3, time: 21, x: 4)> Size: 2kB
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        ...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 = 4, 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[31mD:\a\xarray\xarray\xarray\tests\test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31mD:\a\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[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

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

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 Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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_rolling.TestDataArrayRolling object at 0x7efd48ba8a10>
da = <xarray.DataArray (time: 11)> Size: 88B
array([ 0., nan,  1.,  2., nan,  3.,  4.,  5., nan,  6.,  7.])
Dimensions without coordinates: time
center = False, min_periods = 1, window = 4, 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:214: in astype
    return xp.astype(data, dtype, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_data_type_functions.py#x1B[0m:62: in astype
    if isinstance(x._data, _arrayapi):
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/typing.py#x1B[0m:2025: in __instancecheck__
    if all(hasattr(instance, attr) and
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <set_iterator object at 0x7efd3c396800>

>   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.11/typing.py#x1B[0m:2025: ValueError

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

See this annotation in the file changed.

@github-actions github-actions / Test Results

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

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 Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x0000020B4A981D60>
da = <xarray.DataArray (a: 3, time: 21, x: 4)> Size: 2kB
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        ...ates:
  * time     (time) datetime64[ns] 168B 2000-01-01 2000-01-02 ... 2000-01-21
Dimensions without coordinates: a, x
center = True, min_periods = 2, window = 4, 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[31mD:\a\xarray\xarray\xarray\tests\test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31mD:\a\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[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: 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

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

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 Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/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_rolling.TestDataArrayRolling object at 0x7efd48ba99d0>
da = <xarray.DataArray (time: 11)> Size: 88B
array([ 0., nan,  1.,  2., nan,  3.,  4.,  5., nan,  6.,  7.])
Dimensions without coordinates: time
center = True, min_periods = 2, window = 4, 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:214: in astype
    return xp.astype(data, dtype, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_data_type_functions.py#x1B[0m:62: in astype
    if isinstance(x._data, _arrayapi):
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/typing.py#x1B[0m:2025: in __instancecheck__
    if all(hasattr(instance, attr) and
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <set_iterator object at 0x7efd441f4a00>

>   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.11/typing.py#x1B[0m:2025: ValueError

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

See this annotation in the file changed.

@github-actions github-actions / Test Results

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

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 Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_rolling.TestDataArrayRolling object at 0x0000020B4A981F40>
da = <xarray.DataArray (a: 3, time: 21, x: 4)> Size: 2kB
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        ...ates:
  * time     (time) datetime64[ns] 168B 2000-01-01 2000-01-02 ... 2000-01-21
Dimensions without coordinates: a, x
center = False, min_periods = 2, window = 4, 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[31mD:\a\xarray\xarray\xarray\tests\test_rolling.py#x1B[0m:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\rolling.py#x1B[0m:499: in reduce
    windows = self._construct(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\rolling.py#x1B[0m:414: in _construct
    window = obj.variable.rolling_window(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\variable.py#x1B[0m:2072: in rolling_window
    var = duck_array_ops.astype(self, dtype, copy=False)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:210: in astype
    xp = get_array_namespace(data)
#x1B[1m#x1B[31mD:\a\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[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:61: in _get_array_namespace
    return x.__array_namespace__()
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:462: in __array_namespace__
    import xarray.namedarray._array_api as array_api
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:71: in <module>
    from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\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
        import math
        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[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning