def test_DCDParser_loggingconfig(self):
dcd = parsers.DCDParser.parse("sdr/parser_tests/loggingconfig.dcd.xml")
self.assertEqual(dcd.get_id(), "test_GPP_green")
self.assertEqual(dcd.get_name(), "test_GPP_green")
self.assertEqual(len(dcd.componentfiles.get_componentfile()), 1)
self.assertEqual(len(dcd.partitioning.get_componentplacement()), 1)
gpp=dcd.partitioning.get_componentplacement()[0]
gpp_ci=gpp.get_componentinstantiation()[0]
self.assertEqual(gpp.get_componentfileref().get_refid(), "GPP1_file_1")
self.assertEqual(gpp_ci.get_id(), "test_GPP_green::GPP_1")
self.assertEqual(gpp_ci.get_usagename(), "test_GPP_green::GPP_1")
self.assertEqual(gpp_ci.loggingconfig.level, "ERROR")
self.assertEqual(gpp_ci.loggingconfig.value, "path/to/my/log/file")
# Verify that we can write the output and still be DTD valid
tmpfile = tempfile.mktemp()
try:
tmp = open(tmpfile, "w")
dcd.export(tmp, 0)
tmp.close()
status = self._xmllint(tmpfile, "DCD")
self.assertEqual(status, 0, "Python parser did not emit DTD compliant XML")
finally:
try:
os.remove(tmpfile)
except OSError:
pass
test_07_PythonParsers.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录