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

Method test_sel_datetime

xarray/tests/test_indexes.py:243–252  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

241 )
242
243 def test_sel_datetime(self) -> None:
244 index = PandasIndex(
245 pd.to_datetime(["2000-01-01", "2001-01-01", "2002-01-01"]), "x"
246 )
247 actual = index.sel({"x": "2001-01-01"})
248 expected_dim_indexers = {"x": 1}
249 assert actual.dim_indexers == expected_dim_indexers
250
251 actual = index.sel({"x": index.to_pandas_index().to_numpy()[1]})
252 assert actual.dim_indexers == expected_dim_indexers
253
254 def test_sel_unsorted_datetime_index_raises(self) -> None:
255 index = PandasIndex(pd.to_datetime(["2001", "2000", "2002"]), "x")

Callers

nothing calls this directly

Calls 4

selMethod · 0.95
to_pandas_indexMethod · 0.95
PandasIndexClass · 0.90
to_numpyMethod · 0.45

Tested by

no test coverage detected