Skip to content

Commit

Permalink
Adjust tests in tseries folder for new string option
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl committed Nov 26, 2023
1 parent 6971c9c commit 2e24231
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pandas/tests/tseries/frequencies/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,18 @@ def test_series_invalid_type(end):
frequencies.infer_freq(s)


def test_series_inconvertible_string():
def test_series_inconvertible_string(using_infer_string):
# see gh-6407
msg = "Unknown datetime string format"
if using_infer_string:
msg = "cannot infer freq from"

with pytest.raises(ValueError, match=msg):
frequencies.infer_freq(Series(["foo", "bar"]))
with pytest.raises(TypeError, match=msg):
frequencies.infer_freq(Series(["foo", "bar"]))
else:
msg = "Unknown datetime string format"

with pytest.raises(ValueError, match=msg):
frequencies.infer_freq(Series(["foo", "bar"]))


@pytest.mark.parametrize("freq", [None, "ms"])
Expand Down

0 comments on commit 2e24231

Please sign in to comment.