@@ -185,11 +185,11 @@ def test_comments(self):
185
185
186
186
def test_export_eds_to_file (self ):
187
187
import tempfile
188
- for suffix in "eds" , "dcf" :
188
+ for suffix in ". eds" , ". dcf" :
189
189
for implicit in True , False :
190
- with tempfile .NamedTemporaryFile () as fn :
191
- dest = f" { fn . name } . { suffix } "
192
- doctype = None if implicit else suffix
190
+ with tempfile .NamedTemporaryFile (suffix = suffix ) as tmp :
191
+ doctype = None if implicit else suffix [ 1 :]
192
+ dest = tmp . name
193
193
with self .subTest (dest = dest , doctype = doctype ):
194
194
canopen .export_od (self .od , dest , doctype )
195
195
self .verify_od (dest , doctype )
@@ -198,8 +198,8 @@ def test_export_eds_to_file_unknown_extension(self):
198
198
import io
199
199
import tempfile
200
200
for suffix in ".txt" , "" :
201
- with tempfile .NamedTemporaryFile () as fn :
202
- dest = f" { fn .name } { suffix } "
201
+ with tempfile .NamedTemporaryFile (suffix = suffix ) as tmp :
202
+ dest = tmp .name
203
203
with self .subTest (dest = dest , doctype = None ):
204
204
canopen .export_od (self .od , dest )
205
205
@@ -222,6 +222,7 @@ def test_export_eds_unknown_doctype(self):
222
222
import io
223
223
filelike_object = io .StringIO ()
224
224
self .addCleanup (filelike_object .close )
225
+ self .addCleanup (os .unlink , "filename" )
225
226
for dest in "filename" , None , filelike_object :
226
227
with self .subTest (dest = dest ):
227
228
with self .assertRaisesRegex (ValueError , "'unknown'" ):
0 commit comments