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

Method test_align_scalar_index

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

Source from the content-addressed store, hash-verified

2768 assert ds_noattr.x.attrs == {}
2769
2770 def test_align_scalar_index(self) -> None:
2771 # ensure that indexes associated with scalar coordinates are not ignored
2772 # during alignment
2773 ds1 = Dataset(coords={"x": 0}).set_xindex("x", ScalarIndex)
2774 ds2 = Dataset(coords={"x": 0}).set_xindex("x", ScalarIndex)
2775
2776 actual = xr.align(ds1, ds2, join="exact")
2777 assert_identical(actual[0], ds1, check_default_indexes=False)
2778 assert_identical(actual[1], ds2, check_default_indexes=False)
2779
2780 ds3 = Dataset(coords={"x": 1}).set_xindex("x", ScalarIndex)
2781
2782 with pytest.raises(AlignmentError, match="cannot align objects"):
2783 xr.align(ds1, ds3, join="exact")
2784
2785 def test_align_multi_dim_index_exclude_dims(self) -> None:
2786 ds1 = (

Callers

nothing calls this directly

Calls 4

DatasetClass · 0.90
assert_identicalFunction · 0.90
alignMethod · 0.80
set_xindexMethod · 0.45

Tested by

no test coverage detected