Skip to content

CLN: Replace '.format' with f-strings in some test files #29547 #31412

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 2 commits into from
Jan 31, 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
7 changes: 2 additions & 5 deletions pandas/tests/reshape/test_reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def test_basic_types(self, sparse, dtype):

result = get_dummies(s_df, columns=s_df.columns, sparse=sparse, dtype=dtype)
if sparse:
dtype_name = "Sparse[{}, {}]".format(
self.effective_dtype(dtype).name, fill_value
)
dtype_name = f"Sparse[{self.effective_dtype(dtype).name}, {fill_value}]"
else:
dtype_name = self.effective_dtype(dtype).name

Expand Down Expand Up @@ -163,8 +161,7 @@ def test_unicode(self, sparse):
s = [e, eacute, eacute]
res = get_dummies(s, prefix="letter", sparse=sparse)
exp = DataFrame(
{"letter_e": [1, 0, 0], "letter_{eacute}".format(eacute=eacute): [0, 1, 1]},
dtype=np.uint8,
{"letter_e": [1, 0, 0], f"letter_{eacute}": [0, 1, 1]}, dtype=np.uint8,
)
if sparse:
exp = exp.apply(SparseArray, fill_value=0)
Expand Down
8 changes: 4 additions & 4 deletions pandas/tests/scalar/period/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def test_multiples(self):
@pytest.mark.parametrize("month", MONTHS)
def test_period_cons_quarterly(self, month):
# bugs in scikits.timeseries
freq = "Q-{month}".format(month=month)
freq = f"Q-{month}"
exp = Period("1989Q3", freq=freq)
assert "1989Q3" in str(exp)
stamp = exp.to_timestamp("D", how="end")
Expand All @@ -322,7 +322,7 @@ def test_period_cons_quarterly(self, month):
@pytest.mark.parametrize("month", MONTHS)
def test_period_cons_annual(self, month):
# bugs in scikits.timeseries
freq = "A-{month}".format(month=month)
freq = f"A-{month}"
exp = Period("1989", freq=freq)
stamp = exp.to_timestamp("D", how="end") + timedelta(days=30)
p = Period(stamp, freq=freq)
Expand All @@ -333,8 +333,8 @@ def test_period_cons_annual(self, month):
@pytest.mark.parametrize("day", DAYS)
@pytest.mark.parametrize("num", range(10, 17))
def test_period_cons_weekly(self, num, day):
daystr = "2011-02-{num}".format(num=num)
freq = "W-{day}".format(day=day)
daystr = f"2011-02-{num}"
freq = f"W-{day}"

result = Period(daystr, freq=freq)
expected = Period(daystr, freq="D").asfreq(freq)
Expand Down