Skip to content

Commit

Permalink
Assert warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloqeely committed Jun 1, 2024
1 parent e90bb56 commit 82ac17b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pandas/tests/tools/test_to_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -3007,9 +3007,11 @@ def test_parsers_dayfirst_yearfirst(
result2 = Timestamp(date_str)
assert result2 == expected

result3 = to_datetime(
date_str, dayfirst=dayfirst, yearfirst=yearfirst, cache=cache
)
warn = UserWarning if dayfirst else None
with tm.assert_produces_warning(warn, match="Could not infer format"):
result3 = to_datetime(
date_str, dayfirst=dayfirst, yearfirst=yearfirst, cache=cache
)

result4 = DatetimeIndex([date_str], dayfirst=dayfirst, yearfirst=yearfirst)[0]

Expand Down

0 comments on commit 82ac17b

Please sign in to comment.