ยปCore Development>Code coverage>Lib/idlelib/idle_test/test_help_about.py

Python code coverage for Lib/idlelib/idle_test/test_help_about.py

#countcontent
1n/a'''Test idlelib.help_about.
2n/a
3n/aCoverage:
4n/a'''
5n/afrom idlelib import help_about
6n/afrom idlelib import textview
7n/afrom idlelib.idle_test.mock_idle import Func
8n/afrom idlelib.idle_test.mock_tk import Mbox_func
9n/aimport unittest
10n/a
11n/aAbout = help_about.AboutDialog
12n/aclass Dummy_about_dialog():
13n/a # Dummy class for testing file display functions.
14n/a idle_credits = About.ShowIDLECredits
15n/a idle_readme = About.ShowIDLEAbout
16n/a idle_news = About.ShowIDLENEWS
17n/a # Called by the above
18n/a display_file_text = About.display_file_text
19n/a
20n/a
21n/aclass DisplayFileTest(unittest.TestCase):
22n/a dialog = Dummy_about_dialog()
23n/a
24n/a @classmethod
25n/a def setUpClass(cls):
26n/a cls.orig_error = textview.showerror
27n/a cls.orig_view = textview.view_text
28n/a cls.error = Mbox_func()
29n/a cls.view = Func()
30n/a textview.showerror = cls.error
31n/a textview.view_text = cls.view
32n/a cls.About = Dummy_about_dialog()
33n/a
34n/a @classmethod
35n/a def tearDownClass(cls):
36n/a textview.showerror = cls.orig_error
37n/a textview.view_text = cls.orig_view
38n/a
39n/a def test_file_isplay(self):
40n/a for handler in (self.dialog.idle_credits,
41n/a self.dialog.idle_readme,
42n/a self.dialog.idle_news):
43n/a self.error.message = ''
44n/a self.view.called = False
45n/a with self.subTest(handler=handler):
46n/a handler()
47n/a self.assertEqual(self.error.message, '')
48n/a self.assertEqual(self.view.called, True)
49n/a
50n/a
51n/aif __name__ == '__main__':
52n/a unittest.main(verbosity=2)