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

Method test_set_dims

xarray/tests/test_units.py:2158–2169  ·  view source on GitHub ↗
(self, dtype)

Source from the content-addressed store, hash-verified

2156 assert_identical(expected, actual)
2157
2158 def test_set_dims(self, dtype):
2159 array = np.linspace(0, 5, 3 * 10).reshape(3, 10).astype(dtype) * unit_registry.m
2160 variable = xr.Variable(("x", "y"), array)
2161
2162 dims = {"z": 6, "x": 3, "a": 1, "b": 4, "y": 10}
2163 expected = attach_units(
2164 strip_units(variable).set_dims(dims), extract_units(variable)
2165 )
2166 actual = variable.set_dims(dims)
2167
2168 assert_units_equal(expected, actual)
2169 assert_identical(expected, actual)
2170
2171 def test_copy(self, dtype):
2172 array = np.linspace(0, 5, 10).astype(dtype) * unit_registry.m

Callers

nothing calls this directly

Calls 8

set_dimsMethod · 0.95
assert_identicalFunction · 0.90
attach_unitsFunction · 0.85
strip_unitsFunction · 0.85
extract_unitsFunction · 0.85
assert_units_equalFunction · 0.85
linspaceMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected