-
Notifications
You must be signed in to change notification settings - Fork 1
/
unittest_doctest.py
40 lines (29 loc) · 953 Bytes
/
unittest_doctest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import unittest
import doctest
import choice.router as router
import choice.mogrifyer as mogrifyer
import choice.parser as parser
import choice.filter as filter
import choice.writer as writer
class TestChoiceDoctest(unittest.TestCase):
flags = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE
def doctest(self, module):
results = doctest.testmod(module, optionflags = self.flags)
self.assertNotEqual(results.attempted, 0)
self.assertEqual(results.failed, 0)
def test_router(self):
self.doctest(router)
def test_mogrifyer(self):
self.doctest(mogrifyer)
def test_parser(self):
self.doctest(parser)
def test_filter(self):
self.doctest(filter)
def test_writer(self):
self.doctest(writer)
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestChoiceDoctest))
return suite
if __name__ == '__main__':
unittest.main()