twisted.web.microdom.parseString

Here are the examples of the python api twisted.web.microdom.parseString taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

72 Examples 7

Example 1

Project: ccs-calendarserver
Source File: outbound.py
View license
def _fixup(data, rendererName):
    document = parseString(data, beExtremelyLenient=True)
    document.documentElement.setAttribute(
        "xmlns:t", TEMPLATE_NAMESPACE
    )
    document.doctype = (
        'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" '
        '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"'
    )
    document.documentElement.setAttribute(
        "t:render", rendererName
    )
    _walk(document, document)
    result = document.toxml()
    return result

Example 2

Project: ccs-calendarserver
Source File: outbound.py
View license
def _fixup(data, rendererName):
    document = parseString(data, beExtremelyLenient=True)
    document.documentElement.setAttribute(
        "xmlns:t", TEMPLATE_NAMESPACE
    )
    document.doctype = (
        'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" '
        '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"'
    )
    document.documentElement.setAttribute(
        "t:render", rendererName
    )
    _walk(document, document)
    result = document.toxml()
    return result

Example 3

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_leadingTextDropping(self):
        """
        Make sure that if there's no top-level node lenient-mode won't
        drop leading text that's outside of any elements.
        """
        s = "Hi orders! <br>Well. <br>"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          '<html>Hi orders! <br />Well. <br /></html>')

Example 4

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_trailingTextDropping(self):
        """
        Ensure that no *trailing* text in a mal-formed
        no-top-level-element document(s) will not be dropped.
        """
        s = "<br>Hi orders!"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          '<html><br />Hi orders!</html>')

Example 5

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_noTags(self):
        """
        A string with nothing that looks like a tag at all should just
        be parsed as body text.
        """
        s = "Hi orders!"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          "<html>Hi orders!</html>")

Example 6

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_surroundingCrap(self):
        """
        If a document is surrounded by non-xml text, the text should
        be remain in the XML.
        """
        s = "Hi<br> orders!"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          "<html>Hi<br /> orders!</html>")

Example 7

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testCaseSensitiveSoonCloser(self):
        s = """
              <HTML><BODY>
              <P ALIGN="CENTER">
                <A HREF="http://www.apache.org/"><IMG SRC="/icons/apache_pb.gif"></A>
              </P>

              <P>
                This is an insane set of text nodes that should NOT be gathered under
                the A tag above.
              </P>
              </BODY></HTML>
            """
        d = microdom.parseString(s, beExtremelyLenient=1)
        l = domhelpers.findNodesNamed(d.documentElement, 'a')
        n = domhelpers.gatherTextNodes(l[0],1).replace('&nbsp;',' ')
        self.assertEqual(n.find('insane'), -1)

Example 8

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_lenientParenting(self):
        """
        Test that C{parentNode} attributes are set to meaningful values when
        we are parsing HTML that lacks a root node.
        """
        # Spare the rod, ruin the child.
        s = "<br/><br/>"
        d = microdom.parseString(s, beExtremelyLenient=1)
        self.assertIdentical(d.documentElement,
                             d.documentElement.firstChild().parentNode)

Example 9

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_lenientParentSingle(self):
        """
        Test that the C{parentNode} attribute is set to a meaningful value
        when we parse an HTML document that has a non-Element root node.
        """
        s = "Hello"
        d = microdom.parseString(s, beExtremelyLenient=1)
        self.assertIdentical(d.documentElement,
                             d.documentElement.firstChild().parentNode)

Example 10

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testUnEntities(self):
        s = """
                <HTML>
                    This HTML goes between Stupid <=CrAzY!=> Dumb.
                </HTML>
            """
        d = microdom.parseString(s, beExtremelyLenient=1)
        n = domhelpers.gatherTextNodes(d)
        self.assertNotEquals(n.find('>'), -1)

Example 11

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testTameDocument(self):
        s = """
        <test>
         <it>
          <is>
           <a>
            test
           </a>
          </is>
         </it>
        </test>
        """
        d = microdom.parseString(s)
        self.assertEqual(
            domhelpers.gatherTextNodes(d.documentElement).strip() ,'test')

