(dtype)
| 665 | |
| 666 | |
| 667 | def test_broadcast_dataarray(dtype): |
| 668 | # uses align internally so more thorough tests are not needed |
| 669 | array1 = np.linspace(0, 10, 2) * unit_registry.Pa |
| 670 | array2 = np.linspace(0, 10, 3) * unit_registry.Pa |
| 671 | |
| 672 | a = xr.DataArray(data=array1, dims="x") |
| 673 | b = xr.DataArray(data=array2, dims="y") |
| 674 | |
| 675 | units_a = extract_units(a) |
| 676 | units_b = extract_units(b) |
| 677 | expected_a, expected_b = xr.broadcast(strip_units(a), strip_units(b)) |
| 678 | expected_a = attach_units(expected_a, units_a) |
| 679 | expected_b = convert_units(attach_units(expected_b, units_a), units_b) |
| 680 | |
| 681 | actual_a, actual_b = xr.broadcast(a, b) |
| 682 | |
| 683 | assert_units_equal(expected_a, actual_a) |
| 684 | assert_identical(expected_a, actual_a) |
| 685 | assert_units_equal(expected_b, actual_b) |
| 686 | assert_identical(expected_b, actual_b) |
| 687 | |
| 688 | |
| 689 | def test_broadcast_dataset(dtype): |
nothing calls this directly
no test coverage detected
searching dependent graphs…