(self, fill_value, unit, error, dtype)
| 4309 | ), |
| 4310 | ) |
| 4311 | def test_fillna(self, fill_value, unit, error, dtype): |
| 4312 | array1 = ( |
| 4313 | create_nan_array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1], dtype) |
| 4314 | * unit_registry.m |
| 4315 | ) |
| 4316 | array2 = ( |
| 4317 | create_nan_array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan], dtype) |
| 4318 | * unit_registry.m |
| 4319 | ) |
| 4320 | ds = xr.Dataset({"a": ("x", array1), "b": ("x", array2)}) |
| 4321 | value = fill_value * unit |
| 4322 | units = extract_units(ds) |
| 4323 | |
| 4324 | if error is not None: |
| 4325 | with pytest.raises(error): |
| 4326 | ds.fillna(value=value) |
| 4327 | |
| 4328 | return |
| 4329 | |
| 4330 | actual = ds.fillna(value=value) |
| 4331 | expected = attach_units( |
| 4332 | strip_units(ds).fillna( |
| 4333 | value=strip_units(convert_units(value, {None: unit_registry.m})) |
| 4334 | ), |
| 4335 | units, |
| 4336 | ) |
| 4337 | |
| 4338 | assert_units_equal(expected, actual) |
| 4339 | assert_equal(expected, actual) |
| 4340 | |
| 4341 | def test_dropna(self, dtype): |
| 4342 | array1 = ( |
nothing calls this directly
no test coverage detected