@@ -581,13 +581,15 @@ def test_write(self):
581581 image .write (filename , background = '#ff0000' )
582582 image4 = tkinter .PhotoImage ('::img::test4' , master = self .root ,
583583 format = 'ppm' , file = filename )
584- self .assertEqual (image4 .get (0 , 0 ), (255 , 0 , 0 ))
584+ self .assertEqual (image4 .get (0 , 0 ), (255 , 0 , 0 ) if self . wantobjects else '255 0 0' )
585585 self .assertEqual (image4 .get (4 , 6 ), image .get (4 , 6 ))
586586
587587 image .write (filename , grayscale = True )
588588 image5 = tkinter .PhotoImage ('::img::test5' , master = self .root ,
589589 format = 'ppm' , file = filename )
590590 c = image5 .get (4 , 6 )
591+ if not self .wantobjects :
592+ c = c .split ()
591593 self .assertTrue (c [0 ] == c [1 ] == c [2 ], c )
592594
593595 def test_data (self ):
@@ -597,7 +599,10 @@ def test_data(self):
597599 self .assertIsInstance (data , tuple )
598600 for row in data :
599601 self .assertIsInstance (row , str )
600- self .assertEqual (data [6 ].split ()[4 ], '#%02x%02x%02x' % image .get (4 , 6 ))
602+ c = image .get (4 , 6 )
603+ if not self .wantobjects :
604+ c = tuple (map (int , c .split ()))
605+ self .assertEqual (data [6 ].split ()[4 ], '#%02x%02x%02x' % c )
601606
602607 data = image .data ('ppm' )
603608 image2 = tkinter .PhotoImage ('::img::test2' , master = self .root ,
@@ -622,13 +627,15 @@ def test_data(self):
622627 data = image .data ('ppm' , background = '#ff0000' )
623628 image4 = tkinter .PhotoImage ('::img::test4' , master = self .root ,
624629 format = 'ppm' , data = data )
625- self .assertEqual (image4 .get (0 , 0 ), (255 , 0 , 0 ))
630+ self .assertEqual (image4 .get (0 , 0 ), (255 , 0 , 0 ) if self . wantobjects else '255 0 0' )
626631 self .assertEqual (image4 .get (4 , 6 ), image .get (4 , 6 ))
627632
628633 data = image .data ('ppm' , grayscale = True )
629634 image5 = tkinter .PhotoImage ('::img::test5' , master = self .root ,
630635 format = 'ppm' , data = data )
631636 c = image5 .get (4 , 6 )
637+ if not self .wantobjects :
638+ c = c .split ()
632639 self .assertTrue (c [0 ] == c [1 ] == c [2 ], c )
633640
634641
0 commit comments