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

Method test_chunk

xarray/tests/test_dask.py:97–111  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

95 self.assertLazyAndIdentical(self.eager_var, self.lazy_var.copy(deep=True))
96
97 def test_chunk(self):
98 test_cases: list[tuple[int | dict[str, Any], tuple[tuple[int, ...], ...]]] = [
99 ({}, ((2, 2), (2, 2, 2))),
100 (3, ((3, 1), (3, 3))),
101 ({"x": 3, "y": 3}, ((3, 1), (3, 3))),
102 ({"x": 3}, ((3, 1), (2, 2, 2))),
103 ({"x": (3, 1)}, ((3, 1), (2, 2, 2))),
104 ]
105 for chunks, expected in test_cases:
106 rechunked = self.lazy_var.chunk(chunks)
107 assert rechunked.chunks == expected
108 self.assertLazyAndIdentical(self.eager_var, rechunked)
109
110 expected_chunksizes = dict(zip(self.lazy_var.dims, expected, strict=True))
111 assert rechunked.chunksizes == expected_chunksizes
112
113 def test_indexing(self):
114 u = self.eager_var

Callers

nothing calls this directly

Calls 2

chunkMethod · 0.45

Tested by

no test coverage detected