Skip to content

replacing .format with f-strings #31628

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 3 commits into from
Feb 3, 2020
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
10 changes: 4 additions & 6 deletions pandas/tests/io/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ def compare_element(result, expected, typ, version=None):
assert result == expected
assert result.freq == expected.freq
else:
comparator = getattr(
tm, "assert_{typ}_equal".format(typ=typ), tm.assert_almost_equal
)
comparator = getattr(tm, f"assert_{typ}_equal", tm.assert_almost_equal)
comparator(result, expected)


Expand All @@ -77,7 +75,7 @@ def compare(data, vf, version):

# use a specific comparator
# if available
comparator = "compare_{typ}_{dt}".format(typ=typ, dt=dt)
comparator = f"compare_{typ}_{dt}"

comparator = m.get(comparator, m["compare_element"])
comparator(result, expected, typ, version)
Expand Down Expand Up @@ -234,7 +232,7 @@ def test_legacy_sparse_warning(datapath):

@pytest.fixture
def get_random_path():
return "__{}__.pickle".format(tm.rands(10))
return f"__{tm.rands(10)}__.pickle"


class TestCompression:
Expand Down Expand Up @@ -262,7 +260,7 @@ def compress_file(self, src_path, dest_path, compression):
elif compression == "xz":
f = _get_lzma_file(lzma)(dest_path, "w")
else:
msg = "Unrecognized compression type: {}".format(compression)
msg = f"Unrecognized compression type: {compression}"
raise ValueError(msg)

if compression != "zip":
Expand Down