@@ -21,7 +21,7 @@ def setup_method(self, datapath):
21
21
self.data = []
22
22
self.test_ix = [list(range(1, 16)), [16]]
23
23
for j in 1, 2:
24
- fname = os.path.join(self.dirpath, "test_sas7bdat_{j}.csv".format(j=j) )
24
+ fname = os.path.join(self.dirpath, f "test_sas7bdat_{j}.csv")
25
25
df = pd.read_csv(fname)
26
26
epoch = pd.datetime(1960, 1, 1)
27
27
t1 = pd.to_timedelta(df["Column4"], unit="d")
@@ -38,15 +38,15 @@ def test_from_file(self):
38
38
for j in 0, 1:
39
39
df0 = self.data[j]
40
40
for k in self.test_ix[j]:
41
- fname = os.path.join(self.dirpath, "test{k}.sas7bdat".format(k=k) )
41
+ fname = os.path.join(self.dirpath, f "test{k}.sas7bdat")
42
42
df = pd.read_sas(fname, encoding="utf-8")
43
43
tm.assert_frame_equal(df, df0)
44
44
45
45
def test_from_buffer(self):
46
46
for j in 0, 1:
47
47
df0 = self.data[j]
48
48
for k in self.test_ix[j]:
49
- fname = os.path.join(self.dirpath, "test{k}.sas7bdat".format(k=k) )
49
+ fname = os.path.join(self.dirpath, f "test{k}.sas7bdat")
50
50
with open(fname, "rb") as f:
51
51
byts = f.read()
52
52
buf = io.BytesIO(byts)
@@ -61,7 +61,7 @@ def test_from_iterator(self):
61
61
for j in 0, 1:
62
62
df0 = self.data[j]
63
63
for k in self.test_ix[j]:
64
- fname = os.path.join(self.dirpath, "test{k}.sas7bdat".format(k=k) )
64
+ fname = os.path.join(self.dirpath, f "test{k}.sas7bdat")
65
65
rdr = pd.read_sas(fname, iterator=True, encoding="utf-8")
66
66
df = rdr.read(2)
67
67
tm.assert_frame_equal(df, df0.iloc[0:2, :])
@@ -73,7 +73,7 @@ def test_path_pathlib(self):
73
73
for j in 0, 1:
74
74
df0 = self.data[j]
75
75
for k in self.test_ix[j]:
76
- fname = Path(os.path.join(self.dirpath, "test{k}.sas7bdat".format(k=k) ))
76
+ fname = Path(os.path.join(self.dirpath, f "test{k}.sas7bdat"))
77
77
df = pd.read_sas(fname, encoding="utf-8")
78
78
tm.assert_frame_equal(df, df0)
79
79
@@ -84,9 +84,7 @@ def test_path_localpath(self):
84
84
for j in 0, 1:
85
85
df0 = self.data[j]
86
86
for k in self.test_ix[j]:
87
- fname = LocalPath(
88
- os.path.join(self.dirpath, "test{k}.sas7bdat".format(k=k))
89
- )
87
+ fname = LocalPath(os.path.join(self.dirpath, f"test{k}.sas7bdat"))
90
88
df = pd.read_sas(fname, encoding="utf-8")
91
89
tm.assert_frame_equal(df, df0)
92
90
@@ -95,7 +93,7 @@ def test_iterator_loop(self):
95
93
for j in 0, 1:
96
94
for k in self.test_ix[j]:
97
95
for chunksize in 3, 5, 10, 11:
98
- fname = os.path.join(self.dirpath, "test{k}.sas7bdat".format(k=k) )
96
+ fname = os.path.join(self.dirpath, f "test{k}.sas7bdat")
99
97
rdr = pd.read_sas(fname, chunksize=10, encoding="utf-8")
100
98
y = 0
101
99
for x in rdr:
@@ -106,7 +104,7 @@ def test_iterator_loop(self):
106
104
def test_iterator_read_too_much(self):
107
105
# github #14734
108
106
k = self.test_ix[0][0]
109
- fname = os.path.join(self.dirpath, "test{k}.sas7bdat".format(k=k) )
107
+ fname = os.path.join(self.dirpath, f "test{k}.sas7bdat")
110
108
rdr = pd.read_sas(fname, format="sas7bdat", iterator=True, encoding="utf-8")
111
109
d1 = rdr.read(rdr.row_count + 20)
112
110
rdr.close()
0 commit comments