(self, unit, dtype)
| 4690 | ), |
| 4691 | ) |
| 4692 | def test_broadcast_equals(self, unit, dtype): |
| 4693 | # TODO: does this use indexes? |
| 4694 | left_array1 = np.ones(shape=(2, 3), dtype=dtype) * unit_registry.m |
| 4695 | left_array2 = np.zeros(shape=(3, 6), dtype=dtype) * unit_registry.m |
| 4696 | |
| 4697 | right_array1 = np.ones(shape=(2,)) * unit |
| 4698 | right_array2 = np.zeros(shape=(3,)) * unit |
| 4699 | |
| 4700 | left = xr.Dataset( |
| 4701 | {"a": (("x", "y"), left_array1), "b": (("y", "z"), left_array2)}, |
| 4702 | ) |
| 4703 | right = xr.Dataset({"a": ("x", right_array1), "b": ("y", right_array2)}) |
| 4704 | |
| 4705 | units = merge_mappings( |
| 4706 | extract_units(left), |
| 4707 | {} if is_compatible(left_array1, unit) else {"a": None, "b": None}, |
| 4708 | ) |
| 4709 | expected = is_compatible(left_array1, unit) and strip_units( |
| 4710 | left |
| 4711 | ).broadcast_equals(strip_units(convert_units(right, units))) |
| 4712 | actual = left.broadcast_equals(right) |
| 4713 | |
| 4714 | assert expected == actual |
| 4715 | |
| 4716 | def test_pad(self, dtype): |
| 4717 | a = np.linspace(0, 5, 10).astype(dtype) * unit_registry.Pa |
nothing calls this directly
no test coverage detected