Skip to content

CLN: Replace old format strings to f-strings in pandas/tests/base #30604

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 1, 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
4 changes: 2 additions & 2 deletions pandas/tests/base/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def test_numpy_array_all_dtypes(any_numpy_dtype):
def test_array(array, attr, index_or_series):
box = index_or_series
if array.dtype.name in ("Int64", "Sparse[int64, 0]") and box is pd.Index:
pytest.skip("No index type for {}".format(array.dtype))
pytest.skip(f"No index type for {array.dtype}")
result = box(array, copy=False).array

if attr:
Expand Down Expand Up @@ -354,7 +354,7 @@ def test_to_numpy(array, expected, index_or_series):
thing = box(array)

if array.dtype.name in ("Int64", "Sparse[int64, 0]") and box is pd.Index:
pytest.skip("No index type for {}".format(array.dtype))
pytest.skip(f"No index type for {array.dtype}")

result = thing.to_numpy()
tm.assert_numpy_array_equal(result, expected)
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/base/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def setup_method(self, method):
self.unicode_series = Series(arr, index=self.unicode_index, name="a")

types = ["bool", "int", "float", "dt", "dt_tz", "period", "string", "unicode"]
self.indexes = [getattr(self, "{}_index".format(t)) for t in types]
self.series = [getattr(self, "{}_series".format(t)) for t in types]
self.indexes = [getattr(self, f"{t}_index") for t in types]
self.series = [getattr(self, f"{t}_series") for t in types]

# To test narrow dtypes, we use narrower *data* elements, not *index* elements
index = self.int_index
Expand All @@ -79,7 +79,7 @@ def setup_method(self, method):
self.uint32_series = Series(arr_int.astype(np.uint32), index=index, name="a")

nrw_types = ["float32", "int8", "int16", "int32", "uint8", "uint16", "uint32"]
self.narrow_series = [getattr(self, "{}_series".format(t)) for t in nrw_types]
self.narrow_series = [getattr(self, f"{t}_series") for t in nrw_types]

self.objs = self.indexes + self.series + self.narrow_series

Expand Down