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

Method test_where_extension_duck_array

xarray/tests/test_duck_array_ops.py:178–187  ·  view source on GitHub ↗
(self, categorical1, categorical2)

Source from the content-addressed store, hash-verified

176 assert_array_equal(result, np.array([1, np.nan], dtype=np.float32))
177
178 def test_where_extension_duck_array(self, categorical1, categorical2):
179 where_res = where(
180 np.array([True, False, True, False, False]),
181 PandasExtensionArray(categorical1),
182 PandasExtensionArray(categorical2),
183 )
184 assert isinstance(where_res, PandasExtensionArray)
185 assert (
186 where_res == pd.Categorical(["cat1", "cat1", "cat2", "cat3", "cat1"])
187 ).all()
188
189 @requires_cupy
190 def test_where_cupy_duck_array(self):

Callers

nothing calls this directly

Calls 3

whereFunction · 0.90
allMethod · 0.45

Tested by

no test coverage detected