diff --git a/xarray/namedarray/parallelcompat.py b/xarray/namedarray/parallelcompat.py index 379cef20c5c..c923e55db8b 100644 --- a/xarray/namedarray/parallelcompat.py +++ b/xarray/namedarray/parallelcompat.py @@ -11,7 +11,7 @@ from abc import ABC, abstractmethod from collections.abc import Iterable, Sequence from importlib.metadata import EntryPoint, entry_points -from typing import TYPE_CHECKING, Any, Callable, Generic, Optional, Protocol, TypeVar +from typing import TYPE_CHECKING, Any, Callable, Generic, Protocol, TypeVar import numpy as np @@ -121,7 +121,7 @@ def guess_chunkmanager( ) -def get_chunked_array_type(*args: Any) -> Optional[ChunkManagerEntrypoint[Any]]: +def get_chunked_array_type(*args: Any) -> ChunkManagerEntrypoint[Any] | None: """ Detects which parallel backend should be used for given set of arrays. diff --git a/xarray/tests/test_parallelcompat.py b/xarray/tests/test_parallelcompat.py index d4a4e273bc0..a96ed31c04b 100644 --- a/xarray/tests/test_parallelcompat.py +++ b/xarray/tests/test_parallelcompat.py @@ -195,10 +195,7 @@ def test_raise_if_no_arrays_chunked(self, register_dummy_chunkmanager) -> None: def test_raise_if_no_matching_chunkmanagers(self) -> None: dummy_arr = DummyChunkedArray([1, 2, 3]) - with pytest.raises( - TypeError, match="Could not find a Chunk Manager which recognises" - ): - get_chunked_array_type(dummy_arr) + assert get_chunked_array_type(dummy_arr) is None @requires_dask def test_detect_dask_if_installed(self) -> None: