Coverage for idle_test/test_multicall.py: 49%

33 statements  

« prev     ^ index     » next       coverage.py v7.2.5, created at 2023-05-11 13:22 -0700

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__': 47 ↛ 48line 47 didn't jump to line 48, because the condition on line 47 was never true

48 unittest.main(verbosity=2)