(self, unit, error, dtype)
| 2262 | ), |
| 2263 | ) |
| 2264 | def test_pad_unit_constant_value(self, unit, error, dtype): |
| 2265 | array = np.linspace(0, 5, 3 * 10).reshape(3, 10).astype(dtype) * unit_registry.m |
| 2266 | variable = xr.Variable(("x", "y"), array) |
| 2267 | |
| 2268 | fill_value = -100 * unit |
| 2269 | |
| 2270 | func = method("pad", mode="constant", x=(2, 3), y=(1, 4)) |
| 2271 | if error is not None: |
| 2272 | with pytest.raises(error): |
| 2273 | func(variable, constant_values=fill_value) |
| 2274 | |
| 2275 | return |
| 2276 | |
| 2277 | units = extract_units(variable) |
| 2278 | expected = attach_units( |
| 2279 | func( |
| 2280 | strip_units(variable), |
| 2281 | constant_values=strip_units(convert_units(fill_value, units)), |
| 2282 | ), |
| 2283 | units, |
| 2284 | ) |
| 2285 | actual = func(variable, constant_values=fill_value) |
| 2286 | |
| 2287 | assert_units_equal(expected, actual) |
| 2288 | assert_identical(expected, actual) |
| 2289 | |
| 2290 | |
| 2291 | class TestDataArray: |
nothing calls this directly
no test coverage detected