Skip to content

Commit 20ce643

Browse files
authored
Adjust tests in tseries folder for new string option (pandas-dev#56180)
1 parent 74b2c37 commit 20ce643

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pandas/tests/tseries/frequencies/test_inference.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,18 @@ def test_series_invalid_type(end):
431431
frequencies.infer_freq(s)
432432

433433

434-
def test_series_inconvertible_string():
434+
def test_series_inconvertible_string(using_infer_string):
435435
# see gh-6407
436-
msg = "Unknown datetime string format"
436+
if using_infer_string:
437+
msg = "cannot infer freq from"
437438

438-
with pytest.raises(ValueError, match=msg):
439-
frequencies.infer_freq(Series(["foo", "bar"]))
439+
with pytest.raises(TypeError, match=msg):
440+
frequencies.infer_freq(Series(["foo", "bar"]))
441+
else:
442+
msg = "Unknown datetime string format"
443+
444+
with pytest.raises(ValueError, match=msg):
445+
frequencies.infer_freq(Series(["foo", "bar"]))
440446

441447

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

0 commit comments

Comments
 (0)