2018-06-21 23:48:45 -03:00
|
|
|
"Test stackviewer, coverage 63%."
|
2018-06-19 21:11:24 -03:00
|
|
|
|
|
|
|
from idlelib import stackviewer
|
|
|
|
import unittest
|
|
|
|
from test.support import requires
|
|
|
|
from tkinter import Tk
|
|
|
|
|
2018-06-21 23:48:45 -03:00
|
|
|
from idlelib.tree import TreeNode, ScrolledCanvas
|
|
|
|
import sys
|
2018-06-19 21:11:24 -03:00
|
|
|
|
2018-06-21 23:48:45 -03:00
|
|
|
|
|
|
|
class StackBrowserTest(unittest.TestCase):
|
2018-06-19 21:11:24 -03:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def setUpClass(cls):
|
2018-06-21 23:48:45 -03:00
|
|
|
svs = stackviewer.sys
|
|
|
|
try:
|
|
|
|
abc
|
|
|
|
except NameError:
|
|
|
|
svs.last_type, svs.last_value, svs.last_traceback = (
|
|
|
|
sys.exc_info())
|
|
|
|
|
2018-06-19 21:11:24 -03:00
|
|
|
requires('gui')
|
|
|
|
cls.root = Tk()
|
|
|
|
cls.root.withdraw()
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def tearDownClass(cls):
|
2018-06-21 23:48:45 -03:00
|
|
|
svs = stackviewer.sys
|
|
|
|
del svs.last_traceback, svs.last_type, svs.last_value
|
|
|
|
|
2018-06-19 21:11:24 -03:00
|
|
|
cls.root.update_idletasks()
|
|
|
|
## for id in cls.root.tk.call('after', 'info'):
|
|
|
|
## cls.root.after_cancel(id) # Need for EditorWindow.
|
|
|
|
cls.root.destroy()
|
|
|
|
del cls.root
|
|
|
|
|
|
|
|
def test_init(self):
|
2018-06-21 23:48:45 -03:00
|
|
|
sb = stackviewer.StackBrowser(self.root)
|
|
|
|
isi = self.assertIsInstance
|
|
|
|
isi(stackviewer.sc, ScrolledCanvas)
|
|
|
|
isi(stackviewer.item, stackviewer.StackTreeItem)
|
|
|
|
isi(stackviewer.node, TreeNode)
|
2018-06-19 21:11:24 -03:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main(verbosity=2)
|