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

Method test_duck_array_class

xarray/tests/test_namedarray.py:373–384  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

371 assert named_array.dims == tuple(new_dims)
372
373 def test_duck_array_class(self) -> None:
374 numpy_a: NDArray[np.int64]
375 numpy_a = np.array([2.1, 4], dtype=np.dtype(np.int64))
376 check_duck_array_typevar(numpy_a)
377
378 masked_a: np.ma.MaskedArray[Any, np.dtype[np.int64]]
379 masked_a = np.ma.asarray([2.1, 4], dtype=np.dtype(np.int64))
380 check_duck_array_typevar(masked_a)
381
382 custom_a: CustomArrayIndexable[Any, np.dtype[np.int64]]
383 custom_a = CustomArrayIndexable(numpy_a)
384 check_duck_array_typevar(custom_a)
385
386 def test_duck_array_class_array_api(self) -> None:
387 # Test numpy's array api:

Callers

nothing calls this directly

Calls 3

check_duck_array_typevarFunction · 0.85
dtypeMethod · 0.45

Tested by

no test coverage detected