MCPcopy
hub / github.com/pydata/xarray / test_broadcast_nocopy

Method test_broadcast_nocopy

xarray/tests/test_dataset.py:2854–2865  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2852 assert_identical(expected_y2, actual_y2)
2853
2854 def test_broadcast_nocopy(self) -> None:
2855 # Test that data is not copied if not needed
2856 x = Dataset({"foo": (("x", "y"), [[1, 1]])})
2857 y = Dataset({"bar": ("y", [2, 3])})
2858
2859 (actual_x,) = broadcast(x)
2860 assert_identical(x, actual_x)
2861 assert source_ndarray(actual_x["foo"].data) is source_ndarray(x["foo"].data)
2862
2863 actual_x, _actual_y = broadcast(x, y)
2864 assert_identical(x, actual_x)
2865 assert source_ndarray(actual_x["foo"].data) is source_ndarray(x["foo"].data)
2866
2867 def test_broadcast_exclude(self) -> None:
2868 x = Dataset(

Callers

nothing calls this directly

Calls 4

DatasetClass · 0.90
broadcastFunction · 0.90
assert_identicalFunction · 0.90
source_ndarrayFunction · 0.90

Tested by

no test coverage detected