def test_DCDParser_affinity(self):
dcd = parsers.DCDParser.parse("sdr/parser_tests/affinity.dcd.xml")
self.assertEqual(dcd.get_id(), "affinity_parse_1")
self.assertEqual(dcd.get_name(), "test_affinity_node_socket")
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(), "GPP_File_1")
self.assertEqual(gpp_ci.get_id(), "test_affinity_node:GPP_1")
self.assertEqual(gpp_ci.get_usagename(), "GPP_1")
self.assertEqual(len(gpp_ci.affinity.get_simpleref()),2)
self.assertEqual(gpp_ci.affinity.get_simpleref()[0].refid, "affinity::exec_directive_class")
self.assertEqual(gpp_ci.affinity.get_simpleref()[0].value, "socket")
self.assertEqual(gpp_ci.affinity.get_simpleref()[1].refid, "affinity::exec_directive_value")
self.assertEqual(gpp_ci.affinity.get_simpleref()[1].value, "0")
# 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
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录