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

Function test_roundtrip_dataarray

properties/test_pandas_roundtrip.py:80–89  ·  view source on GitHub ↗
(data, arr)

Source from the content-addressed store, hash-verified

78
79@given(st.data(), an_array)
80def test_roundtrip_dataarray(data, arr) -> None:
81 names = data.draw(
82 st.lists(st.text(), min_size=arr.ndim, max_size=arr.ndim, unique=True).map(
83 tuple
84 )
85 )
86 coords = {name: np.arange(n) for (name, n) in zip(names, arr.shape, strict=True)}
87 original = xr.DataArray(arr, dims=names, coords=coords)
88 roundtripped = xr.DataArray(original.to_pandas())
89 xr.testing.assert_identical(original, roundtripped)
90
91
92@given(datasets_1d_vars())

Callers

nothing calls this directly

Calls 3

to_pandasMethod · 0.95
arangeMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…