Coverage for idle_test/test_window.py: 68%
28 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 window, coverage 47%."
3from idlelib import window
4import unittest
5from test.support import requires
6from tkinter import Tk
9class WindowListTest(unittest.TestCase):
11 def test_init(self):
12 wl = window.WindowList() 1b
13 self.assertEqual(wl.dict, {}) 1b
14 self.assertEqual(wl.callbacks, []) 1b
16 # Further tests need mock Window.
19class ListedToplevelTest(unittest.TestCase):
21 @classmethod
22 def setUpClass(cls):
23 window.registry = set()
24 requires('gui')
25 cls.root = Tk()
26 cls.root.withdraw()
28 @classmethod
29 def tearDownClass(cls):
30 window.registry = window.WindowList()
31 cls.root.update_idletasks()
32## for id in cls.root.tk.call('after', 'info'):
33## cls.root.after_cancel(id) # Need for EditorWindow.
34 cls.root.destroy()
35 del cls.root
37 def test_init(self):
39 win = window.ListedToplevel(self.root)
40 self.assertIn(win, window.registry)
41 self.assertEqual(win.focused_widget, win)
44if __name__ == '__main__': 44 ↛ 45line 44 didn't jump to line 45, because the condition on line 44 was never true
45 unittest.main(verbosity=2)