test_stackviewer.py 991 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "Test stackviewer, coverage 63%."
  2. from idlelib import stackviewer
  3. import unittest
  4. from test.support import requires
  5. from tkinter import Tk
  6. from idlelib.tree import TreeNode, ScrolledCanvas
  7. class StackBrowserTest(unittest.TestCase):
  8. @classmethod
  9. def setUpClass(cls):
  10. requires('gui')
  11. cls.root = Tk()
  12. cls.root.withdraw()
  13. @classmethod
  14. def tearDownClass(cls):
  15. cls.root.update_idletasks()
  16. ## for id in cls.root.tk.call('after', 'info'):
  17. ## cls.root.after_cancel(id) # Need for EditorWindow.
  18. cls.root.destroy()
  19. del cls.root
  20. def test_init(self):
  21. try:
  22. abc
  23. except NameError as exc:
  24. sb = stackviewer.StackBrowser(self.root, exc)
  25. isi = self.assertIsInstance
  26. isi(stackviewer.sc, ScrolledCanvas)
  27. isi(stackviewer.item, stackviewer.StackTreeItem)
  28. isi(stackviewer.node, TreeNode)
  29. if __name__ == '__main__':
  30. unittest.main(verbosity=2)