1"Test multicall, coverage 33%." 2 3from idlelib import multicall 4import unittest 5from test.support import requires 6from tkinter import Tk, Text 7 8 9class MultiCallTest(unittest.TestCase): 10 11 @classmethod 12 def setUpClass(cls): 13 requires('gui') 14 cls.root = Tk() 15 cls.root.withdraw() 16 cls.mc = multicall.MultiCallCreator(Text) 17 18 @classmethod 19 def tearDownClass(cls): 20 del cls.mc 21 cls.root.update_idletasks() 22## for id in cls.root.tk.call('after', 'info'): 23## cls.root.after_cancel(id) # Need for EditorWindow. 24 cls.root.destroy() 25 del cls.root 26 27 def test_creator(self): 28 mc = self.mc 29 self.assertIs(multicall._multicall_dict[Text], mc) 30 self.assertTrue(issubclass(mc, Text)) 31 mc2 = multicall.MultiCallCreator(Text) 32 self.assertIs(mc, mc2) 33 34 def test_init(self): 35 mctext = self.mc(self.root) 36 self.assertIsInstance(mctext._MultiCall__binders, list) 37 38 def test_yview(self): 39 # Added for tree.wheel_event 40 # (it depends on yview to not be overridden) 41 mc = self.mc 42 self.assertIs(mc.yview, Text.yview) 43 mctext = self.mc(self.root) 44 self.assertIs(mctext.yview.__func__, Text.yview) 45 46 47if __name__ == '__main__': 48 unittest.main(verbosity=2) 49