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

Method test_replace

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

Source from the content-addressed store, hash-verified

2116 da.rename(x="x")
2117
2118 def test_replace(self) -> None:
2119 # Tests the `attrs` replacement and whether it interferes with a
2120 # `variable` replacement
2121 da = self.mda
2122 attrs1 = {"a1": "val1", "a2": 161}
2123 x = np.ones((10, 20))
2124 v = Variable(["x", "y"], x)
2125 assert da._replace(variable=v, attrs=attrs1).attrs == attrs1
2126 attrs2 = {"b1": "val2", "b2": 1312}
2127 va = Variable(["x", "y"], x, attrs2)
2128 # assuming passed `attrs` should prevail
2129 assert da._replace(variable=va, attrs=attrs1).attrs == attrs1
2130 # assuming `va.attrs` should be adopted
2131 assert da._replace(variable=va).attrs == attrs2
2132
2133 def test_init_value(self) -> None:
2134 expected = DataArray(

Callers

nothing calls this directly

Calls 2

VariableClass · 0.90
_replaceMethod · 0.45

Tested by

no test coverage detected