@@ -357,24 +357,29 @@ def test_get(self):
357357 self .assertRaises (tkinter .TclError , image .get , 15 , 16 )
358358
359359 def test_write (self ):
360+ filename = os_helper .TESTFN
361+ import locale
362+ if locale .getlocale ()[0 ] is None :
363+ # Tcl uses Latin1 in the C locale
364+ filename = os_helper .TESTFN_ASCII
360365 image = self .create ()
361- self .addCleanup (os_helper .unlink , os_helper . TESTFN )
366+ self .addCleanup (os_helper .unlink , filename )
362367
363- image .write (os_helper . TESTFN )
368+ image .write (filename )
364369 image2 = tkinter .PhotoImage ('::img::test2' , master = self .root ,
365370 format = 'ppm' ,
366- file = os_helper . TESTFN )
371+ file = filename )
367372 self .assertEqual (str (image2 ), '::img::test2' )
368373 self .assertEqual (image2 .type (), 'photo' )
369374 self .assertEqual (image2 .width (), 16 )
370375 self .assertEqual (image2 .height (), 16 )
371376 self .assertEqual (image2 .get (0 , 0 ), image .get (0 , 0 ))
372377 self .assertEqual (image2 .get (15 , 8 ), image .get (15 , 8 ))
373378
374- image .write (os_helper . TESTFN , format = 'gif' , from_coords = (4 , 6 , 6 , 9 ))
379+ image .write (filename , format = 'gif' , from_coords = (4 , 6 , 6 , 9 ))
375380 image3 = tkinter .PhotoImage ('::img::test3' , master = self .root ,
376381 format = 'gif' ,
377- file = os_helper . TESTFN )
382+ file = filename )
378383 self .assertEqual (str (image3 ), '::img::test3' )
379384 self .assertEqual (image3 .type (), 'photo' )
380385 self .assertEqual (image3 .width (), 2 )
0 commit comments