Issue #19602: Use specific asserts in tkinter tests.

This commit is contained in:
Serhiy Storchaka 2013-11-17 00:42:25 +02:00
parent 78ee078405
commit e3b5a76540
3 changed files with 26 additions and 26 deletions

View file

@ -45,7 +45,7 @@ class LabeledScaleTest(unittest.TestCase):
# it tries calling instance attributes not yet defined.
ttk.LabeledScale(variable=myvar)
if hasattr(sys, 'last_type'):
self.assertFalse(sys.last_type == tkinter.TclError)
self.assertNotEqual(sys.last_type, tkinter.TclError)
def test_initialization(self):
@ -120,14 +120,14 @@ class LabeledScaleTest(unittest.TestCase):
# at the same time this shouldn't affect test outcome
lscale.update()
curr_xcoord = lscale.scale.coords()[0]
self.assertTrue(prev_xcoord != curr_xcoord)
self.assertNotEqual(prev_xcoord, curr_xcoord)
# the label widget should have been repositioned too
linfo_2 = lscale.label.place_info()
self.assertEqual(lscale.label['text'], 0)
self.assertEqual(curr_xcoord, int(linfo_2['x']))
# change the range back
lscale.scale.configure(from_=0, to=10)
self.assertTrue(prev_xcoord != curr_xcoord)
self.assertNotEqual(prev_xcoord, curr_xcoord)
self.assertEqual(prev_xcoord, int(linfo_1['x']))
lscale.destroy()
@ -146,7 +146,7 @@ class LabeledScaleTest(unittest.TestCase):
# at the same time this shouldn't affect test outcome
x.update()
self.assertEqual(x.label['text'], newval)
self.assertTrue(x.scale.coords()[0] > curr_xcoord)
self.assertGreater(x.scale.coords()[0], curr_xcoord)
self.assertEqual(x.scale.coords()[0],
int(x.label.place_info()['x']))
@ -238,7 +238,7 @@ class OptionMenuTest(unittest.TestCase):
if last == curr:
# no more menu entries
break
self.assertFalse(curr == default)
self.assertNotEqual(curr, default)
i += 1
self.assertEqual(i, len(items))