| 1 |
"Test help, coverage 94%." |
| 2 |
|
| 3 |
from idlelib import help |
| 4 |
import unittest |
| 5 |
from test.support import requires |
| 6 |
requires('gui') |
| 7 |
from os.path import abspath, dirname, join |
| 8 |
from tkinter import Tk |
| 9 |
|
| 10 |
|
| 11 |
class IdleDocTest(unittest.TestCase): |
| 12 |
|
| 13 |
@classmethod |
| 14 |
def setUpClass(cls): |
| 15 |
"By itself, this tests that file parsed without exception." |
| 16 |
cls.root = root = Tk() |
| 17 |
root.withdraw() |
| 18 |
cls.window = help.show_idlehelp(root) |
| 19 |
|
| 20 |
@classmethod |
| 21 |
def tearDownClass(cls): |
| 22 |
del cls.window |
| 23 |
cls.root.update_idletasks() |
| 24 |
cls.root.destroy() |
| 25 |
del cls.root |
| 26 |
|
| 27 |
def test_1window(self): |
| 28 |
self.assertIn('IDLE Doc', self.window.wm_title()) |
| 29 |
|
| 30 |
def test_4text(self): |
| 31 |
text = self.window.frame.text |
| 32 |
self.assertEqual(text.get('1.0', '1.end'), ' IDLE — Python editor and shell ') |
| 33 |
|
| 34 |
|
| 35 |
if __name__ == '__main__': |
| 36 |
unittest.main(verbosity=2) |