@@ -538,7 +538,7 @@ def test_types_read_table():
538
538
df2 : pd .DataFrame = pd .read_table (path , sep = "," , converters = None )
539
539
540
540
541
- def btest_read_fwf ():
541
+ def test_btest_read_fwf ():
542
542
with ensure_clean () as path :
543
543
DF .to_string (path , index = False )
544
544
check (assert_type (read_fwf (path ), DataFrame ), DataFrame )
@@ -555,12 +555,10 @@ def btest_read_fwf():
555
555
with open (path , "rb" ) as fwf_file :
556
556
bio = io .BytesIO (fwf_file .read ())
557
557
check (assert_type (read_fwf (bio ), DataFrame ), DataFrame )
558
- fwf_iterator = read_fwf (path , iterator = True )
559
- check (assert_type (fwf_iterator , TextFileReader ), TextFileReader )
560
- fwf_iterator .close ()
561
- fwf_iterator2 = read_fwf (path , chunksize = 1 )
562
- check (assert_type (fwf_iterator2 , TextFileReader ), TextFileReader )
563
- fwf_iterator .close ()
558
+ with read_fwf (path , iterator = True ) as fwf_iterator :
559
+ check (assert_type (fwf_iterator , TextFileReader ), TextFileReader )
560
+ with read_fwf (path , chunksize = 1 ) as fwf_iterator2 :
561
+ check (assert_type (fwf_iterator2 , TextFileReader ), TextFileReader )
564
562
565
563
566
564
def test_text_file_reader ():
0 commit comments