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

Method test_reindex_regressions

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

Source from the content-addressed store, hash-verified

1846 foo.reindex_like(bar)
1847
1848 def test_reindex_regressions(self) -> None:
1849 da = DataArray(np.random.randn(5), coords=[("time", range(5))])
1850 time2 = DataArray(np.arange(5), dims="time2")
1851 with pytest.raises(ValueError):
1852 da.reindex(time=time2)
1853
1854 # regression test for #736, reindex can not change complex nums dtype
1855 xnp = np.array([1, 2, 3], dtype=complex)
1856 x = DataArray(xnp, coords=[[0.1, 0.2, 0.3]])
1857 y = DataArray([2, 5, 6, 7, 8], coords=[[-1.1, 0.21, 0.31, 0.41, 0.51]])
1858 re_dtype = x.reindex_like(y, method="pad").dtype
1859 assert x.dtype == re_dtype
1860
1861 def test_reindex_method(self) -> None:
1862 x = DataArray([10, 20], dims="y", coords={"y": [0, 1]})

Callers

nothing calls this directly

Calls 4

reindexMethod · 0.95
reindex_likeMethod · 0.95
DataArrayClass · 0.90
arangeMethod · 0.80

Tested by

no test coverage detected