# This file is autogenerated.  Do not edit by hand.
from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Any, cast, Iterator, Hashable

import numpy as np
from numpy import float32, float64

import xarray as xr
import pytest

import cmomy
from cmomy import CentralMomentsArray, CentralMomentsData

MYPY_ONLY = True

if sys.version_info < (3, 11):
    from typing_extensions import assert_type
else:
    from typing import assert_type

if TYPE_CHECKING:
    from numpy.typing import ArrayLike, DTypeLike

    from cmomy.core.typing_compat import TypeVar
    from cmomy.core.typing import NDArrayAny, CentralMomentsArrayAny, CentralMomentsDataAny

    T = TypeVar("T")

from numpy.typing import NDArray

# So can exclude from coverage
pytestmark = pytest.mark.typing


def check(
    actual: T,
    klass: type[Any],
    dtype: DTypeLike | None = None,
    obj_class: type[Any] | None = None,
) -> T:
    assert isinstance(actual, klass)
    if dtype is not None:
        assert actual.dtype is np.dtype(dtype)  # pyright: ignore[reportAttributeAccessIssue]

    if obj_class is None and klass is CentralMomentsArray:
        obj_class = np.ndarray

    if obj_class is not None:
        assert isinstance(actual.obj, obj_class)  # pyright: ignore[reportAttributeAccessIssue]
    return actual  # type: ignore[no-any-return]


# * Parameters
vals_float32: NDArray[np.float32] = np.zeros(10, dtype=np.float32)
vals_float64: NDArray[np.float64] = np.zeros(10, dtype=np.float64)
vals_arrayany: NDArrayAny = cast("NDArrayAny", vals_float64)
vals_arraylike: ArrayLike = cast("ArrayLike", vals_float64)
vals_any: Any = cast("Any", vals_float64)

data_float32: NDArray[np.float32] = np.zeros((10, 3), dtype=np.float32)
data_float64: NDArray[np.float64] = np.zeros((10, 3), dtype=np.float64)
data_arrayany: NDArrayAny = cast("NDArrayAny", data_float64)
data_arraylike: ArrayLike = cast("ArrayLike", data_float64)
data_any: Any = cast("Any", data_float64)

# For reduction
reduce_out_float32: NDArray[np.float32] = np.zeros(3, dtype=np.float32)
reduce_out_float64: NDArray[np.float64] = np.zeros(3, dtype=np.float64)
reduce_out_arrayany: NDArrayAny = np.zeros(3, dtype="f8")
reduce_out_any = cast("Any", np.zeros_like(reduce_out_float64))

# For transform
transform_out_float32: NDArray[np.float32] = np.zeros((10, 3), dtype=np.float32)
transform_out_float64: NDArray[np.float64] = np.zeros((10, 3), dtype=np.float64)
transform_out_arrayany: NDArrayAny = np.zeros((10, 3), dtype="f8")
transform_out_any = cast("Any", np.zeros_like(transform_out_float64))

# For group/resample
group_out_float32: NDArray[np.float32] = np.zeros((2, 3), dtype=np.float32)
group_out_float64: NDArray[np.float64] = np.zeros((2, 3), dtype=np.float64)
group_out_arrayany: NDArrayAny = np.zeros((2, 3), dtype="f8")
group_out_any = cast("Any", np.zeros_like(group_out_float64))

vals_dataarray = xr.DataArray(vals_float64, name="x")
vals_dataset = xr.Dataset({"x": vals_dataarray})
vals_dataarray_or_set: xr.DataArray | xr.Dataset = cast("xr.DataArray | xr.Dataset", vals_dataarray)
vals_dataarray_any: Any = cast("Any", vals_dataarray)
vals_dataset_any: Any = cast("Any", vals_dataset)

data_dataarray: xr.DataArray = xr.DataArray(data_float64, name="data")
data_dataset: xr.Dataset = xr.Dataset({"data": data_dataarray})
data_dataarray_any: Any = cast("Any", data_dataarray)
data_dataset_any: Any = cast("Any", data_dataset)
data_dataarray_or_sdata: xr.DataArray | xr.Dataset = cast("xr.DataArray | xr.Dataset", data_dataarray)


central_float32 = CentralMomentsArray(data_float32)
central_float64 = CentralMomentsArray(data_float64)
central_arraylike: CentralMomentsArrayAny = CentralMomentsArray(data_arraylike)
central_arrayany: CentralMomentsArrayAny = CentralMomentsArray(data_arrayany)
central_any: Any = CentralMomentsArray(data_any)

central_dataarray = CentralMomentsData(data_dataarray)
central_dataset = CentralMomentsData(data_dataset)
central_dataarray_any: CentralMomentsDataAny = CentralMomentsData(data_dataarray_any)
central_dataset_any: CentralMomentsDataAny = CentralMomentsData(data_dataset_any)
# ca_or_cs = cast("CentralMomentsData[xr.DataArray] | CentralMomentsData[xr.DataArray]", CentralMomentsData(data_dataarray_or_sdata))  # noqa: ERA001

freq = cmomy.random_freq(ndat=10, nrep=2)
sampler = cmomy.resample.IndexSampler(freq=freq)
by = [0] * 5 + [1] * 5
_, index, group_start, group_end = cmomy.reduction.factor_by_to_index(by)



