Esempio n. 1
0
def test_Differ():
    text1 = """  1. Beautiful is better than ugly.
2. Explicit is better than implicit.
3. Simple is better than complex.
4. Complex is better than complicated.
""".splitlines(
        1
    )
    print text1
    # print text1[0][-1]
    text2 = """  1. Beautiful is better than ugly.
3.   Simple is better than complex.
4. Complicated is better than complex.
5. Flat is better than nested.
""".splitlines(
        1
    )
    print text2
    # print text2[0][-1]
    d = Differ()
    result = list(d.compare(text1, text2))
    _pprint(result)
Esempio n. 2
0
def test_qformat():
    d = Differ()
    results = d._qformat("\tabcDefghiJkl\n", "\tabcdefGhijkl\n", "  ^ ^  ^      ", "  ^ ^  ^      ")
    for line in results:
        print repr(line)
Esempio n. 3
0
def test_fancy_replace():
    d = Differ()
    results = d._fancy_replace(["abcDefghiJkl\n"], 0, 1, ["abcdefGhijkl\n"], 0, 1)
    print "".join(results),