test_sxp.py
来自「xen虚拟机源代码安装包」· Python 代码 · 共 40 行
PY
40 行
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 + =
减小字号Ctrl + -
显示快捷键?