def test_cmomy_utils_select_moment() -> None:
    check(
        assert_type(
            cmomy.utils.select_moment(data_float32, "weight", mom_ndim=1),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.select_moment(data_float64, "weight", mom_ndim=1),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.select_moment(data_arrayany, "weight", mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.select_moment(data_any, "weight", mom_ndim=1),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.select_moment(data_dataarray, "weight", mom_ndim=1),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.select_moment(data_dataset, "weight", mom_ndim=1),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.utils.select_moment(data_dataarray_any, "weight", mom_ndim=1),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.select_moment(data_dataset_any, "weight", mom_ndim=1),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )


def test_cmomy_utils_assign_moment() -> None:
    check(
        assert_type(
            cmomy.utils.assign_moment(data_float32, weight=1, mom_ndim=1),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.assign_moment(data_float64, weight=1, mom_ndim=1),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.assign_moment(data_arrayany, weight=1, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.assign_moment(data_any, weight=1, mom_ndim=1),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.assign_moment(data_dataarray, weight=1, mom_ndim=1),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.assign_moment(data_dataset, weight=1, mom_ndim=1),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.utils.assign_moment(data_dataarray_any, weight=1, mom_ndim=1),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.assign_moment(data_dataset_any, weight=1, mom_ndim=1),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )


def test_cmomy_bootstrap_confidence_interval() -> None:
    check(
        assert_type(
            cmomy.bootstrap_confidence_interval(data_float32, axis=0, method="percentile"),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.bootstrap_confidence_interval(data_float64, axis=0, method="percentile"),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.bootstrap_confidence_interval(data_arrayany, axis=0, method="percentile"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.bootstrap_confidence_interval(data_any, axis=0, method="percentile"),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.bootstrap_confidence_interval(data_dataarray, dim="dim_0", method="percentile"),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.bootstrap_confidence_interval(data_dataset, dim="dim_0", method="percentile"),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.bootstrap_confidence_interval(data_dataarray_any, dim="dim_0", method="percentile"),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.bootstrap_confidence_interval(data_dataset_any, dim="dim_0", method="percentile"),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )


def test_cmomy_convert_moments_to_comoments() -> None:
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_float32, mom=(1, -1)),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_float64, mom=(1, -1)),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_arrayany, mom=(1, -1)),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_any, mom=(1, -1)),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_dataarray, mom=(1, -1)),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_dataset, mom=(1, -1)),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_dataarray_any, mom=(1, -1)),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_dataset_any, mom=(1, -1)),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_arraylike, mom=(1, -1)),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_float32, mom=(1, -1), dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_float64, mom=(1, -1), dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_arrayany, mom=(1, -1), dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_arraylike, mom=(1, -1), dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_any, mom=(1, -1), dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_float32, mom=(1, -1), dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_dataarray, mom=(1, -1), dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_dataset, mom=(1, -1), dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_to_comoments(data_dataarray_any, mom=(1, -1), dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_convert_comoments_to_moments() -> None:
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_any),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_dataarray),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_dataset),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_dataarray_any),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_dataset_any),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_arraylike),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_float32, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_float64, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_arrayany, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_arraylike, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_any, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_float32, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_dataarray, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_dataset, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.comoments_to_moments(data_dataarray_any, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_reduce_data() -> None:
    check(
        assert_type(
            cmomy.reduce_data(data_float32, axis=0, mom_ndim=1),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_float64, axis=0, mom_ndim=1),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_arrayany, axis=0, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_any, axis=0, mom_ndim=1),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataarray, dim="dim_0", mom_ndim=1),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataset, dim="dim_0", mom_ndim=1),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataarray_any, dim="dim_0", mom_ndim=1),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataset_any, dim="dim_0", mom_ndim=1),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_arraylike, axis=0, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_float32, axis=0, mom_ndim=1, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_float64, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_arrayany, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_arraylike, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_any, axis=0, mom_ndim=1, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_float32, axis=0, mom_ndim=1, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataarray, dim="dim_0", mom_ndim=1, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataset, dim="dim_0", mom_ndim=1, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataarray_any, dim="dim_0", mom_ndim=1, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_float32, axis=0, mom_ndim=1, out=reduce_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_arraylike, axis=0, mom_ndim=1, out=reduce_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_any, axis=0, mom_ndim=1, out=reduce_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_float32, axis=0, mom_ndim=1, out=reduce_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataarray, dim="dim_0", mom_ndim=1, out=reduce_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataarray_any, dim="dim_0", mom_ndim=1, out=reduce_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_float32, axis=0, mom_ndim=1, dtype=float32, out=reduce_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_arraylike, axis=0, mom_ndim=1, dtype=float32, out=reduce_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_any, axis=0, mom_ndim=1, dtype=float64, out=reduce_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_float32, axis=0, mom_ndim=1, dtype=float64, out=reduce_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data(data_dataarray, dim="dim_0", mom_ndim=1, dtype="f8", out=reduce_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_reduce_vals() -> None:
    check(
        assert_type(
            cmomy.reduce_vals(vals_float32, axis=0, mom=2),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_float64, axis=0, mom=2),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_arrayany, axis=0, mom=2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_any, axis=0, mom=2),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataarray, dim="dim_0", mom=2),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataset, dim="dim_0", mom=2),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataarray_any, dim="dim_0", mom=2),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataset_any, dim="dim_0", mom=2),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_arraylike, axis=0, mom=2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_float32, axis=0, mom=2, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_float64, axis=0, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_arrayany, axis=0, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_arraylike, axis=0, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_any, axis=0, mom=2, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_float32, axis=0, mom=2, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataarray, dim="dim_0", mom=2, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataset, dim="dim_0", mom=2, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataarray_any, dim="dim_0", mom=2, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_float32, axis=0, mom=2, out=reduce_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_arraylike, axis=0, mom=2, out=reduce_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_any, axis=0, mom=2, out=reduce_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_float32, axis=0, mom=2, out=reduce_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataarray, dim="dim_0", mom=2, out=reduce_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataarray_any, dim="dim_0", mom=2, out=reduce_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_float32, axis=0, mom=2, dtype=float32, out=reduce_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_arraylike, axis=0, mom=2, dtype=float32, out=reduce_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_any, axis=0, mom=2, dtype=float64, out=reduce_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_float32, axis=0, mom=2, dtype=float64, out=reduce_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_vals(vals_dataarray, dim="dim_0", mom=2, dtype="f8", out=reduce_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_reduce_data_grouped() -> None:
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float32, axis=0, mom_ndim=1, by=by),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float64, axis=0, mom_ndim=1, by=by),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_arrayany, axis=0, mom_ndim=1, by=by),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_any, axis=0, mom_ndim=1, by=by),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataarray, dim="dim_0", mom_ndim=1, by=by),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataset, dim="dim_0", mom_ndim=1, by=by),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataarray_any, dim="dim_0", mom_ndim=1, by=by),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataset_any, dim="dim_0", mom_ndim=1, by=by),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_arraylike, axis=0, mom_ndim=1, by=by),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float32, axis=0, mom_ndim=1, by=by, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float64, axis=0, mom_ndim=1, by=by, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_arrayany, axis=0, mom_ndim=1, by=by, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_arraylike, axis=0, mom_ndim=1, by=by, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_any, axis=0, mom_ndim=1, by=by, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float32, axis=0, mom_ndim=1, by=by, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataarray, dim="dim_0", mom_ndim=1, by=by, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataset, dim="dim_0", mom_ndim=1, by=by, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataarray_any, dim="dim_0", mom_ndim=1, by=by, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float32, axis=0, mom_ndim=1, by=by, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_arraylike, axis=0, mom_ndim=1, by=by, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_any, axis=0, mom_ndim=1, by=by, out=group_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float32, axis=0, mom_ndim=1, by=by, out=group_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataarray, dim="dim_0", mom_ndim=1, by=by, out=group_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataarray_any, dim="dim_0", mom_ndim=1, by=by, out=group_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float32, axis=0, mom_ndim=1, by=by, dtype=float32, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_arraylike, axis=0, mom_ndim=1, by=by, dtype=float32, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_any, axis=0, mom_ndim=1, by=by, dtype=float64, out=group_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_float32, axis=0, mom_ndim=1, by=by, dtype=float64, out=group_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduce_data_grouped(data_dataarray, dim="dim_0", mom_ndim=1, by=by, dtype="f8", out=group_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_reduction_reduce_data_indexed() -> None:
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float32, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float64, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_arrayany, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_any, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataarray, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataset, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataarray_any, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataset_any, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_arraylike, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float32, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float64, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_arrayany, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_arraylike, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_any, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float32, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataarray, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataset, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataarray_any, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float32, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_arraylike, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_any, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, out=group_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float32, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, out=group_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataarray, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end, out=group_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataarray_any, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end, out=group_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float32, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_arraylike, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float32, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_any, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float64, out=group_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_float32, axis=0, mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype=float64, out=group_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.reduction.reduce_data_indexed(data_dataarray, dim="dim_0", mom_ndim=1, index=index, group_start=group_start, group_end=group_end, dtype="f8", out=group_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_resample_data() -> None:
    check(
        assert_type(
            cmomy.resample_data(data_float32, axis=0, mom_ndim=1, sampler=sampler),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_float64, axis=0, mom_ndim=1, sampler=sampler),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_arrayany, axis=0, mom_ndim=1, sampler=sampler),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_any, axis=0, mom_ndim=1, sampler=sampler),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataarray, dim="dim_0", mom_ndim=1, sampler=sampler),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataset, dim="dim_0", mom_ndim=1, sampler=sampler),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataarray_any, dim="dim_0", mom_ndim=1, sampler=sampler),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataset_any, dim="dim_0", mom_ndim=1, sampler=sampler),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_arraylike, axis=0, mom_ndim=1, sampler=sampler),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_float32, axis=0, mom_ndim=1, sampler=sampler, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_float64, axis=0, mom_ndim=1, sampler=sampler, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_arrayany, axis=0, mom_ndim=1, sampler=sampler, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_arraylike, axis=0, mom_ndim=1, sampler=sampler, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_any, axis=0, mom_ndim=1, sampler=sampler, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_float32, axis=0, mom_ndim=1, sampler=sampler, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataarray, dim="dim_0", mom_ndim=1, sampler=sampler, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataset, dim="dim_0", mom_ndim=1, sampler=sampler, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataarray_any, dim="dim_0", mom_ndim=1, sampler=sampler, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_float32, axis=0, mom_ndim=1, sampler=sampler, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_arraylike, axis=0, mom_ndim=1, sampler=sampler, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_any, axis=0, mom_ndim=1, sampler=sampler, out=group_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_float32, axis=0, mom_ndim=1, sampler=sampler, out=group_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataarray, dim="dim_0", mom_ndim=1, sampler=sampler, out=group_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataarray_any, dim="dim_0", mom_ndim=1, sampler=sampler, out=group_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_float32, axis=0, mom_ndim=1, sampler=sampler, dtype=float32, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_arraylike, axis=0, mom_ndim=1, sampler=sampler, dtype=float32, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_any, axis=0, mom_ndim=1, sampler=sampler, dtype=float64, out=group_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_float32, axis=0, mom_ndim=1, sampler=sampler, dtype=float64, out=group_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_data(data_dataarray, dim="dim_0", mom_ndim=1, sampler=sampler, dtype="f8", out=group_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_resample_vals() -> None:
    check(
        assert_type(
            cmomy.resample_vals(vals_float32, axis=0, mom=2, sampler=sampler),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_float64, axis=0, mom=2, sampler=sampler),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_arrayany, axis=0, mom=2, sampler=sampler),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_any, axis=0, mom=2, sampler=sampler),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataarray, dim="dim_0", mom=2, sampler=sampler),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataset, dim="dim_0", mom=2, sampler=sampler),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataarray_any, dim="dim_0", mom=2, sampler=sampler),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataset_any, dim="dim_0", mom=2, sampler=sampler),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_float64, axis=0, mom=2, sampler=sampler, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_arrayany, axis=0, mom=2, sampler=sampler, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_any, axis=0, mom=2, sampler=sampler, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataarray, dim="dim_0", mom=2, sampler=sampler, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataset, dim="dim_0", mom=2, sampler=sampler, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataarray_any, dim="dim_0", mom=2, sampler=sampler, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_any, axis=0, mom=2, sampler=sampler, out=group_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, out=group_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataarray, dim="dim_0", mom=2, sampler=sampler, out=group_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataarray_any, dim="dim_0", mom=2, sampler=sampler, out=group_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, dtype=float32, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler, dtype=float32, out=group_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_any, axis=0, mom=2, sampler=sampler, dtype=float64, out=group_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, dtype=float64, out=group_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample_vals(vals_dataarray, dim="dim_0", mom=2, sampler=sampler, dtype="f8", out=group_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_resample_jackknife_data() -> None:
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float32, axis=0, mom_ndim=1),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float64, axis=0, mom_ndim=1),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_arrayany, axis=0, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_any, axis=0, mom_ndim=1),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataarray, dim="dim_0", mom_ndim=1),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataset, dim="dim_0", mom_ndim=1),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataarray_any, dim="dim_0", mom_ndim=1),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataset_any, dim="dim_0", mom_ndim=1),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_arraylike, axis=0, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float32, axis=0, mom_ndim=1, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float64, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_arrayany, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_arraylike, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_any, axis=0, mom_ndim=1, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float32, axis=0, mom_ndim=1, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataarray, dim="dim_0", mom_ndim=1, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataset, dim="dim_0", mom_ndim=1, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataarray_any, dim="dim_0", mom_ndim=1, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float32, axis=0, mom_ndim=1, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_arraylike, axis=0, mom_ndim=1, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_any, axis=0, mom_ndim=1, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float32, axis=0, mom_ndim=1, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataarray, dim="dim_0", mom_ndim=1, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataarray_any, dim="dim_0", mom_ndim=1, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float32, axis=0, mom_ndim=1, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_arraylike, axis=0, mom_ndim=1, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_any, axis=0, mom_ndim=1, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_float32, axis=0, mom_ndim=1, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_data(data_dataarray, dim="dim_0", mom_ndim=1, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_resample_jackknife_vals() -> None:
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float32, axis=0, mom=2),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float64, axis=0, mom=2),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_arrayany, axis=0, mom=2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_any, axis=0, mom=2),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataarray, dim="dim_0", mom=2),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataset, dim="dim_0", mom=2),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataarray_any, dim="dim_0", mom=2),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataset_any, dim="dim_0", mom=2),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_arraylike, axis=0, mom=2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float32, axis=0, mom=2, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float64, axis=0, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_arrayany, axis=0, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_arraylike, axis=0, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_any, axis=0, mom=2, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float32, axis=0, mom=2, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataarray, dim="dim_0", mom=2, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataset, dim="dim_0", mom=2, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataarray_any, dim="dim_0", mom=2, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float32, axis=0, mom=2, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_arraylike, axis=0, mom=2, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_any, axis=0, mom=2, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float32, axis=0, mom=2, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataarray, dim="dim_0", mom=2, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataarray_any, dim="dim_0", mom=2, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float32, axis=0, mom=2, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_arraylike, axis=0, mom=2, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_any, axis=0, mom=2, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_float32, axis=0, mom=2, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.resample.jackknife_vals(vals_dataarray, dim="dim_0", mom=2, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_convert_moments_type() -> None:
    check(
        assert_type(
            cmomy.convert.moments_type(data_float32, mom_ndim=1),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_float64, mom_ndim=1),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_arrayany, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_any, mom_ndim=1),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataarray, mom_ndim=1),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataset, mom_ndim=1),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataarray_any, mom_ndim=1),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataset_any, mom_ndim=1),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_arraylike, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_float32, mom_ndim=1, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_float64, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_arrayany, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_arraylike, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_any, mom_ndim=1, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_float32, mom_ndim=1, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataarray, mom_ndim=1, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataset, mom_ndim=1, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataarray_any, mom_ndim=1, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_float32, mom_ndim=1, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_arraylike, mom_ndim=1, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_any, mom_ndim=1, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_float32, mom_ndim=1, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataarray, mom_ndim=1, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataarray_any, mom_ndim=1, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_float32, mom_ndim=1, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_arraylike, mom_ndim=1, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_any, mom_ndim=1, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_float32, mom_ndim=1, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.moments_type(data_dataarray, mom_ndim=1, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_convert_cumulative() -> None:
    check(
        assert_type(
            cmomy.convert.cumulative(data_float32, axis=0, mom_ndim=1),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_float64, axis=0, mom_ndim=1),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_arrayany, axis=0, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_any, axis=0, mom_ndim=1),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataarray, dim="dim_0", mom_ndim=1),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataset, dim="dim_0", mom_ndim=1),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataarray_any, dim="dim_0", mom_ndim=1),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataset_any, dim="dim_0", mom_ndim=1),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_arraylike, axis=0, mom_ndim=1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_float32, axis=0, mom_ndim=1, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_float64, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_arrayany, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_arraylike, axis=0, mom_ndim=1, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_any, axis=0, mom_ndim=1, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_float32, axis=0, mom_ndim=1, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataarray, dim="dim_0", mom_ndim=1, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataset, dim="dim_0", mom_ndim=1, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataarray_any, dim="dim_0", mom_ndim=1, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_float32, axis=0, mom_ndim=1, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_arraylike, axis=0, mom_ndim=1, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_any, axis=0, mom_ndim=1, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_float32, axis=0, mom_ndim=1, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataarray, dim="dim_0", mom_ndim=1, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataarray_any, dim="dim_0", mom_ndim=1, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_float32, axis=0, mom_ndim=1, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_arraylike, axis=0, mom_ndim=1, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_any, axis=0, mom_ndim=1, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_float32, axis=0, mom_ndim=1, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.cumulative(data_dataarray, dim="dim_0", mom_ndim=1, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_utils_vals_to_data() -> None:
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float32, mom=2),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float64, mom=2),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_arrayany, mom=2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_any, mom=2),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataarray, mom=2),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataset, mom=2),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataarray_any, mom=2),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataset_any, mom=2),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_arraylike, mom=2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float32, mom=2, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float64, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_arrayany, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_arraylike, mom=2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_any, mom=2, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float32, mom=2, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataarray, mom=2, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataset, mom=2, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataarray_any, mom=2, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float32, mom=2, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_arraylike, mom=2, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_any, mom=2, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float32, mom=2, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataarray, mom=2, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataarray_any, mom=2, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float32, mom=2, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_arraylike, mom=2, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_any, mom=2, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_float32, mom=2, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.utils.vals_to_data(vals_dataarray, mom=2, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_rolling_rolling_vals() -> None:
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float32, axis=0, mom=2, window=3),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float64, axis=0, mom=2, window=3),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_arrayany, axis=0, mom=2, window=3),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_any, axis=0, mom=2, window=3),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataarray, dim="dim_0", mom=2, window=3),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataset, dim="dim_0", mom=2, window=3),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataarray_any, dim="dim_0", mom=2, window=3),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataset_any, dim="dim_0", mom=2, window=3),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_arraylike, axis=0, mom=2, window=3),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float32, axis=0, mom=2, window=3, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float64, axis=0, mom=2, window=3, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_arrayany, axis=0, mom=2, window=3, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_arraylike, axis=0, mom=2, window=3, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_any, axis=0, mom=2, window=3, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float32, axis=0, mom=2, window=3, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataarray, dim="dim_0", mom=2, window=3, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataset, dim="dim_0", mom=2, window=3, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataarray_any, dim="dim_0", mom=2, window=3, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float32, axis=0, mom=2, window=3, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_arraylike, axis=0, mom=2, window=3, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_any, axis=0, mom=2, window=3, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float32, axis=0, mom=2, window=3, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataarray, dim="dim_0", mom=2, window=3, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataarray_any, dim="dim_0", mom=2, window=3, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float32, axis=0, mom=2, window=3, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_arraylike, axis=0, mom=2, window=3, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_any, axis=0, mom=2, window=3, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_float32, axis=0, mom=2, window=3, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_vals(vals_dataarray, dim="dim_0", mom=2, window=3, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_rolling_rolling_data() -> None:
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float32, axis=0, mom_ndim=1, window=3),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float64, axis=0, mom_ndim=1, window=3),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_arrayany, axis=0, mom_ndim=1, window=3),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_any, axis=0, mom_ndim=1, window=3),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataarray, dim="dim_0", mom_ndim=1, window=3),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataset, dim="dim_0", mom_ndim=1, window=3),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataarray_any, dim="dim_0", mom_ndim=1, window=3),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataset_any, dim="dim_0", mom_ndim=1, window=3),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_arraylike, axis=0, mom_ndim=1, window=3),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float32, axis=0, mom_ndim=1, window=3, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float64, axis=0, mom_ndim=1, window=3, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_arrayany, axis=0, mom_ndim=1, window=3, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_arraylike, axis=0, mom_ndim=1, window=3, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_any, axis=0, mom_ndim=1, window=3, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float32, axis=0, mom_ndim=1, window=3, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataarray, dim="dim_0", mom_ndim=1, window=3, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataset, dim="dim_0", mom_ndim=1, window=3, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataarray_any, dim="dim_0", mom_ndim=1, window=3, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float32, axis=0, mom_ndim=1, window=3, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_arraylike, axis=0, mom_ndim=1, window=3, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_any, axis=0, mom_ndim=1, window=3, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float32, axis=0, mom_ndim=1, window=3, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataarray, dim="dim_0", mom_ndim=1, window=3, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataarray_any, dim="dim_0", mom_ndim=1, window=3, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float32, axis=0, mom_ndim=1, window=3, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_arraylike, axis=0, mom_ndim=1, window=3, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_any, axis=0, mom_ndim=1, window=3, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_float32, axis=0, mom_ndim=1, window=3, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_data(data_dataarray, dim="dim_0", mom_ndim=1, window=3, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_rolling_rolling_exp_vals() -> None:
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float32, axis=0, mom=2, alpha=0.2),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float64, axis=0, mom=2, alpha=0.2),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_arrayany, axis=0, mom=2, alpha=0.2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_any, axis=0, mom=2, alpha=0.2),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataarray, dim="dim_0", mom=2, alpha=0.2),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataset, dim="dim_0", mom=2, alpha=0.2),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataarray_any, dim="dim_0", mom=2, alpha=0.2),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataset_any, dim="dim_0", mom=2, alpha=0.2),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_arraylike, axis=0, mom=2, alpha=0.2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float32, axis=0, mom=2, alpha=0.2, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float64, axis=0, mom=2, alpha=0.2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_arrayany, axis=0, mom=2, alpha=0.2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_arraylike, axis=0, mom=2, alpha=0.2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_any, axis=0, mom=2, alpha=0.2, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float32, axis=0, mom=2, alpha=0.2, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataarray, dim="dim_0", mom=2, alpha=0.2, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataset, dim="dim_0", mom=2, alpha=0.2, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataarray_any, dim="dim_0", mom=2, alpha=0.2, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float32, axis=0, mom=2, alpha=0.2, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_arraylike, axis=0, mom=2, alpha=0.2, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_any, axis=0, mom=2, alpha=0.2, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float32, axis=0, mom=2, alpha=0.2, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataarray, dim="dim_0", mom=2, alpha=0.2, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataarray_any, dim="dim_0", mom=2, alpha=0.2, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float32, axis=0, mom=2, alpha=0.2, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_arraylike, axis=0, mom=2, alpha=0.2, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_any, axis=0, mom=2, alpha=0.2, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_float32, axis=0, mom=2, alpha=0.2, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_vals(vals_dataarray, dim="dim_0", mom=2, alpha=0.2, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_rolling_rolling_exp_data() -> None:
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float32, axis=0, mom_ndim=1, alpha=0.2),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float64, axis=0, mom_ndim=1, alpha=0.2),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_arrayany, axis=0, mom_ndim=1, alpha=0.2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_any, axis=0, mom_ndim=1, alpha=0.2),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataarray, dim="dim_0", mom_ndim=1, alpha=0.2),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataset, dim="dim_0", mom_ndim=1, alpha=0.2),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataarray_any, dim="dim_0", mom_ndim=1, alpha=0.2),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataset_any, dim="dim_0", mom_ndim=1, alpha=0.2),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_arraylike, axis=0, mom_ndim=1, alpha=0.2),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float32, axis=0, mom_ndim=1, alpha=0.2, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float64, axis=0, mom_ndim=1, alpha=0.2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_arrayany, axis=0, mom_ndim=1, alpha=0.2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_arraylike, axis=0, mom_ndim=1, alpha=0.2, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_any, axis=0, mom_ndim=1, alpha=0.2, dtype=float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float32, axis=0, mom_ndim=1, alpha=0.2, dtype="f8"),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataarray, dim="dim_0", mom_ndim=1, alpha=0.2, dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataset, dim="dim_0", mom_ndim=1, alpha=0.2, dtype=float32),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataarray_any, dim="dim_0", mom_ndim=1, alpha=0.2, dtype=float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float32, axis=0, mom_ndim=1, alpha=0.2, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_arraylike, axis=0, mom_ndim=1, alpha=0.2, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_any, axis=0, mom_ndim=1, alpha=0.2, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float32, axis=0, mom_ndim=1, alpha=0.2, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataarray, dim="dim_0", mom_ndim=1, alpha=0.2, out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataarray_any, dim="dim_0", mom_ndim=1, alpha=0.2, out=transform_out_float32),
            Any,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float32, axis=0, mom_ndim=1, alpha=0.2, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_arraylike, axis=0, mom_ndim=1, alpha=0.2, dtype=float32, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_any, axis=0, mom_ndim=1, alpha=0.2, dtype=float64, out=transform_out_float32),
            Any,
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_float32, axis=0, mom_ndim=1, alpha=0.2, dtype=float64, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.rolling.rolling_exp_data(data_dataarray, dim="dim_0", mom_ndim=1, alpha=0.2, dtype="f8", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_cmomy_moveaxis() -> None:
    check(
        assert_type(
            cmomy.moveaxis(data_float32, 0, 1),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.moveaxis(data_float64, 0, 1),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.moveaxis(data_arrayany, 0, 1),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.moveaxis(data_any, 0, 1),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.moveaxis(data_dataarray, 0, 1),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.moveaxis(data_dataarray_any, 0, 1),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )


def test_cmomy_wrap() -> None:
    check(
        assert_type(
            cmomy.wrap(data_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap(data_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap(data_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap(data_arraylike),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap(data_any),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap(data_dataarray),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap(data_dataset),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap(data_dataarray_any),
            Any,
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap(data_dataset_any),
            Any,
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap(data_float32, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap(data_arraylike, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap(data_any, dtype=float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap(data_dataarray, dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap(data_dataset, dtype=float32),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap(data_dataarray_any, dtype=float32),
            Any,
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_cmomy_wrap_reduce_vals() -> None:
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_float32, axis=0, mom=2),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_float64, axis=0, mom=2),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_arrayany, axis=0, mom=2),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_arraylike, axis=0, mom=2),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_any, axis=0, mom=2),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataarray, dim="dim_0", mom=2),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataset, dim="dim_0", mom=2),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataarray_any, dim="dim_0", mom=2),
            Any,
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataset_any, dim="dim_0", mom=2),
            Any,
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_float32, axis=0, mom=2, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_arraylike, axis=0, mom=2, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_any, axis=0, mom=2, dtype=float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataarray, dim="dim_0", mom=2, dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataset, dim="dim_0", mom=2, dtype=float32),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataarray_any, dim="dim_0", mom=2, dtype=float32),
            Any,
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_float32, axis=0, mom=2, out=reduce_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_float64, axis=0, mom=2, out=reduce_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_arraylike, axis=0, mom=2, out=reduce_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_float32, axis=0, mom=2, out=reduce_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_any, axis=0, mom=2, out=reduce_out_float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataarray, dim="dim_0", mom=2, out=reduce_out_float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataarray, dim="dim_0", mom=2, out=reduce_out_arrayany),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_reduce_vals(vals_dataarray_any, dim="dim_0", mom=2, out=reduce_out_float32),
            Any,
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_cmomy_wrap_resample_vals() -> None:
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_float32, axis=0, mom=2, sampler=sampler),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_float64, axis=0, mom=2, sampler=sampler),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_arrayany, axis=0, mom=2, sampler=sampler),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_any, axis=0, mom=2, sampler=sampler),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataarray, dim="dim_0", mom=2, sampler=sampler),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataset, dim="dim_0", mom=2, sampler=sampler),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataarray_any, dim="dim_0", mom=2, sampler=sampler),
            Any,
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataset_any, dim="dim_0", mom=2, sampler=sampler),
            Any,
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_any, axis=0, mom=2, sampler=sampler, dtype=float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataarray, dim="dim_0", mom=2, sampler=sampler, dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataset, dim="dim_0", mom=2, sampler=sampler, dtype=float32),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataarray_any, dim="dim_0", mom=2, sampler=sampler, dtype=float32),
            Any,
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, out=group_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_float64, axis=0, mom=2, sampler=sampler, out=group_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler, out=group_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, out=group_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_any, axis=0, mom=2, sampler=sampler, out=group_out_float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataarray, dim="dim_0", mom=2, sampler=sampler, out=group_out_float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataarray, dim="dim_0", mom=2, sampler=sampler, out=group_out_arrayany),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_resample_vals(vals_dataarray_any, dim="dim_0", mom=2, sampler=sampler, out=group_out_float32),
            Any,
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_cmomy_wrap_raw() -> None:
    check(
        assert_type(
            cmomy.wrap_raw(data_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_arraylike),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_any),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataarray),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataset),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataarray_any),
            Any,
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataset_any),
            Any,
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_float32, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_arraylike, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_any, dtype=float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataarray, dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataset, dtype=float32),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataarray_any, dtype=float32),
            Any,
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_float32, out=transform_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_float64, out=transform_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_arraylike, out=transform_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_float32, out=transform_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_any, out=transform_out_float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataarray, out=transform_out_float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataarray, out=transform_out_arrayany),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.wrap_raw(data_dataarray_any, out=transform_out_float32),
            Any,
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_cmomy_CentralMomentsArray() -> None:
    check(
        assert_type(
            cmomy.CentralMomentsArray(data_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray(data_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray(data_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray(data_arraylike),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray(data_any),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray(data_float32, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray(data_arraylike, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray(data_any, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )


def test_cmomy_CentralMomentsArray_from_vals() -> None:
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_float32, axis=0, mom=2),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_float64, axis=0, mom=2),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_arrayany, axis=0, mom=2),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_arraylike, axis=0, mom=2),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_any, axis=0, mom=2),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_float32, axis=0, mom=2, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_arraylike, axis=0, mom=2, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_any, axis=0, mom=2, dtype=float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_float32, axis=0, mom=2, out=group_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_arrayany, axis=0, mom=2, dtype=float64, out=group_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_vals(vals_any, axis=0, mom=2, out=group_out_float64),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )


def test_cmomy_CentralMomentsArray_from_resample_vals() -> None:
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_float32, axis=0, mom=2, sampler=sampler),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_float64, axis=0, mom=2, sampler=sampler),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_arrayany, axis=0, mom=2, sampler=sampler),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_any, axis=0, mom=2, sampler=sampler),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_arraylike, axis=0, mom=2, sampler=sampler, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_any, axis=0, mom=2, sampler=sampler, dtype=float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_float32, axis=0, mom=2, sampler=sampler, out=group_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_arrayany, axis=0, mom=2, sampler=sampler, dtype=float64, out=group_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_resample_vals(vals_any, axis=0, mom=2, sampler=sampler, out=group_out_float64),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )


