-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkgptest.py
More file actions
65 lines (51 loc) · 1.27 KB
/
kgptest.py
File metadata and controls
65 lines (51 loc) · 1.27 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""Unit test for kgp.py
This program is part of "Dive Into Python", a free Python book for
experienced programmers. Visit http://diveintopython.org/ for the
latest version.
"""
__author__ = "Mark Pilgrim (mark@diveintopython.org)"
__version__ = "$Revision: 1.2 $"
__date__ = "$Date: 2004/05/05 21:57:19 $"
__copyright__ = "Copyright (c) 2001 Mark Pilgrim"
__license__ = "Python"
import unittest
import sys
if 'kgp' not in sys.path:
sys.path.append('kgp')
import kgp
class KGPTest(unittest.TestCase):
resultsMap = {"a":"0",
"b":"1",
"c":"2",
"d":"",
"e":"0",
"f":"10",
"g":"1"}
def setUp(self):
self.parser = kgp.KantGenerator('kgp/test.xml')
def doTest(self, key):
self.parser.loadSource('<xref id="%s"/>' % key)
self.assertEqual(self.resultsMap[key], self.parser.refresh())
def testA(self):
"""kgp a ref test"""
self.doTest("a")
def testB(self):
"""kgp b ref test"""
self.doTest("b")
def testC(self):
"""kgp c ref test"""
self.doTest("c")
def testD(self):
"""kgp d ref test"""
self.doTest("d")
def testE(self):
"""kgp e ref test"""
self.doTest("e")
def testF(self):
"""kgp f ref test"""
self.doTest("f")
def testG(self):
"""kgp g ref test"""
self.doTest("g")
if __name__ == "__main__":
unittest.main()