@@ -273,7 +273,7 @@ def cb_test():
273273 cbtn ['command' ] = ''
274274 res = cbtn .invoke ()
275275 self .assertFalse (str (res ))
276- self .assertFalse (len (success ) > 1 )
276+ self .assertLessEqual (len (success ), 1 )
277277 self .assertEqual (cbtn ['offvalue' ],
278278 cbtn .tk .globalgetvar (cbtn ['variable' ]))
279279
@@ -454,7 +454,7 @@ def test_validatecommand(self):
454454 def test_bbox (self ):
455455 self .assertEqual (len (self .entry .bbox (0 )), 4 )
456456 for item in self .entry .bbox (0 ):
457- self .assertTrue ( isinstance ( item , int ) )
457+ self .assertIsInstance ( item , int )
458458
459459 self .assertRaises (tkinter .TclError , self .entry .bbox , 'noindex' )
460460 self .assertRaises (tkinter .TclError , self .entry .bbox , None )
@@ -652,7 +652,7 @@ def test_pane(self):
652652
653653 child = ttk .Label ()
654654 self .paned .add (child )
655- self .assertTrue ( isinstance ( self .paned .pane (0 ), dict ) )
655+ self .assertIsInstance ( self .paned .pane (0 ), dict )
656656 self .assertEqual (self .paned .pane (0 , weight = None ), 0 )
657657 # newer form for querying a single option
658658 self .assertEqual (self .paned .pane (0 , 'weight' ), 0 )
@@ -679,8 +679,8 @@ def test_sashpos(self):
679679
680680 curr_pos = self .paned .sashpos (0 )
681681 self .paned .sashpos (0 , 1000 )
682- self .assertTrue (curr_pos != self .paned .sashpos (0 ))
683- self .assertTrue ( isinstance ( self .paned .sashpos (0 ), int ) )
682+ self .assertNotEqual (curr_pos , self .paned .sashpos (0 ))
683+ self .assertIsInstance ( self .paned .sashpos (0 ), int )
684684
685685
686686@add_standard_options (StandardTtkOptionsTests )
@@ -720,7 +720,7 @@ def cb_test():
720720 cbtn2 ['command' ] = ''
721721 res = cbtn2 .invoke ()
722722 self .assertEqual (str (res ), '' )
723- self .assertFalse (len (success ) > 1 )
723+ self .assertLessEqual (len (success ), 1 )
724724 self .assertEqual (cbtn2 ['value' ], myvar .get ())
725725 self .assertEqual (myvar .get (),
726726 cbtn .tk .globalgetvar (cbtn ['variable' ]))
@@ -982,7 +982,7 @@ def test_add_and_hidden(self):
982982 self .nb .add (self .child2 )
983983 self .assertEqual (self .nb .tabs (), tabs )
984984 self .assertEqual (self .nb .index (self .child2 ), child2_index )
985- self .assertTrue (str (self .child2 ) == self .nb .tabs ()[child2_index ])
985+ self .assertEqual (str (self .child2 ), self .nb .tabs ()[child2_index ])
986986 # but the tab next to it (not hidden) is the one selected now
987987 self .assertEqual (self .nb .index ('current' ), curr + 1 )
988988
@@ -995,19 +995,19 @@ def test_forget(self):
995995 tabs = self .nb .tabs ()
996996 child1_index = self .nb .index (self .child1 )
997997 self .nb .forget (self .child1 )
998- self .assertFalse (str (self .child1 ) in self .nb .tabs ())
998+ self .assertNotIn (str (self .child1 ), self .nb .tabs ())
999999 self .assertEqual (len (tabs ) - 1 , len (self .nb .tabs ()))
10001000
10011001 self .nb .add (self .child1 )
10021002 self .assertEqual (self .nb .index (self .child1 ), 1 )
1003- self .assertFalse (child1_index == self .nb .index (self .child1 ))
1003+ self .assertNotEqual (child1_index , self .nb .index (self .child1 ))
10041004
10051005
10061006 def test_index (self ):
10071007 self .assertRaises (tkinter .TclError , self .nb .index , - 1 )
10081008 self .assertRaises (tkinter .TclError , self .nb .index , None )
10091009
1010- self .assertTrue ( isinstance ( self .nb .index ('end' ), int ) )
1010+ self .assertIsInstance ( self .nb .index ('end' ), int )
10111011 self .assertEqual (self .nb .index (self .child1 ), 0 )
10121012 self .assertEqual (self .nb .index (self .child2 ), 1 )
10131013 self .assertEqual (self .nb .index ('end' ), 2 )
@@ -1071,7 +1071,7 @@ def test_tab(self):
10711071 self .assertRaises (tkinter .TclError , self .nb .tab , 'notab' )
10721072 self .assertRaises (tkinter .TclError , self .nb .tab , None )
10731073
1074- self .assertTrue ( isinstance ( self .nb .tab (self .child1 ), dict ) )
1074+ self .assertIsInstance ( self .nb .tab (self .child1 ), dict )
10751075 self .assertEqual (self .nb .tab (self .child1 , text = None ), 'a' )
10761076 # newer form for querying a single option
10771077 self .assertEqual (self .nb .tab (self .child1 , 'text' ), 'a' )
@@ -1192,7 +1192,7 @@ def test_bbox(self):
11921192
11931193 bbox = self .tv .bbox (children [0 ])
11941194 self .assertEqual (len (bbox ), 4 )
1195- self .assertTrue ( isinstance ( bbox , tuple ) )
1195+ self .assertIsInstance ( bbox , tuple )
11961196 for item in bbox :
11971197 if not isinstance (item , int ):
11981198 self .fail ("Invalid bounding box: %s" % bbox )
@@ -1215,7 +1215,7 @@ def test_children(self):
12151215 self .assertEqual (self .tv .get_children (), ())
12161216
12171217 item_id = self .tv .insert ('' , 'end' )
1218- self .assertTrue ( isinstance ( self .tv .get_children (), tuple ) )
1218+ self .assertIsInstance ( self .tv .get_children (), tuple )
12191219 self .assertEqual (self .tv .get_children ()[0 ], item_id )
12201220
12211221 # add item_id and child3 as children of child2
@@ -1240,9 +1240,9 @@ def test_children(self):
12401240
12411241 def test_column (self ):
12421242 # return a dict with all options/values
1243- self .assertTrue ( isinstance ( self .tv .column ('#0' ), dict ) )
1243+ self .assertIsInstance ( self .tv .column ('#0' ), dict )
12441244 # return a single value of the given option
1245- self .assertTrue ( isinstance ( self .tv .column ('#0' , width = None ), int ) )
1245+ self .assertIsInstance ( self .tv .column ('#0' , width = None ), int )
12461246 # set a new value for an option
12471247 self .tv .column ('#0' , width = 10 )
12481248 # testing new way to get option value
@@ -1355,7 +1355,7 @@ def test_focus(self):
13551355
13561356 def test_heading (self ):
13571357 # check a dict is returned
1358- self .assertTrue ( isinstance ( self .tv .heading ('#0' ), dict ) )
1358+ self .assertIsInstance ( self .tv .heading ('#0' ), dict )
13591359
13601360 # check a value is returned
13611361 self .tv .heading ('#0' , text = 'hi' )
@@ -1466,7 +1466,7 @@ def test_insert_item(self):
14661466 self .tv .item (item , values = list (self .tv .item (item , values = None )))
14671467 self .assertEqual (self .tv .item (item , values = None ), (value , ))
14681468
1469- self .assertTrue ( isinstance ( self .tv .item (item ), dict ) )
1469+ self .assertIsInstance ( self .tv .item (item ), dict )
14701470
14711471 # erase item values
14721472 self .tv .item (item , values = '' )
@@ -1567,7 +1567,7 @@ def test_tag_configure(self):
15671567 'blue' )
15681568 self .assertEqual (str (self .tv .tag_configure ('test' , foreground = None )),
15691569 'blue' )
1570- self .assertTrue ( isinstance ( self .tv .tag_configure ('test' ), dict ) )
1570+ self .assertIsInstance ( self .tv .tag_configure ('test' ), dict )
15711571
15721572
15731573@add_standard_options (StandardTtkOptionsTests )
0 commit comments