Coverage for idle_test/test_statusbar.py: 49%
31 statements
« prev ^ index » next coverage.py v7.2.5, created at 2023-05-11 13:22 -0700
« prev ^ index » next coverage.py v7.2.5, created at 2023-05-11 13:22 -0700
1"Test statusbar, coverage 100%."
3from idlelib import statusbar
4import unittest
5from test.support import requires
6from tkinter import Tk
9class Test(unittest.TestCase):
11 @classmethod
12 def setUpClass(cls):
13 requires('gui')
14 cls.root = Tk()
15 cls.root.withdraw()
17 @classmethod
18 def tearDownClass(cls):
19 cls.root.update_idletasks()
20 cls.root.destroy()
21 del cls.root
23 def test_init(self):
24 bar = statusbar.MultiStatusBar(self.root)
25 self.assertEqual(bar.labels, {})
27 def test_set_label(self):
28 bar = statusbar.MultiStatusBar(self.root)
29 bar.set_label('left', text='sometext', width=10)
30 self.assertIn('left', bar.labels)
31 left = bar.labels['left']
32 self.assertEqual(left['text'], 'sometext')
33 self.assertEqual(left['width'], 10)
34 bar.set_label('left', text='revised text')
35 self.assertEqual(left['text'], 'revised text')
36 bar.set_label('right', text='correct text')
37 self.assertEqual(bar.labels['right']['text'], 'correct text')
40if __name__ == '__main__': 40 ↛ 41line 40 didn't jump to line 41, because the condition on line 40 was never true
41 unittest.main(verbosity=2)