1"Test tree. coverage 56%." 2 3from idlelib import tree 4import unittest 5from test.support import requires 6requires('gui') 7from tkinter import Tk 8 9 10class TreeTest(unittest.TestCase): 11 12 @classmethod 13 def setUpClass(cls): 14 cls.root = Tk() 15 cls.root.withdraw() 16 17 @classmethod 18 def tearDownClass(cls): 19 cls.root.destroy() 20 del cls.root 21 22 def test_init(self): 23 # Start with code slightly adapted from htest. 24 sc = tree.ScrolledCanvas( 25 self.root, bg="white", highlightthickness=0, takefocus=1) 26 sc.frame.pack(expand=1, fill="both", side='left') 27 item = tree.FileTreeItem(tree.ICONDIR) 28 node = tree.TreeNode(sc.canvas, None, item) 29 node.expand() 30 31 32if __name__ == '__main__': 33 unittest.main(verbosity=2) 34