@@ -357,24 +357,29 @@ def test_get(self):
357
357
self .assertRaises (tkinter .TclError , image .get , 15 , 16 )
358
358
359
359
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
360
365
image = self .create ()
361
- self .addCleanup (os_helper .unlink , os_helper . TESTFN )
366
+ self .addCleanup (os_helper .unlink , filename )
362
367
363
- image .write (os_helper . TESTFN )
368
+ image .write (filename )
364
369
image2 = tkinter .PhotoImage ('::img::test2' , master = self .root ,
365
370
format = 'ppm' ,
366
- file = os_helper . TESTFN )
371
+ file = filename )
367
372
self .assertEqual (str (image2 ), '::img::test2' )
368
373
self .assertEqual (image2 .type (), 'photo' )
369
374
self .assertEqual (image2 .width (), 16 )
370
375
self .assertEqual (image2 .height (), 16 )
371
376
self .assertEqual (image2 .get (0 , 0 ), image .get (0 , 0 ))
372
377
self .assertEqual (image2 .get (15 , 8 ), image .get (15 , 8 ))
373
378
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 ))
375
380
image3 = tkinter .PhotoImage ('::img::test3' , master = self .root ,
376
381
format = 'gif' ,
377
- file = os_helper . TESTFN )
382
+ file = filename )
378
383
self .assertEqual (str (image3 ), '::img::test3' )
379
384
self .assertEqual (image3 .type (), 'photo' )
380
385
self .assertEqual (image3 .width (), 2 )
0 commit comments