Skip to content

Commit 088af0d

Browse files
committed
mypy
1 parent 9007378 commit 088af0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/arrays/test_datetime_array.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
from datetime import datetime
2+
from typing import cast
23

34
import numpy as np
45
import pandas as pd
56
from pandas.core.arrays.datetimes import DatetimeArray
67
from typing_extensions import assert_type
78

9+
from pandas._libs.tslibs.nattype import NaTType
10+
811
from tests import check
912

1013

@@ -18,7 +21,8 @@ def test_constructor() -> None:
1821
np_dt = np.datetime64(dt)
1922
check(assert_type(pd.array([np_dt]), DatetimeArray), DatetimeArray)
2023
check(assert_type(pd.array([np_dt, None]), DatetimeArray), DatetimeArray)
21-
check(assert_type(pd.array([np_dt, pd.NaT]), DatetimeArray), DatetimeArray)
24+
dt_nat = cast(list[np.datetime64 | NaTType], [np_dt, pd.NaT])
25+
check(assert_type(pd.array(dt_nat), DatetimeArray), DatetimeArray)
2226

2327
check(
2428
assert_type( # type: ignore[assert-type] # I do not understand

0 commit comments

Comments
 (0)