當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。