@@ -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
@@ -85,7 +85,7 @@ def test_path_localpath(self):
85
85
df0 = self .data [j ]
86
86
for k in self .test_ix [j ]:
87
87
fname = LocalPath (
88
- os .path .join (self .dirpath , "test{k}.sas7bdat" . format ( k = k ) )
88
+ os .path .join (self .dirpath , f "test{ k } .sas7bdat" )
89
89
)
90
90
df = pd .read_sas (fname , encoding = "utf-8" )
91
91
tm .assert_frame_equal (df , df0 )
@@ -95,7 +95,7 @@ def test_iterator_loop(self):
95
95
for j in 0 , 1 :
96
96
for k in self .test_ix [j ]:
97
97
for chunksize in 3 , 5 , 10 , 11 :
98
- fname = os .path .join (self .dirpath , "test{k}.sas7bdat" . format ( k = k ) )
98
+ fname = os .path .join (self .dirpath , f "test{ k } .sas7bdat" )
99
99
rdr = pd .read_sas (fname , chunksize = 10 , encoding = "utf-8" )
100
100
y = 0
101
101
for x in rdr :
@@ -106,7 +106,7 @@ def test_iterator_loop(self):
106
106
def test_iterator_read_too_much (self ):
107
107
# github #14734
108
108
k = self .test_ix [0 ][0 ]
109
- fname = os .path .join (self .dirpath , "test{k}.sas7bdat" . format ( k = k ) )
109
+ fname = os .path .join (self .dirpath , f "test{ k } .sas7bdat" )
110
110
rdr = pd .read_sas (fname , format = "sas7bdat" , iterator = True , encoding = "utf-8" )
111
111
d1 = rdr .read (rdr .row_count + 20 )
112
112
rdr .close ()
0 commit comments