Skip to content

F string fixes #31751

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 4 commits into from
Feb 6, 2020
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
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
8 changes: 4 additions & 4 deletions pandas/tests/series/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def test_basic_getitem_setitem_corner(datetime_series):
@pytest.mark.parametrize("tz", ["US/Eastern", "UTC", "Asia/Tokyo"])
def test_setitem_with_tz(tz):
orig = pd.Series(pd.date_range("2016-01-01", freq="H", periods=3, tz=tz))
assert orig.dtype == "datetime64[ns, {0}]".format(tz)
assert orig.dtype == f"datetime64[ns, {tz}]"

# scalar
s = orig.copy()
Expand All @@ -456,7 +456,7 @@ def test_setitem_with_tz(tz):
[pd.Timestamp("2011-01-01", tz=tz), pd.Timestamp("2012-01-01", tz=tz)],
index=[1, 2],
)
assert vals.dtype == "datetime64[ns, {0}]".format(tz)
assert vals.dtype == f"datetime64[ns, {tz}]"

s[[1, 2]] = vals
exp = pd.Series(
Expand All @@ -481,7 +481,7 @@ def test_setitem_with_tz_dst():
# GH XXX
tz = "US/Eastern"
orig = pd.Series(pd.date_range("2016-11-06", freq="H", periods=3, tz=tz))
assert orig.dtype == "datetime64[ns, {0}]".format(tz)
assert orig.dtype == f"datetime64[ns, {tz}]"

# scalar
s = orig.copy()
Expand All @@ -508,7 +508,7 @@ def test_setitem_with_tz_dst():
[pd.Timestamp("2011-01-01", tz=tz), pd.Timestamp("2012-01-01", tz=tz)],
index=[1, 2],
)
assert vals.dtype == "datetime64[ns, {0}]".format(tz)
assert vals.dtype == f"datetime64[ns, {tz}]"

s[[1, 2]] = vals
exp = pd.Series(
Expand Down