Skip to content

CLN: Replace format with f-strings in test_repr_info #31639

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 1 commit into from
Feb 5, 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
15 changes: 5 additions & 10 deletions pandas/tests/frame/test_repr_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ def test_info_verbose(self):

for i, line in enumerate(lines):
if i >= start and i < start + size:
index = i - start
line_nr = " {} ".format(index)
line_nr = f" {i - start} "
assert line.startswith(line_nr)

def test_info_memory(self):
Expand All @@ -236,18 +235,16 @@ def test_info_memory(self):
bytes = float(df.memory_usage().sum())

expected = textwrap.dedent(
"""\
f"""\
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2 entries, 0 to 1
Data columns (total 1 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 a 2 non-null int64
dtypes: int64(1)
memory usage: {} bytes
""".format(
bytes
)
memory usage: {bytes} bytes
"""
)

assert result == expected
Expand Down Expand Up @@ -313,9 +310,7 @@ def test_info_shows_column_dtypes(self):
)
assert header in res
for i, dtype in enumerate(dtypes):
name = " {i:d} {i:d} {n:d} non-null {dtype}".format(
i=i, n=n, dtype=dtype
)
name = f" {i:d} {i:d} {n:d} non-null {dtype}"
assert name in res

def test_info_max_cols(self):
Expand Down