Skip to content

Commit 4b6fc19

Browse files
committed
typing
1 parent b2db0dc commit 4b6fc19

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

xarray_array_testing/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from types import ModuleType
44

55
import numpy.testing as npt
6+
from xarray.namedarray._typing import duckarray
67

78

89
class DuckArrayTestMixin(ABC):
@@ -13,7 +14,7 @@ def xp() -> ModuleType:
1314

1415
@property
1516
@abc.abstractmethod
16-
def array_type(self) -> type:
17+
def array_type(self) -> type[duckarray]:
1718
pass
1819

1920
@staticmethod

xarray_array_testing/tests/test_numpy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from types import ModuleType
2+
13
import hypothesis.strategies as st
24
import numpy as np
35

@@ -12,11 +14,11 @@ def create_numpy_array(*, shape, dtype):
1214

1315
class NumpyTestMixin(DuckArrayTestMixin):
1416
@property
15-
def xp(self):
17+
def xp(self) -> ModuleType:
1618
return np
1719

1820
@property
19-
def array_type(self):
21+
def array_type(self) -> type[np.ndarray]:
2022
return np.ndarray
2123

2224
@staticmethod

0 commit comments

Comments
 (0)