1 | n/a | '''Test idlelib/colorizer.py |
---|
2 | n/a | |
---|
3 | n/a | Perform minimal sanity checks that module imports and some things run. |
---|
4 | n/a | |
---|
5 | n/a | Coverage 22%. |
---|
6 | n/a | ''' |
---|
7 | n/a | from idlelib import colorizer # always test import |
---|
8 | n/a | from test.support import requires |
---|
9 | n/a | from tkinter import Tk, Text |
---|
10 | n/a | import unittest |
---|
11 | n/a | |
---|
12 | n/a | |
---|
13 | n/a | class FunctionTest(unittest.TestCase): |
---|
14 | n/a | |
---|
15 | n/a | def test_any(self): |
---|
16 | n/a | self.assertTrue(colorizer.any('test', ('a', 'b'))) |
---|
17 | n/a | |
---|
18 | n/a | def test_make_pat(self): |
---|
19 | n/a | self.assertTrue(colorizer.make_pat()) |
---|
20 | n/a | |
---|
21 | n/a | |
---|
22 | n/a | class ColorConfigTest(unittest.TestCase): |
---|
23 | n/a | |
---|
24 | n/a | @classmethod |
---|
25 | n/a | def setUpClass(cls): |
---|
26 | n/a | requires('gui') |
---|
27 | n/a | cls.root = Tk() |
---|
28 | n/a | cls.text = Text(cls.root) |
---|
29 | n/a | |
---|
30 | n/a | @classmethod |
---|
31 | n/a | def tearDownClass(cls): |
---|
32 | n/a | del cls.text |
---|
33 | n/a | cls.root.destroy() |
---|
34 | n/a | del cls.root |
---|
35 | n/a | |
---|
36 | n/a | def test_colorizer(self): |
---|
37 | n/a | colorizer.color_config(self.text) |
---|
38 | n/a | |
---|
39 | n/a | class ColorDelegatorTest(unittest.TestCase): |
---|
40 | n/a | |
---|
41 | n/a | @classmethod |
---|
42 | n/a | def setUpClass(cls): |
---|
43 | n/a | requires('gui') |
---|
44 | n/a | cls.root = Tk() |
---|
45 | n/a | |
---|
46 | n/a | @classmethod |
---|
47 | n/a | def tearDownClass(cls): |
---|
48 | n/a | cls.root.destroy() |
---|
49 | n/a | del cls.root |
---|
50 | n/a | |
---|
51 | n/a | def test_colorizer(self): |
---|
52 | n/a | colorizer.ColorDelegator() |
---|
53 | n/a | |
---|
54 | n/a | |
---|
55 | n/a | if __name__ == '__main__': |
---|
56 | n/a | unittest.main(verbosity=2) |
---|