test_07_PythonParsers.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:core-framework 作者: RedhawkSDR 项目源码 文件源码
def test_SCDParser(self):
        scd = parsers.SCDParser.parse("sdr/dom/components/CommandWrapper/CommandWrapper.scd.xml")
        self.assertEqual(scd.get_corbaversion(), "2.2")
        self.assertEqual(scd.get_componentrepid().get_repid(), "IDL:CF/Resource:1.0")
        self.assertEqual(scd.get_componenttype(), "resource")
        self.assertEqual(scd.get_componentfeatures().get_supportsinterface()[0].get_repid(), "IDL:CF/Resource:1.0")
        self.assertEqual(scd.get_componentfeatures().get_supportsinterface()[0].get_supportsname(), "Resource")
        self.assertEqual(scd.get_interfaces().get_interface()[0].get_name(), "Resource")
        self.assertEqual(scd.get_interfaces().get_interface()[0].get_inheritsinterface()[0].get_repid(), "IDL:CF/LifeCycle:1.0")

        # Verify that we can write the output and still be DTD valid
        tmpfile = tempfile.mktemp()
        try:
            tmp = open(tmpfile, "w")
            scd.export(tmp, 0)
            tmp.close()
            status = self._xmllint(tmpfile, "SCD")
            self.assertEqual(status, 0, "Python parser did not emit DTD compliant XML")
        finally:
            try:
                os.remove(tmpfile)
            except OSError:
                pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号