Skip to content
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

Fix false friends in implicit string concatenation in tests #61228

Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions pandas/tests/indexes/datetimes/test_date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,9 @@ def test_frequency_A_raises(self, freq):
)
def test_date_range_depr_lowercase_frequency(self, freq, freq_depr):
# GH#58998
depr_msg = f"'{freq_depr[1:]}' is deprecated and will be removed "
"in a future version."
depr_msg = (
f"'{freq_depr[1:]}' is deprecated and will be removed in a future version."
)

expected = date_range("1/1/2000", periods=4, freq=freq)
with tm.assert_produces_warning(FutureWarning, match=depr_msg):
Expand Down
12 changes: 8 additions & 4 deletions pandas/tests/indexes/period/test_period_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ def test_constructor_U(self):
@pytest.mark.parametrize("freq_depr", ["2MIN", "2US", "2NS"])
def test_uppercase_freq_deprecated_from_time_series(self, freq_depr):
# GH#52536, GH#54939
msg = f"'{freq_depr[1:]}' is deprecated and will be removed in a "
f"future version. Please use '{freq_depr.lower()[1:]}' instead."
msg = (
f"'{freq_depr[1:]}' is deprecated and will be removed in a "
f"future version, please use '{freq_depr.lower()[1:]}' instead."
)

with tm.assert_produces_warning(FutureWarning, match=msg):
period_range("2020-01-01 00:00:00 00:00", periods=2, freq=freq_depr)
Expand All @@ -230,8 +232,10 @@ def test_A_raises_from_time_series(self, freq):
@pytest.mark.parametrize("freq", ["2w"])
def test_lowercase_freq_from_time_series_deprecated(self, freq):
# GH#52536, GH#54939
msg = f"'{freq[1:]}' is deprecated and will be removed in a "
f"future version. Please use '{freq.upper()[1:]}' instead."
msg = (
f"'{freq[1:]}' is deprecated and will be removed in a "
f"future version, please use '{freq.upper()[1:]}' instead."
)

with tm.assert_produces_warning(FutureWarning, match=msg):
period_range(freq=freq, start="1/1/2001", end="12/1/2009")
6 changes: 4 additions & 2 deletions pandas/tests/tslibs/test_to_offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ def test_to_offset_lowercase_frequency_raises(freq_depr):
@pytest.mark.parametrize("freq_depr", ["2MIN", "2Us", "2NS"])
def test_to_offset_uppercase_frequency_deprecated(freq_depr):
# GH#54939
depr_msg = f"'{freq_depr[1:]}' is deprecated and will be removed in a "
f"future version, please use '{freq_depr.lower()[1:]}' instead."
depr_msg = (
f"'{freq_depr[1:]}' is deprecated and will be removed in a "
f"future version, please use '{freq_depr.lower()[1:]}' instead."
)

with tm.assert_produces_warning(FutureWarning, match=depr_msg):
to_offset(freq_depr)
Expand Down