diff options
author | Martin Matusiak <numerodix@gmail.com> | 2021-05-05 11:48:36 +1000 |
---|---|---|
committer | Martin Matusiak <numerodix@gmail.com> | 2021-05-05 11:48:36 +1000 |
commit | 273f85b8e2080807ef59a4a48fdcd3b1119a6ba2 (patch) | |
tree | 8d0970252ae154e16e73cf0d93edc28140425249 | |
parent | f7d132ccca0efb3423a0afff284b968317364b93 (diff) | |
download | ansicolor-273f85b8e2080807ef59a4a48fdcd3b1119a6ba2.tar.gz |
add test for colordiff
-rw-r--r-- | tests/test_colors.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_colors.py b/tests/test_colors.py index 242638c..acc7375 100644 --- a/tests/test_colors.py +++ b/tests/test_colors.py @@ -164,7 +164,7 @@ def test_strip_escapes(): ) == "Hi there, stranger" -def test_colordiff(): +def test_colordiff_different(): x, y = colordiff("hi bob", "hi there", color_x=Colors.Red, color_y=Colors.Blue) @@ -174,6 +174,16 @@ def test_colordiff(): assert x == "hi " + fx("b") + fx("o") + fx("b") assert y == "hi " + fy("t") + fy("h") + fy("e") + fy("r") + fy("e") +def test_colordiff_edited(): + x, y = colordiff("hi bobby", "hi bob", + 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 bob" + fx("b") + fx("y") + assert y == "hi bob" + def test_justify_formatted(): def rjust(s, width): |