📄 test_sxp.py
字号:
import unittestimport xen.xend.sxpclass test_sxp(unittest.TestCase): def testAllFromString(self): def t(inp, expected): self.assertEqual(xen.xend.sxp.all_from_string(inp), expected) t('String', ['String']) t('(String Thing)', [['String', 'Thing']]) t('(String) (Thing)', [['String'], ['Thing']]) def testParseFixed(self): fin = file('../xen/xend/tests/xend-config.sxp', 'rb') try: config = xen.xend.sxp.parse(fin) self.assertEqual( xen.xend.sxp.child_value( config, 'xend-relocation-hosts-allow'), '^localhost$ ^localhost\\.localdomain$') finally: fin.close() def testParseConfigExample(self): fin = file('../../examples/xend-config.sxp', 'rb') try: config = xen.xend.sxp.parse(fin) finally: fin.close()def test_suite(): return unittest.makeSuite(test_sxp)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -