MCPcopy Create free account
hub / github.com/pydata/xarray / test_repr_of_dataset

Function test_repr_of_dataset

xarray/tests/test_formatting_html.py:223–251  ·  view source on GitHub ↗
(dataset: xr.Dataset)

Source from the content-addressed store, hash-verified

221
222
223def test_repr_of_dataset(dataset: xr.Dataset) -> None:
224 formatted = xarray_html_only_repr(dataset)
225 # coords, attrs, and data_vars are expanded
226 assert (
227 formatted.count("class='xr-section-summary-in' type='checkbox' checked />") == 3
228 )
229 # indexes is omitted
230 assert "Indexes" not in formatted
231 assert "<U4" in formatted or ">U4" in formatted
232 assert "<IA>" in formatted
233
234 assert_consistent_text_and_html_dataset(dataset)
235
236 with xr.set_options(
237 display_expand_coords=False,
238 display_expand_data_vars=False,
239 display_expand_attrs=False,
240 display_expand_indexes=True,
241 display_default_indexes=True,
242 ):
243 formatted = xarray_html_only_repr(dataset)
244 # coords, attrs, and data_vars are collapsed, indexes is shown & expanded
245 assert (
246 formatted.count("class='xr-section-summary-in' type='checkbox' checked />")
247 == 1
248 )
249 assert "Indexes" in formatted
250 assert "<U4" in formatted or ">U4" in formatted
251 assert "<IA>" in formatted
252
253
254def test_repr_text_fallback(dataset: xr.Dataset) -> 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…