Skip to content

Adjust tests in tseries folder for new string option #56180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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