ingredients-spellcheck-annotate / tests /test_compute_diff.py
jeremyarancio's picture
fix: :zap: Handle Server timeout errors + Add whitespace additions and deletions in text diff
161967b
raw
history blame contribute delete
925 Bytes
import pytest
from utils import compute_diff
@pytest.mark.parametrize(
"text1, text2, expected",
[
(
"helo",
"hello",
[
("h", None),
("e", None),
("l", None),
("l", "+"),
("o", None),
]
),
(
"helo\nworld",
"hello world",
[
("h", None),
("e", None),
("l", None),
("l", "+"),
("o", None),
("\n", "-"),
("^", "+"),
("w", None),
("o", None),
("r", None),
("l", None),
("d", None),
]
),
]
)
def test_compute_diff(text1, text2, expected):
pairs = compute_diff(text1, text2)
assert list(pairs) == expected