Example 12

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testScriptLeniency(self):
        s = """
        <script>(foo < bar) and (bar > foo)</script>
        <script language="javascript">foo </scrip bar </script>
        <script src="foo">
        <script src="foo">baz</script>
        <script /><script></script>
        """
        d = microdom.parseString(s, beExtremelyLenient=1)
        self.assertEqual(d.firstChild().firstChild().firstChild().data,
                          "(foo < bar) and (bar > foo)")
        self.assertEqual(
            d.firstChild().getElementsByTagName("script")[1].firstChild().data,
            "foo </scrip bar ")

Example 13

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testDifferentQuotes(self):
        s = '<test a="a" b=\'b\' />'
        d = microdom.parseString(s)
        e = d.documentElement
        self.assertEqual(e.getAttribute('a'), 'a')
        self.assertEqual(e.getAttribute('b'), 'b')

Example 14

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLinebreaks(self):
        s = '<test \na="a"\n\tb="#b" />'
        d = microdom.parseString(s)
        e = d.documentElement
        self.assertEqual(e.getAttribute('a'), 'a')
        self.assertEqual(e.getAttribute('b'), '#b')

Example 15

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testComment(self):
        s = "<bar><!--<foo />--></bar>"
        d = microdom.parseString(s)
        e = d.documentElement
        self.assertEqual(e.nodeName, "bar")
        c = e.childNodes[0]
        self.assert_(isinstance(c, microdom.Comment))
        self.assertEqual(c.value, "<foo />")
        c2 = c.cloneNode()
        self.assert_(c is not c2)
        self.assertEqual(c2.toxml(), "<!--<foo />-->")

Example 16

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_replaceNonChild(self):
        """
        L{Node.replaceChild} raises L{ValueError} if the node given to be
        replaced is not a child of the node C{replaceChild} is called on.
        """
        parent = microdom.parseString('<foo />')
        orphan = microdom.parseString('<bar />')
        replacement = microdom.parseString('<baz />')

        self.assertRaises(
            ValueError, parent.replaceChild, replacement, orphan)

Example 17

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testDoctype(self):
        s = ('<?xml version="1.0"?>'
        '<!DOCTYPE foo PUBLIC "baz" "http://www.example.com/example.dtd">'
        '<foo></foo>')
        s2 = '<foo/>'
        d = microdom.parseString(s)
        d2 = microdom.parseString(s2)
        self.assertEqual(d.doctype,
                          'foo PUBLIC "baz" "http://www.example.com/example.dtd"')
        self.assertEqual(d.toxml(), s)
        self.failIf(d.isEqualToDocument(d2))
        self.failUnless(d.documentElement.isEqualToNode(d2.documentElement))

Example 18

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testOutput(self):
        for s, out in self.samples:
            d = microdom.parseString(s, caseInsensitive=0)
            d2 = microdom.parseString(out, caseInsensitive=0)
            testOut = d.documentElement.toxml()
            self.assertEqual(out, testOut)
            self.assert_(d.isEqualToDocument(d2))

Example 19

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testEatingWhitespace(self):
        s = """<hello>
        </hello>"""
        d = microdom.parseString(s)
        self.failUnless(not d.documentElement.hasChildNodes(),
                        d.documentElement.childNodes)
        self.failUnless(d.isEqualToDocument(microdom.parseString('<hello></hello>')))

Example 20

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLenientAmpersand(self):
        prefix = "<?xml version='1.0'?>"
        # we use <pre> so space will be preserved
        for i, o in [("&", "&amp;"),
                     ("& ", "&amp; "),
                     ("&amp;", "&amp;"),
                     ("&hello monkey", "&amp;hello monkey")]:
            d = microdom.parseString("%s<pre>%s</pre>"
                                     % (prefix, i), beExtremelyLenient=1)
            self.assertEqual(d.documentElement.toxml(), "<pre>%s</pre>" % o)
        # non-space preserving
        d = microdom.parseString("<t>hello & there</t>", beExtremelyLenient=1)
        self.assertEqual(d.documentElement.toxml(), "<t>hello &amp; there</t>")

