MCPcopy Index your code
hub / github.com/pydata/xarray / test_nbytes_does_not_load_data

Method test_nbytes_does_not_load_data

xarray/tests/test_dataarray.py:3871–3884  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3869 np.testing.assert_equal(actual_coords, expected_coords)
3870
3871 def test_nbytes_does_not_load_data(self) -> None:
3872 array = InaccessibleArray(np.zeros((3, 3), dtype="uint8"))
3873 da = xr.DataArray(array, dims=["x", "y"])
3874
3875 # If xarray tries to instantiate the InaccessibleArray to compute
3876 # nbytes, the following will raise an error.
3877 # However, it should still be able to accurately give us information
3878 # about the number of bytes from the metadata
3879 assert da.nbytes == 9
3880 # Here we confirm that this does not depend on array having the
3881 # nbytes property, since it isn't really required by the array
3882 # interface. nbytes is more a property of arrays that have been
3883 # cast to numpy arrays.
3884 assert not hasattr(array, "nbytes")
3885
3886 def test_to_and_from_empty_series(self) -> None:
3887 # GH697

Callers

nothing calls this directly

Calls 1

InaccessibleArrayClass · 0.90

Tested by

no test coverage detected