Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82ae155

Browse files
committed
Issue #24759: Add test for IDLE syntax colorizoer.
1 parent 7082bc3 commit 82ae155

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)