7
7
from test .test_tkinter .support import (requires_tk , tk_version ,
8
8
get_tk_patchlevel , widget_eq ,
9
9
AbstractDefaultRootTest )
10
- if tk_version < (9 ,0 ):
10
+ if tk_version < (9 , 0 ):
11
11
from test .test_tkinter .support import messages_v1 as messages , is_pixel_str
12
12
else :
13
13
from test .test_tkinter .support import messages_v2 as messages , is_pixel_str
26
26
def float_round (x ):
27
27
return float (round (x ))
28
28
29
-
30
29
class AbstractToplevelTest (AbstractWidgetTest , PixelSizeTests ):
31
- _no_round = {'padx' , 'pady' } if tk_version < (9 ,0 ) else {
30
+ _no_round = {'padx' , 'pady' } if tk_version < (9 , 0 ) else {
32
31
'borderwidth' , 'height' , 'highlightthickness' , 'padx' , 'pady' ,
33
32
'width' }
34
33
_clipped = {
35
- 'highlightthickness' } if tk_version < (9 ,0 ) else {
34
+ 'highlightthickness' } if tk_version < (9 , 0 ) else {
36
35
'borderwidth' , 'height' , 'highlightthickness' , 'padx' , 'pady' ,
37
36
'width' }
38
37
@@ -121,7 +120,7 @@ class FrameTest(AbstractToplevelTest, unittest.TestCase):
121
120
'highlightbackground' , 'highlightcolor' , 'highlightthickness' ,
122
121
'padx' , 'pady' , 'relief' , 'takefocus' , 'tile' , 'visual' , 'width' ,
123
122
)
124
- _no_round = {'padx' , 'pady' } if tk_version < (9 ,0 ) else {
123
+ _no_round = {'padx' , 'pady' } if tk_version < (9 , 0 ) else {
125
124
'borderwidth' , 'height' , 'highlightthickness' , 'padx' , 'pady' ,
126
125
'width' }
127
126
@@ -139,7 +138,7 @@ class LabelFrameTest(AbstractToplevelTest, unittest.TestCase):
139
138
'labelanchor' , 'labelwidget' , 'padx' , 'pady' , 'relief' ,
140
139
'takefocus' , 'text' , 'visual' , 'width' ,
141
140
)
142
- _no_round = {'padx' , 'pady' } if tk_version < (9 ,0 ) else {
141
+ _no_round = {'padx' , 'pady' } if tk_version < (9 , 0 ) else {
143
142
'borderwidth' , 'height' , 'highlightthickness' , 'padx' , 'pady' ,
144
143
'width' }
145
144
@@ -162,7 +161,7 @@ def test_configure_labelwidget(self):
162
161
# Label, Button, Checkbutton, Radiobutton, MenuButton
163
162
class AbstractLabelTest (AbstractWidgetTest , IntegerSizeTests ):
164
163
_rounds_pixels = False
165
- _clipped = set () if tk_version < (9 ,0 ) else {
164
+ _clipped = {} if tk_version < (9 , 0 ) else {
166
165
'borderwidth' , 'insertborderwidth' , 'highlightthickness' ,
167
166
'padx' , 'pady' }
168
167
@@ -293,9 +292,9 @@ class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
293
292
'takefocus' , 'text' , 'textvariable' ,
294
293
'underline' , 'width' , 'wraplength' ,
295
294
)
296
- _rounds_pixels = tk_version < (9 ,0 )
295
+ _rounds_pixels = tk_version < (9 , 0 )
297
296
_clipped = {'highlightthickness' , 'padx' , 'pady'
298
- } if tk_version < (9 ,0 ) else { 'insertborderwidth' ,
297
+ } if tk_version < (9 , 0 ) else { 'insertborderwidth' ,
299
298
'highlightthickness' , 'padx' , 'pady' }
300
299
301
300
def create (self , ** kwargs ):
@@ -346,8 +345,8 @@ def test_bad_kwarg(self):
346
345
347
346
@add_configure_tests (IntegerSizeTests , StandardOptionsTests )
348
347
class EntryTest (AbstractWidgetTest , unittest .TestCase ):
349
- _rounds_pixels = (tk_version < (9 ,0 ))
350
- _clipped = {'highlightthickness' } if tk_version < (9 ,0 ) else {
348
+ _rounds_pixels = (tk_version < (9 , 0 ))
349
+ _clipped = {'highlightthickness' } if tk_version < (9 , 0 ) else {
351
350
'highlightthickness' , 'borderwidth' , 'insertborderwidth' ,
352
351
'selectborderwidth' }
353
352
@@ -601,7 +600,7 @@ class TextTest(AbstractWidgetTest, unittest.TestCase):
601
600
'tabs' , 'tabstyle' , 'takefocus' , 'undo' , 'width' , 'wrap' ,
602
601
'xscrollcommand' , 'yscrollcommand' ,
603
602
)
604
- _rounds_pixels = (tk_version < (9 ,0 ))
603
+ _rounds_pixels = (tk_version < (9 , 0 ))
605
604
_no_round = {'selectborderwidth' }
606
605
_clipped = {'highlightthickness' }
607
606
@@ -996,9 +995,9 @@ class ListboxTest(AbstractWidgetTest, unittest.TestCase):
996
995
'selectmode' , 'setgrid' , 'state' ,
997
996
'takefocus' , 'width' , 'xscrollcommand' , 'yscrollcommand' ,
998
997
)
999
- _rounds_pixels = (tk_version < (9 ,0 ))
998
+ _rounds_pixels = (tk_version < (9 , 0 ))
1000
999
_clipped = {'highlightthickness'
1001
- } if tk_version < (9 ,0 ) else { 'borderwidth' ,
1000
+ } if tk_version < (9 , 0 ) else { 'borderwidth' ,
1002
1001
'highlightthickness' , 'selectborderwidth' }
1003
1002
1004
1003
def create (self , ** kwargs ):
@@ -1137,7 +1136,7 @@ class ScaleTest(AbstractWidgetTest, unittest.TestCase):
1137
1136
'resolution' , 'showvalue' , 'sliderlength' , 'sliderrelief' , 'state' ,
1138
1137
'takefocus' , 'tickinterval' , 'to' , 'troughcolor' , 'variable' , 'width' ,
1139
1138
)
1140
- _rounds_pixels = (tk_version < (9 ,0 ))
1139
+ _rounds_pixels = (tk_version < (9 , 0 ))
1141
1140
_clipped = {'highlightthickness' }
1142
1141
default_orient = 'vertical'
1143
1142
@@ -1208,7 +1207,7 @@ class ScrollbarTest(AbstractWidgetTest, unittest.TestCase):
1208
1207
'takefocus' , 'troughcolor' , 'width' ,
1209
1208
)
1210
1209
_rounds_pixels = True
1211
- _clipped = {'highlightthickness' } if tk_version < (9 ,0 ) else {
1210
+ _clipped = {'highlightthickness' } if tk_version < (9 , 0 ) else {
1212
1211
'borderwidth' , 'highlightthickness' }
1213
1212
_stringify = True
1214
1213
default_orient = 'vertical'
@@ -1261,7 +1260,7 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
1261
1260
_rounds_pixels = True
1262
1261
_no_round = {'handlesize' , 'height' , 'proxyborderwidth' ,
1263
1262
'sashwidth' , 'selectborderwidth' , 'width'
1264
- } if tk_version < (9 ,0 ) else {'borderwidth' ,
1263
+ } if tk_version < (9 , 0 ) else {'borderwidth' ,
1265
1264
'handlepad' , 'handlesize' ,
1266
1265
'height' , 'proxyborderwidth' , 'sashpad' ,
1267
1266
'sashwidth' , 'selectborderwidth' , 'width' }
@@ -1394,13 +1393,13 @@ def test_paneconfigure_minsize(self):
1394
1393
1395
1394
def test_paneconfigure_padx (self ):
1396
1395
p , b , c = self .create2 ()
1397
- self .check_paneconfigure (p , b , 'padx' , 1.3 , 1 if tk_version < (9 ,0 ) else 1.3 )
1396
+ self .check_paneconfigure (p , b , 'padx' , 1.3 , 1 if tk_version < (9 , 0 ) else 1.3 )
1398
1397
self .check_paneconfigure_bad (p , b , 'padx' ,
1399
1398
EXPECTED_SCREEN_DISTANCE_ERRMSG .format ('badValue' ))
1400
1399
1401
1400
def test_paneconfigure_pady (self ):
1402
1401
p , b , c = self .create2 ()
1403
- self .check_paneconfigure (p , b , 'pady' , 1.3 , 1 if tk_version < (9 ,0 ) else 1.3 )
1402
+ self .check_paneconfigure (p , b , 'pady' , 1.3 , 1 if tk_version < (9 , 0 ) else 1.3 )
1404
1403
self .check_paneconfigure_bad (p , b , 'pady' ,
1405
1404
EXPECTED_SCREEN_DISTANCE_ERRMSG .format ('badValue' ))
1406
1405
@@ -1436,7 +1435,7 @@ class MenuTest(AbstractWidgetTest, unittest.TestCase):
1436
1435
'tearoff' , 'tearoffcommand' , 'title' , 'type' ,
1437
1436
)
1438
1437
_rounds_pixels = False
1439
- _clipped = set ()
1438
+ _clipped = {}
1440
1439
1441
1440
def create (self , ** kwargs ):
1442
1441
return tkinter .Menu (self .root , ** kwargs )
@@ -1514,9 +1513,9 @@ class MessageTest(AbstractWidgetTest, unittest.TestCase):
1514
1513
'justify' , 'padx' , 'pady' , 'relief' ,
1515
1514
'takefocus' , 'text' , 'textvariable' , 'width' ,
1516
1515
)
1517
- _rounds_pixels = (tk_version < (9 ,0 ))
1516
+ _rounds_pixels = (tk_version < (9 , 0 ))
1518
1517
_no_round = {'padx' , 'pady' }
1519
- _clipped = {'highlightthickness' } if tk_version < (9 ,0 ) else {
1518
+ _clipped = {'highlightthickness' } if tk_version < (9 , 0 ) else {
1520
1519
'borderwidth' , 'highlightthickness' , 'padx' , 'pady' }
1521
1520
1522
1521
def create (self , ** kwargs ):
@@ -1529,13 +1528,13 @@ def test_configure_aspect(self):
1529
1528
def test_configure_padx (self ):
1530
1529
widget = self .create ()
1531
1530
self .checkPixelsParam (widget , 'padx' , 3 , 4.4 , 5.6 , '12m' )#,
1532
- expected = - 2 if tk_version < (9 ,0 ) else self ._default_pixels
1531
+ expected = - 2 if tk_version < (9 , 0 ) else self ._default_pixels
1533
1532
self .checkParam (widget , 'padx' , - 2 , expected = expected )
1534
1533
1535
1534
def test_configure_pady (self ):
1536
1535
widget = self .create ()
1537
1536
self .checkPixelsParam (widget , 'pady' , 3 , 4.4 , 5.6 , '12m' )#,
1538
- expected = - 2 if tk_version < (9 ,0 ) else self ._default_pixels
1537
+ expected = - 2 if tk_version < (9 , 0 ) else self ._default_pixels
1539
1538
self .checkParam (widget , 'pady' , - 2 , expected = expected )
1540
1539
1541
1540
def test_configure_width (self ):
0 commit comments