Skip to content

CLN: 29547 replace old string formatting 8 #32032

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
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
2 changes: 1 addition & 1 deletion pandas/tests/test_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def import_module(name):
try:
return importlib.import_module(name)
except ModuleNotFoundError: # noqa
pytest.skip("skipping as {} not available".format(name))
pytest.skip(f"skipping as {name} not available")


@pytest.fixture
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/test_multilevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,10 @@ def test_stack_unstack_unordered_multiindex(self):
values = np.arange(5)
data = np.vstack(
[
["b{}".format(x) for x in values], # b0, b1, ..
["a{}".format(x) for x in values],
[f"b{x}" for x in values], # b0, b1, ..
[f"a{x}" for x in values], # a0, a1, ..
]
) # a0, a1, ..
)
df = pd.DataFrame(data.T, columns=["b", "a"])
df.columns.name = "first"
second_level_dict = {"x": df}
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/tools/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def test_really_large_in_arr_consistent(large_val, signed, multiple_elts, errors

if errors in (None, "raise"):
index = int(multiple_elts)
msg = "Integer out of range. at position {index}".format(index=index)
msg = f"Integer out of range. at position {index}"

with pytest.raises(ValueError, match=msg):
to_numeric(arr, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/tslibs/test_parse_iso8601.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_parsers_iso8601(date_str, exp):
],
)
def test_parsers_iso8601_invalid(date_str):
msg = 'Error parsing datetime string "{s}"'.format(s=date_str)
msg = f'Error parsing datetime string "{date_str}"'

with pytest.raises(ValueError, match=msg):
tslib._test_parse_iso8601(date_str)
Expand Down
10 changes: 3 additions & 7 deletions pandas/tests/window/moments/test_moments_rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def get_result(obj, window, min_periods=None, center=False):
tm.assert_series_equal(result, expected)

# shifter index
s = ["x{x:d}".format(x=x) for x in range(12)]
s = [f"x{x:d}" for x in range(12)]

if has_min_periods:
minp = 10
Expand Down Expand Up @@ -1437,13 +1437,9 @@ def test_rolling_median_memory_error(self):
def test_rolling_min_max_numeric_types(self):

# GH12373
types_test = [np.dtype("f{}".format(width)) for width in [4, 8]]
types_test = [np.dtype(f"f{width}") for width in [4, 8]]
types_test.extend(
[
np.dtype("{}{}".format(sign, width))
for width in [1, 2, 4, 8]
for sign in "ui"
]
[np.dtype(f"{sign}{width}") for width in [1, 2, 4, 8] for sign in "ui"]
)
for data_type in types_test:
# Just testing that these don't throw exceptions and that
Expand Down