File tree Expand file tree Collapse file tree 2 files changed +35
-30
lines changed Expand file tree Collapse file tree 2 files changed +35
-30
lines changed Original file line number Diff line number Diff line change 11import os
22
33from gendiff .gendiff import generate_diff
4- from gendiff .io_utils import read_file
54
65current_dir = os .path .dirname (os .path .abspath (__file__ ))
76dir_with_data = os .path .join (current_dir , 'test_data' )
87
9- right_data1 = {
10- "host" : "hexlet.io" ,
11- "timeout" : 50 ,
12- "proxy" : "123.234.53.22" ,
13- "follow" : False
14- }
15-
16- right_data2 = {
17- "timeout" : 20 ,
18- "verbose" : True ,
19- "host" : "hexlet.io"
20- }
21-
22-
23- def test_read_file ():
24- file1_json_path = os .path .join (dir_with_data , 'file1.json' )
25- file2_json_path = os .path .join (dir_with_data , 'file2.json' )
26- file1_yaml_path = os .path .join (dir_with_data , 'file1.yaml' )
27- file2_yaml_path = os .path .join (dir_with_data , 'file2.yaml' )
28-
29- assert read_file (file1_json_path ) == right_data1
30- assert read_file (file1_json_path ) != right_data2
31- assert read_file (file2_json_path ) == right_data2
32- assert read_file (file2_json_path ) != right_data1
33- assert read_file (file1_yaml_path ) == right_data1
34- assert read_file (file1_yaml_path ) != right_data2
35- assert read_file (file2_yaml_path ) == right_data2
36- assert read_file (file2_yaml_path ) != right_data1
37-
388
399def open_file (file_name : str ) -> dict :
4010 test_file_path = os .path .join (dir_with_data , file_name )
Original file line number Diff line number Diff line change 1+ import os
2+
3+ from gendiff .io_utils import read_file
4+
5+ current_dir = os .path .dirname (os .path .abspath (__file__ ))
6+ dir_with_data = os .path .join (current_dir , 'test_data' )
7+
8+ right_data1 = {
9+ "host" : "hexlet.io" ,
10+ "timeout" : 50 ,
11+ "proxy" : "123.234.53.22" ,
12+ "follow" : False
13+ }
14+
15+ right_data2 = {
16+ "timeout" : 20 ,
17+ "verbose" : True ,
18+ "host" : "hexlet.io"
19+ }
20+
21+
22+ def test_read_file ():
23+ file1_json_path = os .path .join (dir_with_data , 'file1.json' )
24+ file2_json_path = os .path .join (dir_with_data , 'file2.json' )
25+ file1_yaml_path = os .path .join (dir_with_data , 'file1.yaml' )
26+ file2_yaml_path = os .path .join (dir_with_data , 'file2.yaml' )
27+
28+ assert read_file (file1_json_path ) == right_data1
29+ assert read_file (file1_json_path ) != right_data2
30+ assert read_file (file2_json_path ) == right_data2
31+ assert read_file (file2_json_path ) != right_data1
32+ assert read_file (file1_yaml_path ) == right_data1
33+ assert read_file (file1_yaml_path ) != right_data2
34+ assert read_file (file2_yaml_path ) == right_data2
35+ assert read_file (file2_yaml_path ) != right_data1
You can’t perform that action at this time.
0 commit comments