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

Method test_thin

xarray/tests/test_dataarray.py:1308–1321  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1306 self.dv.tail(-3)
1307
1308 def test_thin(self) -> None:
1309 assert_equal(self.dv.isel(x=slice(None, None, 5)), self.dv.thin(x=5))
1310 assert_equal(
1311 self.dv.isel({dim: slice(None, None, 6) for dim in self.dv.dims}),
1312 self.dv.thin(6),
1313 )
1314 with pytest.raises(TypeError, match=r"either dict-like or a single int"):
1315 self.dv.thin([3]) # type: ignore[arg-type]
1316 with pytest.raises(TypeError, match=r"expected integer type"):
1317 self.dv.thin(x=3.1)
1318 with pytest.raises(ValueError, match=r"expected positive int"):
1319 self.dv.thin(-3)
1320 with pytest.raises(ValueError, match=r"cannot be zero"):
1321 self.dv.thin(time=0)
1322
1323 def test_loc(self) -> None:
1324 self.ds["x"] = ("x", np.array(list("abcdefghij")))

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
iselMethod · 0.45
thinMethod · 0.45

Tested by

no test coverage detected