MCPcopy Index your code
hub / github.com/pydata/xarray / test_thin

Method test_thin

xarray/tests/test_dataset.py:2067–2085  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2065 data.tail(time=-3)
2066
2067 def test_thin(self) -> None:
2068 data = create_test_data()
2069
2070 expected = data.isel(time=slice(None, None, 5), dim2=slice(None, None, 6))
2071 actual = data.thin(time=5, dim2=6)
2072 assert_equal(expected, actual)
2073
2074 expected = data.isel({dim: slice(None, None, 6) for dim in data.dims})
2075 actual = data.thin(6)
2076 assert_equal(expected, actual)
2077
2078 with pytest.raises(TypeError, match=r"either dict-like or a single int"):
2079 data.thin([3]) # type: ignore[arg-type]
2080 with pytest.raises(TypeError, match=r"expected integer type"):
2081 data.thin(dim2=3.1)
2082 with pytest.raises(ValueError, match=r"cannot be zero"):
2083 data.thin(time=0)
2084 with pytest.raises(ValueError, match=r"expected positive int"):
2085 data.thin(time=-3)
2086
2087 @pytest.mark.filterwarnings("ignore::FutureWarning")
2088 def test_sel_fancy(self) -> None:

Callers

nothing calls this directly

Calls 4

create_test_dataFunction · 0.90
assert_equalFunction · 0.90
iselMethod · 0.45
thinMethod · 0.45

Tested by

no test coverage detected