def test_cmomy_CentralMomentsArray_from_raw() -> None:
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_float32, mom_ndim=1),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_float64, mom_ndim=1),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_arrayany, mom_ndim=1),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_arraylike, mom_ndim=1),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_any, mom_ndim=1),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_float32, mom_ndim=1, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_arraylike, mom_ndim=1, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_any, mom_ndim=1, dtype=float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_float32, mom_ndim=1, out=transform_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_arrayany, mom_ndim=1, dtype=float64, out=transform_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.CentralMomentsArray.from_raw(data_any, mom_ndim=1, out=transform_out_float64),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )


def test_cmomy_CentralMomentsData() -> None:
    check(
        assert_type(
            cmomy.CentralMomentsData(data_dataarray),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.CentralMomentsData(data_dataset),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.CentralMomentsData(data_dataarray_any),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.CentralMomentsData(data_dataset_any),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )


def test_zeros() -> None:
    check(
        assert_type(
            CentralMomentsArray.zeros(mom=2),
            CentralMomentsArray[np.float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            CentralMomentsArray.zeros(mom=2, dtype=float32),
            CentralMomentsArray[np.float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            CentralMomentsArray.zeros(mom=2, dtype="f4"),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            CentralMomentsData.zeros(mom=2),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            CentralMomentsData.zeros(mom=2, dtype="f4"),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_cmomy_zeros_like() -> None:
    check(
        assert_type(
            cmomy.zeros_like(central_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_arraylike),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_any),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_dataarray),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_dataset),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_dataarray_any),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_dataset_any),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_float32, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_arraylike, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_any, dtype=float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_dataarray, dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_dataset, dtype=float32),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            cmomy.zeros_like(central_dataarray_any, dtype=float32),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_astype() -> None:
    check(
        assert_type(
            central_float32.astype(None),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        None,
        None,
    )
    check(
        assert_type(
            central_float64.astype(None),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        None,
        None,
    )
    check(
        assert_type(
            central_float64.astype(float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_arraylike.astype(None),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        None,
        None,
    )
    check(
        assert_type(
            central_arraylike.astype(float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_any.astype(float32),
            Any,
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.astype(float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset.astype(None),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataarray_any.astype(float32),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_assign_moment() -> None:
    check(
        assert_type(
            central_float64.assign_moment(weight=1),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.assign_moment(weight=1),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.assign_moment(weight=1),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.assign_moment(weight=1),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset.assign_moment(weight=1),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataarray_any.assign_moment(weight=1),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset_any.assign_moment(weight=1),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )


def test_moments_to_comoments() -> None:
    check(
        assert_type(
            central_float64.moments_to_comoments(mom=(1, -1)),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.moments_to_comoments(mom=(1, -1)),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.moments_to_comoments(mom=(1, -1)),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.moments_to_comoments(mom=(1, -1)),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset.moments_to_comoments(mom=(1, -1)),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataarray_any.moments_to_comoments(mom=(1, -1)),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset_any.moments_to_comoments(mom=(1, -1)),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_float32.moments_to_comoments(mom=(1, -1), dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float64.moments_to_comoments(mom=(1, -1), dtype="f4"),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_arraylike.moments_to_comoments(mom=(1, -1), dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.moments_to_comoments(mom=(1, -1), dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_resample_and_reduce() -> None:
    check(
        assert_type(
            central_float64.resample_and_reduce(axis=0, sampler=sampler),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.resample_and_reduce(axis=0, sampler=sampler),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.resample_and_reduce(axis=0, sampler=sampler),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.resample_and_reduce(dim="dim_0", sampler=sampler),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset.resample_and_reduce(dim="dim_0", sampler=sampler),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataarray_any.resample_and_reduce(dim="dim_0", sampler=sampler),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset_any.resample_and_reduce(dim="dim_0", sampler=sampler),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_float32.resample_and_reduce(axis=0, sampler=sampler, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float64.resample_and_reduce(axis=0, sampler=sampler, dtype="f4"),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_arraylike.resample_and_reduce(axis=0, sampler=sampler, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.resample_and_reduce(dim="dim_0", sampler=sampler, dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            central_float32.resample_and_reduce(axis=0, sampler=sampler, out=group_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float32.resample_and_reduce(axis=0, sampler=sampler, out=group_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.resample_and_reduce(axis=0, sampler=sampler, dtype=float64, out=group_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.resample_and_reduce(dim="dim_0", sampler=sampler, out=group_out_float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_jackknife_and_reduce() -> None:
    check(
        assert_type(
            central_float64.jackknife_and_reduce(axis=0),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.jackknife_and_reduce(axis=0),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.jackknife_and_reduce(axis=0),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.jackknife_and_reduce(dim="dim_0"),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset.jackknife_and_reduce(dim="dim_0"),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataarray_any.jackknife_and_reduce(dim="dim_0"),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset_any.jackknife_and_reduce(dim="dim_0"),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_float32.jackknife_and_reduce(axis=0, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float64.jackknife_and_reduce(axis=0, dtype="f4"),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_arraylike.jackknife_and_reduce(axis=0, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.jackknife_and_reduce(dim="dim_0", dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            central_float32.jackknife_and_reduce(axis=0, out=transform_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float32.jackknife_and_reduce(axis=0, out=transform_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.jackknife_and_reduce(axis=0, dtype=float64, out=transform_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.jackknife_and_reduce(dim="dim_0", out=transform_out_float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_reduce() -> None:
    check(
        assert_type(
            central_float64.reduce(axis=0),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.reduce(axis=0),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.reduce(axis=0),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.reduce(dim="dim_0"),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset.reduce(dim="dim_0"),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataarray_any.reduce(dim="dim_0"),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset_any.reduce(dim="dim_0"),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_float32.reduce(axis=0, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float64.reduce(axis=0, dtype="f4"),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_arraylike.reduce(axis=0, dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.reduce(dim="dim_0", dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            central_float32.reduce(axis=0, out=reduce_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float32.reduce(axis=0, out=reduce_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.reduce(axis=0, dtype=float64, out=reduce_out_float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.reduce(dim="dim_0", out=reduce_out_float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_moveaxis() -> None:
    check(
        assert_type(
            central_float64.moveaxis(0, 0),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.moveaxis(0, 0),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.moveaxis(0, 0),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.moveaxis(0, 0),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataarray_any.moveaxis(0, 0),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )


def test_reshape() -> None:
    check(
        assert_type(
            central_float64.reshape((2, 5)),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.reshape((2, 5)),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.reshape((2, 5)),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )


def test_new_like() -> None:
    check(
        assert_type(
            central_float64.new_like(),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.new_like(),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.new_like(),
            Any,
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.new_like(),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset.new_like(),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataarray_any.new_like(),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        float64,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset_any.new_like(),
            CentralMomentsData[Any],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_float32.new_like(dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float64.new_like(dtype="f4"),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_arraylike.new_like(dtype=float32),
            CentralMomentsArray[float32],
        ),
        CentralMomentsArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.new_like(dtype=float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )
    check(
        assert_type(
            central_float32.new_like(transform_out_float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float32.new_like(transform_out_arrayany),
            CentralMomentsArray[Any],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.new_like(transform_out_float32, dtype=float64),
            CentralMomentsArray[float64],
        ),
        CentralMomentsArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.new_like(transform_out_float32),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        float32,
        xr.DataArray,
    )


def test_cumulative() -> None:
    check(
        assert_type(
            central_float64.cumulative(axis=0),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.cumulative(axis=0),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            central_any.cumulative(axis=0),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataarray.cumulative(dim="dim_0"),
            xr.DataArray,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataset.cumulative(dim="dim_0"),
            xr.Dataset,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            central_dataarray_any.cumulative(dim="dim_0"),
            Any,
        ),
        xr.DataArray,
        float64,
        None,
    )
    check(
        assert_type(
            central_dataset_any.cumulative(dim="dim_0"),
            Any,
        ),
        xr.Dataset,
        None,
        None,
    )
    check(
        assert_type(
            central_float32.cumulative(axis=0, dtype=float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float64.cumulative(axis=0, dtype="f4"),
            NDArray[Any],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            central_arraylike.cumulative(axis=0, dtype=float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.cumulative(dim="dim_0", dtype=float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )
    check(
        assert_type(
            central_float32.cumulative(axis=0, out=transform_out_float64),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            central_float32.cumulative(axis=0, out=transform_out_arrayany),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            central_arraylike.cumulative(axis=0, dtype=float64, out=transform_out_float32),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            central_dataarray.cumulative(dim="dim_0", out=transform_out_float32),
            xr.DataArray,
        ),
        xr.DataArray,
        float32,
        None,
    )


def test_to_dataarray() -> None:
    check(
        assert_type(
            central_float64.to_dataarray(),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        None,
        xr.DataArray,
    )
    check(
        assert_type(
            central_arraylike.to_dataarray(),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        None,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataarray.to_dataarray(),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        None,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataarray_any.to_dataarray(),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        None,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset.to_dataarray(),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        None,
        xr.DataArray,
    )
    check(
        assert_type(
            central_dataset_any.to_dataarray(),
            CentralMomentsData[xr.DataArray],
        ),
        CentralMomentsData,
        None,
        xr.DataArray,
    )


def test_to_dataset() -> None:
    check(
        assert_type(
            central_dataarray.to_dataset(),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataarray_any.to_dataset(),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataset.to_dataset(),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )
    check(
        assert_type(
            central_dataset_any.to_dataset(),
            CentralMomentsData[xr.Dataset],
        ),
        CentralMomentsData,
        None,
        xr.Dataset,
    )


def test_iterators() -> None:
    from collections.abc import ItemsView, KeysView, ValuesView

    assert_type(iter(central_float64), Iterator[CentralMomentsArray[np.float64]])
    assert_type(iter(central_dataarray), Iterator[CentralMomentsData[xr.DataArray]])
    # TODO(wpk): problem with mypy and __iter__ overload....
    # assert_type(iter(central_dataset), Iterator[Hashable])  # noqa: ERA001
    assert_type(central_dataarray.__iter__(), Iterator[CentralMomentsData[xr.DataArray]])
    assert_type(central_dataset.__iter__(), Iterator[Hashable])
    assert_type(central_dataarray.iter(), Iterator[CentralMomentsData[xr.DataArray]])
    assert_type(central_dataset.iter(), Iterator[Hashable])
    assert_type(central_dataset.keys(), KeysView[Hashable])
    assert_type(central_dataset.values(), ValuesView[CentralMomentsData[xr.DataArray]])
    assert_type(central_dataset.items(), ItemsView[Hashable, CentralMomentsData[xr.DataArray]])



def _check_typing_sampler(
    idx_array: NDArrayAny,
    idx_dataarray: xr.DataArray,
    idx_dataset: xr.Dataset,
    freq_array: NDArrayAny,
    freq_dataarray: xr.DataArray,
    freq_dataset: xr.Dataset,
    data_array: NDArrayAny,
    data_dataarray: xr.DataArray,
    data_dataset: xr.Dataset,
) -> None:
    from cmomy import IndexSampler

    assert_type(IndexSampler.from_params(10, 20), IndexSampler[NDArrayAny])

    assert_type(IndexSampler(indices=idx_array), IndexSampler[NDArrayAny])
    assert_type(IndexSampler(indices=idx_dataarray), IndexSampler[xr.DataArray])
    assert_type(IndexSampler(indices=idx_dataset), IndexSampler[xr.Dataset])

    assert_type(IndexSampler(freq=freq_array), IndexSampler[NDArrayAny])
    assert_type(IndexSampler(freq=freq_dataarray), IndexSampler[xr.DataArray])
    assert_type(IndexSampler(freq=freq_dataset), IndexSampler[xr.Dataset])

    a = IndexSampler(indices=idx_array)
    assert_type(a.freq, NDArrayAny)
    assert_type(a.indices, NDArrayAny)

    b = IndexSampler(indices=idx_dataarray)
    assert_type(b.freq, xr.DataArray)
    assert_type(b.indices, xr.DataArray)

    c = IndexSampler(indices=idx_dataset)
    assert_type(c.freq, xr.Dataset)
    assert_type(c.indices, xr.Dataset)

    assert_type(IndexSampler.from_data(data_array, nrep=100), IndexSampler[NDArrayAny])
    assert_type(
        IndexSampler.from_data(data_dataarray, nrep=100), IndexSampler[xr.DataArray]
    )
    assert_type(
        IndexSampler.from_data(data_dataset, nrep=100), IndexSampler[xr.DataArray]
    )

    d = IndexSampler.from_data(data_dataset, nrep=100, paired=False)
    assert_type(d, IndexSampler[xr.DataArray | xr.Dataset])

    assert_type(d.indices, xr.DataArray | xr.Dataset)
    assert_type(d.indices, xr.DataArray | xr.Dataset)

    check(
        assert_type(
            cmomy.convert.concat((data_float32, data_float32), axis=0),
            NDArray[float32],
        ),
        np.ndarray,
        float32,
        None,
    )
    check(
        assert_type(
            cmomy.convert.concat((data_float64, data_float64), axis=0),
            NDArray[float64],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.concat((data_arrayany, data_arrayany), axis=0),
            NDArray[Any],
        ),
        np.ndarray,
        float64,
        None,
    )
    check(
        assert_type(
            cmomy.convert.concat((data_any, data_any), axis=0),
            Any,
        ),
        np.ndarray,
        float64,
        None,
    )
