Skip to content
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

CLN: GH29547 change string formatting with f-strings (6 files changed) #34831

Merged
merged 6 commits into from
Jun 18, 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
3 changes: 1 addition & 2 deletions pandas/tests/io/parser/test_header.py
Original file line number Diff line number Diff line change
@@ -528,12 +528,11 @@ def test_multi_index_unnamed(all_parsers, index_col, columns):
parser.read_csv(StringIO(data), header=header, index_col=index_col)
else:
result = parser.read_csv(StringIO(data), header=header, index_col=index_col)
template = "Unnamed: {i}_level_0"
exp_columns = []

for i, col in enumerate(columns):
if not col: # Unnamed.
col = template.format(i=i if index_col is None else i + 1)
col = f"Unnamed: {i if index_col is None else i + 1}_level_0"

exp_columns.append(col)

9 changes: 5 additions & 4 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
@@ -1900,9 +1900,9 @@ class _TestMySQLAlchemy:

@classmethod
def connect(cls):
url = "mysql+{driver}://root@localhost/pandas_nosetest"
return sqlalchemy.create_engine(
url.format(driver=cls.driver), connect_args=cls.connect_args
f"mysql+{cls.driver}://root@localhost/pandas_nosetest",
connect_args=cls.connect_args,
)

@classmethod
@@ -1969,8 +1969,9 @@ class _TestPostgreSQLAlchemy:

@classmethod
def connect(cls):
url = "postgresql+{driver}://postgres@localhost/pandas_nosetest"
return sqlalchemy.create_engine(url.format(driver=cls.driver))
return sqlalchemy.create_engine(
f"postgresql+{cls.driver}://postgres@localhost/pandas_nosetest"
)

@classmethod
def setup_driver(cls):
5 changes: 2 additions & 3 deletions pandas/tests/reductions/test_reductions.py
Original file line number Diff line number Diff line change
@@ -349,11 +349,10 @@ def test_invalid_td64_reductions(self, opname):

msg = "|".join(
[
"reduction operation '{op}' not allowed for this dtype",
r"cannot perform {op} with type timedelta64\[ns\]",
f"reduction operation '{opname}' not allowed for this dtype",
rf"cannot perform {opname} with type timedelta64\[ns\]",
]
)
msg = msg.format(op=opname)

with pytest.raises(TypeError, match=msg):
getattr(td, opname)()