Skip to content

Changed string formatting to fstring #29865

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 1 addition & 3 deletions pandas/tests/resample/test_datetime_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ def test_resample_basic_grouper(series):
def test_resample_string_kwargs(series, keyword, value):
# see gh-19303
# Check that wrong keyword argument strings raise an error
msg = "Unsupported value {value} for `{keyword}`".format(
value=value, keyword=keyword
)
msg = f"Unsupported value {value} for `{keyword}`"
with pytest.raises(ValueError, match=msg):
series.resample("5min", **({keyword: value}))

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/resample/test_time_grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_fails_on_no_datetime_index(name, func):

msg = (
"Only valid with DatetimeIndex, TimedeltaIndex "
"or PeriodIndex, but got an instance of '{}'".format(name)
f"or PeriodIndex, but got an instance of '{name}'"
)
with pytest.raises(TypeError, match=msg):
df.groupby(Grouper(freq="D"))
Expand Down
12 changes: 4 additions & 8 deletions pandas/tests/tseries/offsets/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ def assert_offset_equal(offset, base, expected):
assert actual_apply == expected
except AssertionError:
raise AssertionError(
"\nExpected: {expected}\nActual: {actual}\nFor Offset: {offset})"
"\nAt Date: {base}".format(
expected=expected, actual=actual, offset=offset, base=base
)
f"\nExpected: {expected}\nActual: {actual}\nFor Offset: {offset})"
f"\nAt Date: {base}"
)


def assert_onOffset(offset, date, expected):
actual = offset.onOffset(date)
assert actual == expected, (
"\nExpected: {expected}\nActual: {actual}\nFor Offset: {offset})"
"\nAt Date: {date}".format(
expected=expected, actual=actual, offset=offset, date=date
)
f"\nExpected: {expected}\nActual: {actual}\nFor Offset: {offset})"
f"\nAt Date: {date}"
)