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

Method test_to_dataset_retains_keys

xarray/tests/test_dataarray.py:4124–4135  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4122 assert_identical(expected, actual)
4123
4124 def test_to_dataset_retains_keys(self) -> None:
4125 # use dates as convenient non-str objects. Not a specific date test
4126 import datetime
4127
4128 dates = [datetime.date(2000, 1, d) for d in range(1, 4)]
4129
4130 array = DataArray([1, 2, 3], coords=[("x", dates)], attrs={"a": 1})
4131
4132 # convert to dataset and back again
4133 result = array.to_dataset("x").to_dataarray(dim="x")
4134
4135 assert_equal(array, result)
4136
4137 def test_to_dataset_coord_value_is_dim(self) -> None:
4138 # github issue #7823

Callers

nothing calls this directly

Calls 5

to_datasetMethod · 0.95
DataArrayClass · 0.90
assert_equalFunction · 0.90
dateMethod · 0.80
to_dataarrayMethod · 0.45

Tested by

no test coverage detected