@@ -161,6 +161,12 @@ class AbstractLabelTest(AbstractWidgetTest, IntegerSizeTests):
161161 _clipped = {'borderwidth' , 'height' , 'highlightthickness' ,
162162 'insertborderwidth' , 'padx' , 'pady' , 'width' }
163163
164+ def setUp (self ):
165+ super ().setUp ()
166+ if tk_version [:2 ] == (9 , 0 ) and get_tk_patchlevel (self .root ) < (9 , 0 , 2 ):
167+ self ._clipped = self ._clipped - {'height' , 'width' }
168+
169+
164170@add_configure_tests (StandardOptionsTests )
165171class LabelTest (AbstractLabelTest , unittest .TestCase ):
166172 OPTIONS = (
@@ -301,6 +307,11 @@ class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
301307 else :
302308 _clipped = {'borderwidth' , 'highlightthickness' , 'insertborderwidth' , 'padx' , 'pady' }
303309
310+ def setUp (self ):
311+ super ().setUp ()
312+ if tk_version [:2 ] == (9 , 0 ) and get_tk_patchlevel (self .root ) < (9 , 0 , 1 ):
313+ self ._clipped = self ._clipped - {'borderwidth' }
314+
304315 def create (self , ** kwargs ):
305316 return tkinter .Menubutton (self .root , ** kwargs )
306317
@@ -311,7 +322,10 @@ def test_configure_direction(self):
311322
312323 def test_configure_height (self ):
313324 widget = self .create ()
314- conv = str if tk_version < (8 , 7 ) else False
325+ if tk_version < (8 , 7 ) or (tk_version [:2 ] == (9 , 0 ) and get_tk_patchlevel (self .root ) < (9 , 0 , 1 )):
326+ conv = str
327+ else :
328+ conv = False
315329 self .checkIntegerParam (widget , 'height' , 100 , - 100 , 0 , conv = conv )
316330
317331 def test_configure_image (self ):
@@ -339,7 +353,10 @@ def test_configure_menu(self):
339353
340354 def test_configure_width (self ):
341355 widget = self .create ()
342- conv = str if tk_version < (8 , 7 ) else False
356+ if tk_version < (8 , 7 ) or (tk_version [:2 ] == (9 , 0 ) and get_tk_patchlevel (self .root ) < (9 , 0 , 1 )):
357+ conv = str
358+ else :
359+ conv = False
343360 self .checkIntegerParam (widget , 'width' , 402 , - 402 , 0 , conv = conv )
344361
345362
@@ -545,7 +562,7 @@ def test_configure_values(self):
545562 # XXX
546563 widget = self .create ()
547564 self .assertEqual (widget ['values' ], '' )
548- if tk_version < (8 , 7 ):
565+ if tk_version < (8 , 7 ) or ( tk_version [: 2 ] == ( 9 , 0 ) and get_tk_patchlevel ( self . root ) < ( 9 , 0 , 1 )) :
549566 expected = 'mon tue wed thur'
550567 else :
551568 expected = ('mon' , 'tue' , 'wed' , 'thur' )
@@ -554,7 +571,7 @@ def test_configure_values(self):
554571 self .checkParam (widget , 'values' , ('mon' , 'tue' , 'wed' , 'thur' ),
555572 expected = expected )
556573
557- if tk_version < (8 , 7 ):
574+ if tk_version < (8 , 7 ) or ( tk_version [: 2 ] == ( 9 , 0 ) and get_tk_patchlevel ( self . root ) < ( 9 , 0 , 1 )) :
558575 expected = '42 3.14 {} {any string}'
559576 else :
560577 expected = (42 , 3.14 , '' , 'any string' )
@@ -631,6 +648,13 @@ class TextTest(AbstractWidgetTest, unittest.TestCase):
631648 'insertborderwidth' , 'insertwidth' , 'padx' , 'pady' ,
632649 'selectborderwidth' , 'spacing1' , 'spacing2' , 'spacing3' }
633650
651+ def setUp (self ):
652+ super ().setUp ()
653+ if tk_version [:2 ] == (9 , 0 ) and get_tk_patchlevel (self .root ) < (9 , 0 , 2 ):
654+ self ._clipped = self ._clipped - {'borderwidth' , 'height' , 'padx' , 'pady' }
655+ if tk_version [:2 ] == (9 , 0 ) and get_tk_patchlevel (self .root ) < (9 , 0 , 1 ):
656+ self ._clipped = self ._clipped - {'insertborderwidth' , 'insertwidth' , 'selectborderwidth' }
657+
634658 def create (self , ** kwargs ):
635659 return tkinter .Text (self .root , ** kwargs )
636660
@@ -769,6 +793,14 @@ class CanvasTest(AbstractWidgetTest, unittest.TestCase):
769793 'width' , 'xscrollincrement' , 'yscrollincrement' }
770794 _stringify = True
771795
796+ def setUp (self ):
797+ super ().setUp ()
798+ if tk_version [:2 ] == (9 , 0 ) and get_tk_patchlevel (self .root ) < (9 , 0 , 1 ):
799+ self ._rounds_pixels = True
800+ self ._no_round = {'borderwidth' , 'height' , 'highlightthickness' ,
801+ 'width' , 'xscrollincrement' , 'yscrollincrement' }
802+ self ._clipped = self ._clipped - {'insertborderwidth' , 'insertwidth' , 'selectborderwidth' }
803+
772804 def create (self , ** kwargs ):
773805 return tkinter .Canvas (self .root , ** kwargs )
774806
0 commit comments