(self)
| 150 | assert expected == repr(mda_long) |
| 151 | |
| 152 | def test_properties(self) -> None: |
| 153 | assert_equal(self.dv.variable, self.v) |
| 154 | assert_array_equal(self.dv.values, self.v.values) |
| 155 | for attr in ["dims", "dtype", "shape", "size", "nbytes", "ndim", "attrs"]: |
| 156 | assert getattr(self.dv, attr) == getattr(self.v, attr) |
| 157 | assert len(self.dv) == len(self.v) |
| 158 | assert_equal(self.dv.variable, self.v) |
| 159 | assert set(self.dv.coords) == set(self.ds.coords) |
| 160 | for k, v in self.dv.coords.items(): |
| 161 | assert_array_equal(v, self.ds.coords[k]) |
| 162 | with pytest.raises(AttributeError): |
| 163 | _ = self.dv.dataset |
| 164 | assert isinstance(self.ds["x"].to_index(), pd.Index) |
| 165 | with pytest.raises(ValueError, match=r"must be 1-dimensional"): |
| 166 | self.ds["foo"].to_index() |
| 167 | with pytest.raises(AttributeError): |
| 168 | self.dv.variable = self.v # type: ignore[misc] |
| 169 | |
| 170 | def test_data_property(self) -> None: |
| 171 | array = DataArray(np.zeros((3, 4))) |
nothing calls this directly
no test coverage detected