(self, dim, dtype)
| 2008 | |
| 2009 | @pytest.mark.parametrize("dim", ("x", "y", "z", "t", "all")) |
| 2010 | def test_squeeze(self, dim, dtype): |
| 2011 | shape = (2, 1, 3, 1, 1, 2) |
| 2012 | names = list("abcdef") |
| 2013 | dim_lengths = dict(zip(names, shape, strict=True)) |
| 2014 | array = np.ones(shape=shape) * unit_registry.m |
| 2015 | variable = xr.Variable(names, array) |
| 2016 | |
| 2017 | kwargs = {"dim": dim} if dim != "all" and dim_lengths.get(dim, 0) == 1 else {} |
| 2018 | expected = attach_units( |
| 2019 | strip_units(variable).squeeze(**kwargs), extract_units(variable) |
| 2020 | ) |
| 2021 | actual = variable.squeeze(**kwargs) |
| 2022 | |
| 2023 | assert_units_equal(expected, actual) |
| 2024 | assert_identical(expected, actual) |
| 2025 | |
| 2026 | @pytest.mark.parametrize("compute_backend", ["numbagg", None], indirect=True) |
| 2027 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected