@@ -581,13 +581,15 @@ def test_write(self):
581
581
image .write (filename , background = '#ff0000' )
582
582
image4 = tkinter .PhotoImage ('::img::test4' , master = self .root ,
583
583
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' )
585
585
self .assertEqual (image4 .get (4 , 6 ), image .get (4 , 6 ))
586
586
587
587
image .write (filename , grayscale = True )
588
588
image5 = tkinter .PhotoImage ('::img::test5' , master = self .root ,
589
589
format = 'ppm' , file = filename )
590
590
c = image5 .get (4 , 6 )
591
+ if not self .wantobjects :
592
+ c = c .split ()
591
593
self .assertTrue (c [0 ] == c [1 ] == c [2 ], c )
592
594
593
595
def test_data (self ):
@@ -597,7 +599,10 @@ def test_data(self):
597
599
self .assertIsInstance (data , tuple )
598
600
for row in data :
599
601
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 )
601
606
602
607
data = image .data ('ppm' )
603
608
image2 = tkinter .PhotoImage ('::img::test2' , master = self .root ,
@@ -622,13 +627,15 @@ def test_data(self):
622
627
data = image .data ('ppm' , background = '#ff0000' )
623
628
image4 = tkinter .PhotoImage ('::img::test4' , master = self .root ,
624
629
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' )
626
631
self .assertEqual (image4 .get (4 , 6 ), image .get (4 , 6 ))
627
632
628
633
data = image .data ('ppm' , grayscale = True )
629
634
image5 = tkinter .PhotoImage ('::img::test5' , master = self .root ,
630
635
format = 'ppm' , data = data )
631
636
c = image5 .get (4 , 6 )
637
+ if not self .wantobjects :
638
+ c = c .split ()
632
639
self .assertTrue (c [0 ] == c [1 ] == c [2 ], c )
633
640
634
641
0 commit comments