Skip to content

Commit bfc3bd3

Browse files
committed
TST: Improve tests
1 parent b234cf6 commit bfc3bd3

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tests/test_timefuncs.py

+22-4
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,26 @@ def test_comparisons_datetimeindex() -> None:
215215

216216

217217
def test_to_datetime_nat() -> None:
218-
assert_type(pd.to_datetime("2021-03-01", errors="ignore"), "pd.Timestamp")
219-
assert_type(pd.to_datetime("2021-03-01", errors="raise"), "pd.Timestamp")
220-
assert_type(
221-
pd.to_datetime("2021-03-01", errors="coerce"), "Union[pd.Timestamp, NaTType]"
218+
# GH 88
219+
assert isinstance(
220+
assert_type(pd.to_datetime("2021-03-01", errors="ignore"), "pd.Timestamp"),
221+
pd.Timestamp,
222+
)
223+
assert isinstance(
224+
assert_type(pd.to_datetime("2021-03-01", errors="raise"), "pd.Timestamp"),
225+
pd.Timestamp,
226+
)
227+
assert isinstance(
228+
assert_type(
229+
pd.to_datetime("2021-03-01", errors="coerce"),
230+
"Union[pd.Timestamp, NaTType]",
231+
),
232+
pd.Timestamp,
233+
)
234+
assert isinstance(
235+
assert_type(
236+
pd.to_datetime("not a date", errors="coerce"),
237+
"Union[pd.Timestamp, NaTType]",
238+
),
239+
NaTType,
222240
)

0 commit comments

Comments
 (0)