Skip to content

test_xhtml2corpus

assertXmlEqual(got, want)

Check if two xml snippets are equal

Source code in /home/anders/projects/CorpusTools/corpustools/test/test_xhtml2corpus.py
28
29
30
31
32
33
34
35
def assertXmlEqual(got, want):
    """Check if two xml snippets are equal"""
    got = lxml.etree.tostring(got, encoding="unicode")
    want = lxml.etree.tostring(want, encoding="unicode")
    checker = lxml.doctestcompare.LXMLOutputChecker()
    if not checker.check_output(want, got, 0):
        message = checker.output_difference(doctest.Example("", want), got, 0)
        raise AssertionError(message)