Coverage for idle_test/test_stackviewer.py: 63%
32 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 stackviewer, coverage 63%."
3from idlelib import stackviewer
4import unittest
5from test.support import requires
6from tkinter import Tk
8from idlelib.tree import TreeNode, ScrolledCanvas
9import sys
12class StackBrowserTest(unittest.TestCase):
14 @classmethod
15 def setUpClass(cls):
16 svs = stackviewer.sys
17 try:
18 abc
19 except NameError:
20 svs.last_type, svs.last_value, svs.last_traceback = (
21 sys.exc_info())
23 requires('gui')
24 cls.root = Tk()
25 cls.root.withdraw()
27 @classmethod
28 def tearDownClass(cls):
29 svs = stackviewer.sys
30 del svs.last_traceback, svs.last_type, svs.last_value
32 cls.root.update_idletasks()
33## for id in cls.root.tk.call('after', 'info'):
34## cls.root.after_cancel(id) # Need for EditorWindow.
35 cls.root.destroy()
36 del cls.root
38 def test_init(self):
39 sb = stackviewer.StackBrowser(self.root)
40 isi = self.assertIsInstance
41 isi(stackviewer.sc, ScrolledCanvas)
42 isi(stackviewer.item, stackviewer.StackTreeItem)
43 isi(stackviewer.node, TreeNode)
46if __name__ == '__main__': 46 ↛ 47line 46 didn't jump to line 47, because the condition on line 46 was never true
47 unittest.main(verbosity=2)