Example 21

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testInsensitiveLenient(self):
        # testing issue #537
        d = microdom.parseString(
            "<?xml version='1.0'?><bar><xA><y>c</Xa> <foo></bar>",
            beExtremelyLenient=1)
        self.assertEqual(d.documentElement.firstChild().toxml(), "<xa><y>c</y></xa>")

Example 22

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLaterCloserSimple(self):
        s = "<ul><li>foo<li>bar<li>baz</ul>"
        d = microdom.parseString(s, beExtremelyLenient=1)
        expected = "<ul><li>foo</li><li>bar</li><li>baz</li></ul>"
        actual = d.documentElement.toxml()
        self.assertEqual(expected, actual)

Example 23

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLaterCloserCaseInsensitive(self):
        s = "<DL><p><DT>foo<DD>bar</DL>"
        d = microdom.parseString(s, beExtremelyLenient=1)
        expected = "<dl><p></p><dt>foo</dt><dd>bar</dd></dl>"
        actual = d.documentElement.toxml()
        self.assertEqual(expected, actual)

Example 24

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLaterCloserTable(self):
        s = ("<table>"
             "<tr><th>name<th>value<th>comment"
             "<tr><th>this<td>tag<td>soup"
             "<tr><th>must<td>be<td>handled"
             "</table>")
        expected = ("<table>"
                    "<tr><th>name</th><th>value</th><th>comment</th></tr>"
                    "<tr><th>this</th><td>tag</td><td>soup</td></tr>"
                    "<tr><th>must</th><td>be</td><td>handled</td></tr>"
                    "</table>")
        d = microdom.parseString(s, beExtremelyLenient=1)
        actual = d.documentElement.toxml()
        self.assertEqual(expected, actual)

Example 25

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLaterCloserDL(self):
        s = ("<dl>"
             "<dt>word<dd>definition"
             "<dt>word<dt>word<dd>definition<dd>definition"
             "</dl>")
        expected = ("<dl>"
                    "<dt>word</dt><dd>definition</dd>"
                    "<dt>word</dt><dt>word</dt><dd>definition</dd><dd>definition</dd>"
                    "</dl>")
        d = microdom.parseString(s, beExtremelyLenient=1)
        actual = d.documentElement.toxml()
        self.assertEqual(expected, actual)

Example 26

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLaterCloserDL2(self):
        s = ("<dl>"
             "<dt>word<dd>definition<p>more definition"
             "<dt>word"
             "</dl>")
        expected = ("<dl>"
                    "<dt>word</dt><dd>definition<p>more definition</p></dd>"
                    "<dt>word</dt>"
                    "</dl>")
        d = microdom.parseString(s, beExtremelyLenient=1)
        actual = d.documentElement.toxml()
        self.assertEqual(expected, actual)

Example 27

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testCloneDocument(self):
        s = ('<?xml version="1.0"?>'
             '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
             '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><foo></foo>')

        node = microdom.parseString(s)
        clone = node.cloneNode(deep=1)
        self.failIfEquals(node, clone)
        self.assertEqual(len(node.childNodes), len(clone.childNodes))
        self.assertEqual(s, clone.toxml())

        self.failUnless(clone.isEqualToDocument(node))
        self.failUnless(node.isEqualToDocument(clone))

Example 28

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def checkParsed(self, input, expected, beExtremelyLenient=1):
        """
        Check that C{input}, when parsed, produces a DOM where the XML
        of the document element is equal to C{expected}.
        """
        output = microdom.parseString(input,
                                      beExtremelyLenient=beExtremelyLenient)
        self.assertEqual(output.documentElement.toxml(), expected)

Example 29

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_leadingTextDropping(self):
        """
        Make sure that if there's no top-level node lenient-mode won't
        drop leading text that's outside of any elements.
        """
        s = "Hi orders! <br>Well. <br>"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          '<html>Hi orders! <br />Well. <br /></html>')

Example 30

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_trailingTextDropping(self):
        """
        Ensure that no *trailing* text in a mal-formed
        no-top-level-element document(s) will not be dropped.
        """
        s = "<br>Hi orders!"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          '<html><br />Hi orders!</html>')

Example 31

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_noTags(self):
        """
        A string with nothing that looks like a tag at all should just
        be parsed as body text.
        """
        s = "Hi orders!"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          "<html>Hi orders!</html>")

