(self, unit, dtype)
| 1835 | ), |
| 1836 | ) |
| 1837 | def test_broadcast_equals(self, unit, dtype): |
| 1838 | base_unit = unit_registry.m |
| 1839 | left_array = np.ones(shape=(2, 2), dtype=dtype) * base_unit |
| 1840 | value = ( |
| 1841 | (1 * base_unit).to(unit).magnitude if is_compatible(unit, base_unit) else 1 |
| 1842 | ) |
| 1843 | right_array = np.full(shape=(2,), fill_value=value, dtype=dtype) * unit |
| 1844 | |
| 1845 | left = xr.Variable(("x", "y"), left_array) |
| 1846 | right = xr.Variable("x", right_array) |
| 1847 | |
| 1848 | units = { |
| 1849 | **extract_units(left), |
| 1850 | **({} if is_compatible(unit, base_unit) else {None: None}), |
| 1851 | } |
| 1852 | expected = strip_units(left).broadcast_equals( |
| 1853 | strip_units(convert_units(right, units)) |
| 1854 | ) & is_compatible(unit, base_unit) |
| 1855 | actual = left.broadcast_equals(right) |
| 1856 | |
| 1857 | assert expected == actual |
| 1858 | |
| 1859 | @pytest.mark.parametrize("dask", [False, pytest.param(True, marks=[requires_dask])]) |
| 1860 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected