当前位置: 首页>>代码示例>>Python>>正文


Python doctestcompare.LXMLOutputChecker方法代码示例

本文整理汇总了Python中lxml.doctestcompare.LXMLOutputChecker方法的典型用法代码示例。如果您正苦于以下问题:Python doctestcompare.LXMLOutputChecker方法的具体用法?Python doctestcompare.LXMLOutputChecker怎么用?Python doctestcompare.LXMLOutputChecker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lxml.doctestcompare的用法示例。


在下文中一共展示了doctestcompare.LXMLOutputChecker方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: equals

# 需要导入模块: from lxml import doctestcompare [as 别名]
# 或者: from lxml.doctestcompare import LXMLOutputChecker [as 别名]
def equals(self, rhs):
    checker = doctestcompare.LXMLOutputChecker()
    return checker.check_output(self._xml, rhs, 0) 
开发者ID:elsigh,项目名称:browserscope,代码行数:5,代码来源:xmpp_request_handler_test.py

示例2: compare_xml

# 需要导入模块: from lxml import doctestcompare [as 别名]
# 或者: from lxml.doctestcompare import LXMLOutputChecker [as 别名]
def compare_xml(generated, expected):
    """Use doctest checking from lxml for comparing XML trees. Returns diff if the two are not the same"""
    checker = LXMLOutputChecker()

    class DummyDocTest():
        pass

    ob = DummyDocTest()
    ob.want = expected

    check = checker.check_output(expected, generated, PARSE_XML)
    if check is False:
        diff = checker.output_difference(ob, generated, PARSE_XML)
        return diff 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:16,代码来源:helper.py

示例3: check_etree

# 需要导入模块: from lxml import doctestcompare [as 别名]
# 或者: from lxml.doctestcompare import LXMLOutputChecker [as 别名]
def check_etree(self, conv, tostring=tostring, fromstring=fromstring):
        'Returns method(obj, xmlstring) that converts obj to XML and compares'
        checker = LXMLOutputChecker()
        eq = checker.compare_docs

        def compare(obj, *strings):
            tree = conv.etree(obj)
            self.assertEqual(len(tree), len(strings))
            for left, right in zip(tree, strings):
                if not eq(left, fromstring(right)):
                    raise AssertionError('%s != %s' % (decode(tostring(left)), right))

        return compare 
开发者ID:sanand0,项目名称:xmljson,代码行数:15,代码来源:test_xmljson.py

示例4: assertXmlEqual

# 需要导入模块: from lxml import doctestcompare [as 别名]
# 或者: from lxml.doctestcompare import LXMLOutputChecker [as 别名]
def assertXmlEqual(self, got, want):
        checker = LXMLOutputChecker()
        if not checker.check_output(want, got, 0):
            message = checker.output_difference(Example("", want), got, 0)
            raise AssertionError(message) 
开发者ID:dimagi,项目名称:gmail-filters,代码行数:7,代码来源:unittest.py


注:本文中的lxml.doctestcompare.LXMLOutputChecker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。