• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"Test stackviewer, coverage 63%."
2
3from idlelib import stackviewer
4import unittest
5from test.support import requires
6from tkinter import Tk
7
8from idlelib.tree import TreeNode, ScrolledCanvas
9import sys
10
11
12class StackBrowserTest(unittest.TestCase):
13
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())
22
23        requires('gui')
24        cls.root = Tk()
25        cls.root.withdraw()
26
27    @classmethod
28    def tearDownClass(cls):
29        svs = stackviewer.sys
30        del svs.last_traceback, svs.last_type, svs.last_value
31
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
37
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)
44
45
46if __name__ == '__main__':
47    unittest.main(verbosity=2)
48