Skip to content

Commit 641051f

Browse files
rbharadwaj9jreback
authored andcommitted
CLN: Replace old format strings to f-strings in pandas/tests/base (#30604)
1 parent 8778760 commit 641051f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pandas/tests/base/test_conversion.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def test_numpy_array_all_dtypes(any_numpy_dtype):
288288
def test_array(array, attr, index_or_series):
289289
box = index_or_series
290290
if array.dtype.name in ("Int64", "Sparse[int64, 0]") and box is pd.Index:
291-
pytest.skip("No index type for {}".format(array.dtype))
291+
pytest.skip(f"No index type for {array.dtype}")
292292
result = box(array, copy=False).array
293293

294294
if attr:
@@ -354,7 +354,7 @@ def test_to_numpy(array, expected, index_or_series):
354354
thing = box(array)
355355

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

359359
result = thing.to_numpy()
360360
tm.assert_numpy_array_equal(result, expected)

pandas/tests/base/test_ops.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def setup_method(self, method):
6262
self.unicode_series = Series(arr, index=self.unicode_index, name="a")
6363

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

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

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

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

0 commit comments

Comments
 (0)