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

Function test_repr_of_dataarray

xarray/tests/test_formatting_html.py:165–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163
164
165def test_repr_of_dataarray() -> None:
166 dataarray = xr.DataArray(np.random.default_rng(0).random((4, 6)))
167 formatted = xarray_html_only_repr(dataarray)
168 assert "dim_0" in formatted
169 # has an expanded data section
170 assert formatted.count("class='xr-array-in' type='checkbox' checked>") == 1
171 # coords, indexes and attrs don't have an items so they'll be omitted
172 assert "Coordinates" not in formatted
173 assert "Indexes" not in formatted
174 assert "Attributes" not in formatted
175
176 assert_consistent_text_and_html_dataarray(dataarray)
177
178 with xr.set_options(display_expand_data=False):
179 formatted = xarray_html_only_repr(dataarray)
180 assert "dim_0" in formatted
181 # has a collapsed data section
182 assert formatted.count("class='xr-array-in' type='checkbox' checked>") == 0
183 # coords, indexes and attrs don't have an items so they'll be omitted
184 assert "Coordinates" not in formatted
185 assert "Indexes" not in formatted
186 assert "Attributes" not in formatted
187
188
189def test_repr_coords_order_of_datarray() -> None:

Callers

nothing calls this directly

Calls 2

xarray_html_only_reprFunction · 0.85
countMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…