示例#1
0
    def test_findNodeJustBefore(self):
        """
        L{tree.findNodeJustBefore} returns the previous sibling of the node it
        is passed.  The list of nodes passed in is ignored.
        """
        parent = dom.Element("div")
        result = dom.Element("foo")
        target = dom.Element("bar")
        parent.appendChild(result)
        parent.appendChild(target)

        self.assertIdentical(tree.findNodeJustBefore(target, [parent, result]), result)

        # Also, support other configurations.  This is a really not nice API.
        newTarget = dom.Element("baz")
        target.appendChild(newTarget)
        self.assertIdentical(tree.findNodeJustBefore(newTarget, [parent, result]), result)
示例#2
0
    def test_findNodeJustBefore(self):
        """
        L{tree.findNodeJustBefore} returns the previous sibling of the node it
        is passed.  The list of nodes passed in is ignored.
        """
        parent = dom.Element('div')
        result = dom.Element('foo')
        target = dom.Element('bar')
        parent.appendChild(result)
        parent.appendChild(target)

        self.assertIdentical(tree.findNodeJustBefore(target, [parent, result]),
                             result)

        # Also, support other configurations.  This is a really not nice API.
        newTarget = dom.Element('baz')
        target.appendChild(newTarget)
        self.assertIdentical(
            tree.findNodeJustBefore(newTarget, [parent, result]), result)