コード例 #1
0
ファイル: test_formatting.py プロジェクト: zfl926/xmldiff
    def test_rename_node(self):
        left = u'<document><node><para>Content</para>Tail</node></document>'
        action = actions.RenameNode('/document/node[1]/para[1]', 'newtag')
        expected = START + u'><newtag diff:rename="para">Content'\
            '</newtag>Tail' + END

        self._format_test(left, action, expected)
コード例 #2
0
ファイル: test_formatting.py プロジェクト: toyg/xmldiff
    def test_rename_node(self):
        # Move 1 down
        action = actions.RenameNode("/document/node[1]", "newtag")
        expected = "[rename, /document/node[1], newtag]"
        self._format_test(action, expected)

        # Move 2 up (same result, different diff)
        action = actions.MoveNode("/document/node[2]", "/document", 0)
        expected = "[move-first, /document/node[2], /document]"
        self._format_test(action, expected)
コード例 #3
0
ファイル: test_formatting.py プロジェクト: zfl926/xmldiff
    def test_rename_node(self):
        # Move 1 down
        action = actions.RenameNode('/document/node[1]', 'newtag')
        expected = '[rename, /document/node[1], newtag]'
        self._format_test(action, expected)

        # Move 2 up (same result, different diff)
        action = actions.MoveNode('/document/node[2]', '/document', 0)
        expected = '[move-first, /document/node[2], /document]'
        self._format_test(action, expected)
コード例 #4
0
 def update_node_tag(self, left, right):
     if left.tag != right.tag:
         left_xpath = utils.getpath(left)
         yield actions.RenameNode(left_xpath, right.tag)
         left.tag = right.tag
コード例 #5
0
ファイル: test_formatting.py プロジェクト: toyg/xmldiff
    def test_rename_node(self):
        left = "<document><node><para>Content</para>Tail</node></document>"
        action = actions.RenameNode("/document/node[1]/para[1]", "newtag")
        expected = START + '><newtag diff:rename="para">Content' "</newtag>Tail" + END

        self._format_test(left, action, expected)
コード例 #6
0
ファイル: patch.py プロジェクト: toyg/xmldiff
 def _handle_rename(self, node, tag):
     return actions.RenameNode(node, tag)