(self, fill_value, unit, error, dtype)
| 2811 | ), |
| 2812 | ) |
| 2813 | def test_fillna(self, fill_value, unit, error, dtype): |
| 2814 | original_unit = unit_registry.m |
| 2815 | array = ( |
| 2816 | create_nan_array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1], dtype) |
| 2817 | * original_unit |
| 2818 | ) |
| 2819 | data_array = xr.DataArray(data=array) |
| 2820 | |
| 2821 | func = method("fillna") |
| 2822 | |
| 2823 | value = fill_value * unit |
| 2824 | if error is not None: |
| 2825 | with pytest.raises(error): |
| 2826 | func(data_array, value=value) |
| 2827 | |
| 2828 | return |
| 2829 | |
| 2830 | units = extract_units(data_array) |
| 2831 | expected = attach_units( |
| 2832 | func( |
| 2833 | strip_units(data_array), value=strip_units(convert_units(value, units)) |
| 2834 | ), |
| 2835 | units, |
| 2836 | ) |
| 2837 | actual = func(data_array, value=value) |
| 2838 | |
| 2839 | assert_units_equal(expected, actual) |
| 2840 | assert_identical(expected, actual) |
| 2841 | |
| 2842 | def test_dropna(self, dtype): |
| 2843 | array = ( |
nothing calls this directly
no test coverage detected