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

Method test_no_conflicts

xarray/tests/test_units.py:2194–2221  ·  view source on GitHub ↗
(self, unit, dtype)

Source from the content-addressed store, hash-verified

2192 ),
2193 )
2194 def test_no_conflicts(self, unit, dtype):
2195 base_unit = unit_registry.m
2196 array1 = (
2197 np.array(
2198 [
2199 [6.3, 0.3, 0.45],
2200 [np.nan, 0.3, 0.3],
2201 [3.7, np.nan, 0.2],
2202 [9.43, 0.3, 0.7],
2203 ]
2204 )
2205 * base_unit
2206 )
2207 array2 = np.array([np.nan, 0.3, np.nan]) * unit
2208
2209 variable = xr.Variable(("x", "y"), array1)
2210 other = xr.Variable("y", array2)
2211
2212 expected = strip_units(variable).no_conflicts(
2213 strip_units(
2214 convert_units(
2215 other, {None: base_unit if is_compatible(base_unit, unit) else None}
2216 )
2217 )
2218 ) & is_compatible(base_unit, unit)
2219 actual = variable.no_conflicts(other)
2220
2221 assert expected == actual
2222
2223 @pytest.mark.parametrize(
2224 "mode",

Callers

nothing calls this directly

Calls 4

no_conflictsMethod · 0.95
strip_unitsFunction · 0.85
convert_unitsFunction · 0.85
is_compatibleFunction · 0.85

Tested by

no test coverage detected