@@ -112,6 +112,13 @@ def __getattr__(self, attr): return getattr(self.file, attr)
112112 self .assertEqual (testfile .closed , False )
113113 f .close ()
114114 self .assertEqual (testfile .closed , True )
115+ testfile = open (TESTFN , 'wb' )
116+ fout = aifc .open (testfile , 'wb' )
117+ self .assertFalse (testfile .closed )
118+ with self .assertRaises (aifc .Error ):
119+ fout .close ()
120+ self .assertTrue (testfile .closed )
121+ fout .close () # do nothing
115122
116123 def test_write_header_comptype_sampwidth (self ):
117124 for comptype in (b'ULAW' , b'ulaw' , b'ALAW' , b'alaw' , b'G722' ):
@@ -286,11 +293,13 @@ def test_write_params_bunch(self):
286293 def test_write_header_raises (self ):
287294 fout = aifc .open (io .BytesIO (), 'wb' )
288295 self .assertRaises (aifc .Error , fout .close )
296+ fout = aifc .open (io .BytesIO (), 'wb' )
289297 fout .setnchannels (1 )
290298 self .assertRaises (aifc .Error , fout .close )
299+ fout = aifc .open (io .BytesIO (), 'wb' )
300+ fout .setnchannels (1 )
291301 fout .setsampwidth (1 )
292302 self .assertRaises (aifc .Error , fout .close )
293- fout .initfp (None )
294303
295304 def test_write_header_comptype_raises (self ):
296305 for comptype in (b'ULAW' , b'ulaw' , b'ALAW' , b'alaw' , b'G722' ):
0 commit comments