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

Method test_sel_float16

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

Source from the content-addressed store, hash-verified

1191 assert_equal(actual, expected)
1192
1193 def test_sel_float16(self) -> None:
1194 data_values = np.arange(4)
1195 coord_values = np.array([0.0, 0.111, 0.222, 0.333], dtype="float16")
1196 indices = slice(1, 3)
1197
1198 message = "`pandas.Index` does not support the `float16` dtype.*"
1199
1200 with pytest.warns(FutureWarning, match=message):
1201 arr = DataArray(data_values, coords={"x": coord_values}, dims="x")
1202 with pytest.warns(FutureWarning, match=message):
1203 expected = DataArray(
1204 data_values[indices], coords={"x": coord_values[indices]}, dims="x"
1205 )
1206
1207 actual = arr.sel(x=coord_values[indices])
1208
1209 assert_equal(actual, expected)
1210
1211 def test_sel_float_multiindex(self) -> None:
1212 # regression test https://github.com/pydata/xarray/issues/5691

Callers

nothing calls this directly

Calls 4

selMethod · 0.95
DataArrayClass · 0.90
assert_equalFunction · 0.90
arangeMethod · 0.80

Tested by

no test coverage detected