Example 32

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_surroundingCrap(self):
        """
        If a document is surrounded by non-xml text, the text should
        be remain in the XML.
        """
        s = "Hi<br> orders!"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          "<html>Hi<br /> orders!</html>")

Example 33

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testCaseSensitiveSoonCloser(self):
        s = """
              <HTML><BODY>
              <P ALIGN="CENTER">
                <A HREF="http://www.apache.org/"><IMG SRC="/icons/apache_pb.gif"></A>
              </P>

              <P>
                This is an insane set of text nodes that should NOT be gathered under
                the A tag above.
              </P>
              </BODY></HTML>
            """
        d = microdom.parseString(s, beExtremelyLenient=1)
        l = domhelpers.findNodesNamed(d.documentElement, 'a')
        n = domhelpers.gatherTextNodes(l[0],1).replace('&nbsp;',' ')
        self.assertEqual(n.find('insane'), -1)

Example 34

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_lenientParenting(self):
        """
        Test that C{parentNode} attributes are set to meaningful values when
        we are parsing HTML that lacks a root node.
        """
        # Spare the rod, ruin the child.
        s = "<br/><br/>"
        d = microdom.parseString(s, beExtremelyLenient=1)
        self.assertIdentical(d.documentElement,
                             d.documentElement.firstChild().parentNode)

Example 35

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_lenientParentSingle(self):
        """
        Test that the C{parentNode} attribute is set to a meaningful value
        when we parse an HTML document that has a non-Element root node.
        """
        s = "Hello"
        d = microdom.parseString(s, beExtremelyLenient=1)
        self.assertIdentical(d.documentElement,
                             d.documentElement.firstChild().parentNode)

Example 36

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testUnEntities(self):
        s = """
                <HTML>
                    This HTML goes between Stupid <=CrAzY!=> Dumb.
                </HTML>
            """
        d = microdom.parseString(s, beExtremelyLenient=1)
        n = domhelpers.gatherTextNodes(d)
        self.assertNotEquals(n.find('>'), -1)

Example 37

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testTameDocument(self):
        s = """
        <test>
         <it>
          <is>
           <a>
            test
           </a>
          </is>
         </it>
        </test>
        """
        d = microdom.parseString(s)
        self.assertEqual(
            domhelpers.gatherTextNodes(d.documentElement).strip() ,'test')

Example 38

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testScriptLeniency(self):
        s = """
        <script>(foo < bar) and (bar > foo)</script>
        <script language="javascript">foo </scrip bar </script>
        <script src="foo">
        <script src="foo">baz</script>
        <script /><script></script>
        """
        d = microdom.parseString(s, beExtremelyLenient=1)
        self.assertEqual(d.firstChild().firstChild().firstChild().data,
                          "(foo < bar) and (bar > foo)")
        self.assertEqual(
            d.firstChild().getElementsByTagName("script")[1].firstChild().data,
            "foo </scrip bar ")

Example 39

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testDifferentQuotes(self):
        s = '<test a="a" b=\'b\' />'
        d = microdom.parseString(s)
        e = d.documentElement
        self.assertEqual(e.getAttribute('a'), 'a')
        self.assertEqual(e.getAttribute('b'), 'b')

Example 40

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLinebreaks(self):
        s = '<test \na="a"\n\tb="#b" />'
        d = microdom.parseString(s)
        e = d.documentElement
        self.assertEqual(e.getAttribute('a'), 'a')
        self.assertEqual(e.getAttribute('b'), '#b')

Example 41

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testComment(self):
        s = "<bar><!--<foo />--></bar>"
        d = microdom.parseString(s)
        e = d.documentElement
        self.assertEqual(e.nodeName, "bar")
        c = e.childNodes[0]
        self.assert_(isinstance(c, microdom.Comment))
        self.assertEqual(c.value, "<foo />")
        c2 = c.cloneNode()
        self.assert_(c is not c2)
        self.assertEqual(c2.toxml(), "<!--<foo />-->")

