MCPcopy
hub / github.com/pydata/xarray / test_tail

Method test_tail

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

Source from the content-addressed store, hash-verified

1289 self.dv.head(-3)
1290
1291 def test_tail(self) -> None:
1292 assert_equal(self.dv.isel(x=slice(-5, None)), self.dv.tail(x=5))
1293 assert_equal(self.dv.isel(x=slice(0)), self.dv.tail(x=0))
1294 assert_equal(
1295 self.dv.isel({dim: slice(-6, None) for dim in self.dv.dims}),
1296 self.dv.tail(6),
1297 )
1298 assert_equal(
1299 self.dv.isel({dim: slice(-5, None) for dim in self.dv.dims}), self.dv.tail()
1300 )
1301 with pytest.raises(TypeError, match=r"either dict-like or a single int"):
1302 self.dv.tail([3]) # type: ignore[arg-type]
1303 with pytest.raises(TypeError, match=r"expected integer type"):
1304 self.dv.tail(x=3.1)
1305 with pytest.raises(ValueError, match=r"expected positive int"):
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))

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
iselMethod · 0.45
tailMethod · 0.45

Tested by

no test coverage detected