Skip to content

Commit 8549789

Browse files
committed
step7
1 parent 88c0ef8 commit 8549789

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

gendiff/tests/diff_generator_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
from gendiff.diff_generator import generate_diff
3-
3+
import re
44

55
@pytest.mark.parametrize(
66
"file1, file2, expected_file",
@@ -17,8 +17,12 @@ def test_generate_diff(file1, file2, expected_file):
1717
with open(expected_file, "r") as f:
1818
expected_result = f.read().strip()
1919

20-
# Убираем `None` из вывода
21-
actual_result = actual_result.replace("None", "").strip()
20+
# Нормализация пробелов перед сравнением
21+
def normalize_whitespace(text):
22+
return re.sub(r'\s+', ' ', text).strip()
23+
24+
actual_result = normalize_whitespace(actual_result)
25+
expected_result = normalize_whitespace(expected_result)
2226

2327
assert actual_result == expected_result, (
2428
f"\nExpected:\n{expected_result}\n\nGot:\n{actual_result}"

0 commit comments

Comments
 (0)