Skip to content

Commit d8cb890

Browse files
committed
fix: mypy and pytest
1 parent b685e3f commit d8cb890

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/extension/decimal/array.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import numbers
1010
import sys
1111
from typing import (
12+
TYPE_CHECKING,
1213
Any,
1314
cast,
1415
overload,
@@ -40,7 +41,6 @@
4041
SequenceIndexer,
4142
SequenceNotStr,
4243
TakeIndexer,
43-
np_1darray,
4444
)
4545

4646
from pandas.core.dtypes.base import ExtensionDtype
@@ -50,6 +50,9 @@
5050
pandas_dtype,
5151
)
5252

53+
if TYPE_CHECKING:
54+
from pandas._typing import np_1darray
55+
5356

5457
@register_extension_dtype
5558
class DecimalDtype(ExtensionDtype):
@@ -200,7 +203,8 @@ def __getitem__(self, item: ScalarIndexer | SequenceIndexer) -> Any:
200203
return self._data[item]
201204
# array, slice.
202205
item = check_array_indexer(
203-
self, item # type: ignore[arg-type] # pyright: ignore[reportArgumentType,reportCallIssue]
206+
self,
207+
item, # type: ignore[arg-type] # pyright: ignore[reportArgumentType,reportCallIssue]
204208
)
205209
return type(self)(self._data[item])
206210

@@ -270,7 +274,9 @@ def nbytes(self) -> int:
270274
return 0
271275

272276
def isna(self) -> np_1darray[np.bool_]:
273-
return np.array([x.is_nan() for x in self._data], dtype=bool)
277+
if sys.version_info < (3, 11):
278+
return np.array([x.is_nan() for x in self._data], bool) # type: ignore[return-value] # pyright: ignore[reportReturnType]
279+
return np.array([x.is_nan() for x in self._data], bool)
274280

275281
@property
276282
def _na_value(self) -> decimal.Decimal:

0 commit comments

Comments
 (0)