File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 11from gendiff .read import read_file
22
3+
34def generate_diff (file_path1 , file_path2 ):
45 data1 = read_file (file_path1 )
56 data2 = read_file (file_path2 )
Original file line number Diff line number Diff line change @@ -18,4 +18,3 @@ def args_parser():
1818 args = parser .parse_args ()
1919 diff = generate_diff (args .first_file , args .second_file )
2020 print (diff )
21-
Original file line number Diff line number Diff line change 11from gendiff .diff_generator import generate_diff
22
3+
34def normalize_indentation (text ):
45 return "\n " .join (line .strip () for line in text .strip ().splitlines ())
56
7+
68def test_generate_diff ():
79 file1 = "gendiff/tests/file1.json"
810 file2 = "gendiff/tests/file2.json"
9-
11+
1012 expected_result = """{
1113 - follow: False
1214 host: hexlet.io
@@ -15,10 +17,10 @@ def test_generate_diff():
1517 + timeout: 20
1618 + verbose: True
1719 }"""
18-
20+
1921 actual_result = generate_diff (file1 , file2 )
20-
22+
2123 normalized_expected = normalize_indentation (expected_result )
2224 normalized_actual = normalize_indentation (actual_result )
23-
25+
2426 assert normalized_actual == normalized_expected
You can’t perform that action at this time.
0 commit comments