def test_generate_dmp_diff_efficiency(): """ Test diffs created by google "diff-match-patch" with "efficiency" cleanup """ html = generate_dmp_diff( value1='one', value2='two', cleanup=EFFICIENCY ) assert html == '<pre class="highlight"><ins>tw</ins>o<del>ne</del></pre>' html = generate_dmp_diff( value1='aaa\nccc\nddd\n', value2='aaa\nbbb\nccc\n', cleanup=EFFICIENCY ) assert html == ( '<pre class="highlight">' 'aaa\n' '<ins>bbb\n' '</ins>ccc\n' '<del>ddd\n' '</del>' '</pre>' )
def test_generate_dmp_diff_semantic(): """ Test diffs created by google "diff-match-patch" with "semantic" cleanup """ html = generate_dmp_diff(value1='xxx1xxx\nX', value2='xxx2xxx\nX', cleanup=SEMANTIC) assert html == ( '<pre class="highlight">' '<span class="diff-line diff-del diff-ins">xxx<del>1</del><ins>2</ins>xxx</span>\n' 'X\n' '</pre>') html = generate_dmp_diff(value1='one', value2='two', cleanup=SEMANTIC) assert html == ( '<pre class="highlight">' '<span class="diff-line diff-del diff-ins"><del>one</del><ins>two</ins></span>\n' '</pre>') html = generate_dmp_diff(value1='aaa\nccc\nddd\n', value2='aaa\nbbb\nccc\n', cleanup=SEMANTIC) assert html == ( '<pre class="highlight">aaa\n' '<span class="diff-line diff-del"><del>ccc</del></span>\n' '<span class="diff-line diff-del diff-ins"><del>ddd</del><ins>bbb</ins></span>\n' '<span class="diff-line diff-ins"><ins>ccc</ins></span>\n' '</pre>')
def test_generate_dmp_diff_no_cleanup(): """ Test diffs created by google "diff-match-patch" without cleanup """ html = generate_dmp_diff(value1='one', value2='two', cleanup=None) assert html == ( '<pre class="highlight">' '<span class="diff-line diff-del diff-ins"><ins>tw</ins>o<del>ne</del></span>\n' '</pre>') html = generate_dmp_diff(value1='aaa\nccc\nddd\n', value2='aaa\nbbb\nccc\n', cleanup=None) assert html == ('<pre class="highlight">aaa\n' '<span class="diff-line diff-ins"><ins>bbb</ins></span>\n' 'ccc\n' '<span class="diff-line diff-del"><del>ddd</del></span>\n' '</pre>')
def test_generate_dmp_diff(): html = generate_dmp_diff( value1='one', value2='two', ) assert html == '<pre class="highlight"><del>one</del><ins>two</ins></pre>' html = generate_dmp_diff( value1='aaa\nccc\nddd\n', value2='aaa\nbbb\nccc\n', ) assert html == ( '<pre class="highlight">aaa\n' '<del>ccc\n' 'ddd</del><ins>bbb\n' 'ccc</ins>\n' '</pre>' )
def test_generate_dmp_diff(): html = generate_dmp_diff( value1='one', value2='two', ) assert html == ( '<pre class="highlight">' '<span class="diff-line diff-del diff-ins"><del>one</del><ins>two</ins></span>\n' '</pre>') html = generate_dmp_diff( value1='aaa\nccc\nddd\n', value2='aaa\nbbb\nccc\n', ) assert html == ( '<pre class="highlight">aaa\n' '<span class="diff-line diff-del"><del>ccc</del></span>\n' '<span class="diff-line diff-del diff-ins"><del>ddd</del><ins>bbb</ins></span>\n' '<span class="diff-line diff-ins"><ins>ccc</ins></span>\n' '</pre>')