?? kgptest.py
字號:
"""Unit test for kgp.pyThis program is part of "Dive Into Python", a free Python book forexperienced programmers. Visit http://diveintopython.org/ for thelatest 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 unittestimport sysif 'kgp' not in sys.path: sys.path.append('kgp')import kgpclass 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()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -