(self, shape, dim, dtype)
| 3440 | ), |
| 3441 | ) |
| 3442 | def test_squeeze(self, shape, dim, dtype): |
| 3443 | names = "xyzt" |
| 3444 | dim_lengths = dict(zip(names, shape, strict=False)) |
| 3445 | names = "xyzt" |
| 3446 | array = np.arange(10 * 20).astype(dtype).reshape(shape) * unit_registry.J |
| 3447 | data_array = xr.DataArray(data=array, dims=tuple(names[: len(shape)])) |
| 3448 | |
| 3449 | kwargs = {"dim": dim} if dim != "all" and dim_lengths.get(dim, 0) == 1 else {} |
| 3450 | |
| 3451 | expected = attach_units( |
| 3452 | strip_units(data_array).squeeze(**kwargs), extract_units(data_array) |
| 3453 | ) |
| 3454 | actual = data_array.squeeze(**kwargs) |
| 3455 | |
| 3456 | assert_units_equal(expected, actual) |
| 3457 | assert_identical(expected, actual) |
| 3458 | |
| 3459 | @pytest.mark.parametrize( |
| 3460 | "func", |
nothing calls this directly
no test coverage detected