Example 42

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def test_replaceNonChild(self):
        """
        L{Node.replaceChild} raises L{ValueError} if the node given to be
        replaced is not a child of the node C{replaceChild} is called on.
        """
        parent = microdom.parseString('<foo />')
        orphan = microdom.parseString('<bar />')
        replacement = microdom.parseString('<baz />')

        self.assertRaises(
            ValueError, parent.replaceChild, replacement, orphan)

Example 43

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testDoctype(self):
        s = ('<?xml version="1.0"?>'
        '<!DOCTYPE foo PUBLIC "baz" "http://www.example.com/example.dtd">'
        '<foo></foo>')
        s2 = '<foo/>'
        d = microdom.parseString(s)
        d2 = microdom.parseString(s2)
        self.assertEqual(d.doctype,
                          'foo PUBLIC "baz" "http://www.example.com/example.dtd"')
        self.assertEqual(d.toxml(), s)
        self.failIf(d.isEqualToDocument(d2))
        self.failUnless(d.documentElement.isEqualToNode(d2.documentElement))

Example 44

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testOutput(self):
        for s, out in self.samples:
            d = microdom.parseString(s, caseInsensitive=0)
            d2 = microdom.parseString(out, caseInsensitive=0)
            testOut = d.documentElement.toxml()
            self.assertEqual(out, testOut)
            self.assert_(d.isEqualToDocument(d2))

Example 45

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testEatingWhitespace(self):
        s = """<hello>
        </hello>"""
        d = microdom.parseString(s)
        self.failUnless(not d.documentElement.hasChildNodes(),
                        d.documentElement.childNodes)
        self.failUnless(d.isEqualToDocument(microdom.parseString('<hello></hello>')))

Example 46

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLenientAmpersand(self):
        prefix = "<?xml version='1.0'?>"
        # we use <pre> so space will be preserved
        for i, o in [("&", "&amp;"),
                     ("& ", "&amp; "),
                     ("&amp;", "&amp;"),
                     ("&hello monkey", "&amp;hello monkey")]:
            d = microdom.parseString("%s<pre>%s</pre>"
                                     % (prefix, i), beExtremelyLenient=1)
            self.assertEqual(d.documentElement.toxml(), "<pre>%s</pre>" % o)
        # non-space preserving
        d = microdom.parseString("<t>hello & there</t>", beExtremelyLenient=1)
        self.assertEqual(d.documentElement.toxml(), "<t>hello &amp; there</t>")

Example 47

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testInsensitiveLenient(self):
        # testing issue #537
        d = microdom.parseString(
            "<?xml version='1.0'?><bar><xA><y>c</Xa> <foo></bar>",
            beExtremelyLenient=1)
        self.assertEqual(d.documentElement.firstChild().toxml(), "<xa><y>c</y></xa>")

Example 48

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLaterCloserSimple(self):
        s = "<ul><li>foo<li>bar<li>baz</ul>"
        d = microdom.parseString(s, beExtremelyLenient=1)
        expected = "<ul><li>foo</li><li>bar</li><li>baz</li></ul>"
        actual = d.documentElement.toxml()
        self.assertEqual(expected, actual)

Example 49

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLaterCloserCaseInsensitive(self):
        s = "<DL><p><DT>foo<DD>bar</DL>"
        d = microdom.parseString(s, beExtremelyLenient=1)
        expected = "<dl><p></p><dt>foo</dt><dd>bar</dd></dl>"
        actual = d.documentElement.toxml()
        self.assertEqual(expected, actual)

Example 50

Project: SubliminalCollaborator
Source File: test_xml.py
View license
    def testLaterCloserTable(self):
        s = ("<table>"
             "<tr><th>name<th>value<th>comment"
             "<tr><th>this<td>tag<td>soup"
             "<tr><th>must<td>be<td>handled"
             "</table>")
        expected = ("<table>"
                    "<tr><th>name</th><th>value</th><th>comment</th></tr>"
                    "<tr><th>this</th><td>tag</td><td>soup</td></tr>"
                    "<tr><th>must</th><td>be</td><td>handled</td></tr>"
                    "</table>")
        d = microdom.parseString(s, beExtremelyLenient=1)
        actual = d.documentElement.toxml()
        self.assertEqual(expected, actual)