def test_colordiff(): x, y = colordiff("hi bob", "hi there", color_x=Colors.Red, color_y=Colors.Blue) fx = lambda s: red(s, reverse=True) fy = lambda s: blue(s, reverse=True) assert x == "hi " + fx("b") + fx("o") + fx("b") assert y == "hi " + fy("t") + fy("h") + fy("e") + fy("r") + fy("e")
from ansicolor import Colors from ansicolor import colordiff statement = "All towles must be folded an stowed away neatly inthe closet." reviewed = "All towels must be folded and stowed neatly in the closet!" first, second = colordiff(statement, reviewed, color_x=Colors.Cyan, color_y=Colors.Green) print(first) print(second)