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

Method test_dataset_containing_slashes

xarray/tests/test_datatree.py:125–140  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

123 assert mary.children["Sue"].name == "Sue"
124
125 def test_dataset_containing_slashes(self) -> None:
126 xda: xr.DataArray = xr.DataArray(
127 [[1, 2]],
128 coords={"label": ["a"], "R30m/y": [30, 60]},
129 )
130 xds: xr.Dataset = xr.Dataset({"group/subgroup/my_variable": xda})
131 with pytest.raises(
132 ValueError,
133 match=re.escape(
134 "Given variables have names containing the '/' character: "
135 "['R30m/y', 'group/subgroup/my_variable']. "
136 "Variables stored in DataTree objects cannot have names containing '/' characters, "
137 "as this would make path-like access to variables ambiguous."
138 ),
139 ):
140 DataTree(xds)
141
142
143class TestPaths:

Callers

nothing calls this directly

Calls 1

DataTreeClass · 0.90

Tested by

no test coverage detected