(self)
| 2013 | assert_identical(expected, selected) |
| 2014 | |
| 2015 | def test_head(self) -> None: |
| 2016 | data = create_test_data() |
| 2017 | |
| 2018 | expected = data.isel(time=slice(5), dim2=slice(6)) |
| 2019 | actual = data.head(time=5, dim2=6) |
| 2020 | assert_equal(expected, actual) |
| 2021 | |
| 2022 | expected = data.isel(time=slice(0)) |
| 2023 | actual = data.head(time=0) |
| 2024 | assert_equal(expected, actual) |
| 2025 | |
| 2026 | expected = data.isel({dim: slice(6) for dim in data.dims}) |
| 2027 | actual = data.head(6) |
| 2028 | assert_equal(expected, actual) |
| 2029 | |
| 2030 | expected = data.isel({dim: slice(5) for dim in data.dims}) |
| 2031 | actual = data.head() |
| 2032 | assert_equal(expected, actual) |
| 2033 | |
| 2034 | with pytest.raises(TypeError, match=r"either dict-like or a single int"): |
| 2035 | data.head([3]) # type: ignore[arg-type] |
| 2036 | with pytest.raises(TypeError, match=r"expected integer type"): |
| 2037 | data.head(dim2=3.1) |
| 2038 | with pytest.raises(ValueError, match=r"expected positive int"): |
| 2039 | data.head(time=-3) |
| 2040 | |
| 2041 | def test_tail(self) -> None: |
| 2042 | data = create_test_data() |
nothing calls this directly
no test coverage detected