Skip to content

Commit 972e475

Browse files
committed
fix test_data.py
1 parent bc02196 commit 972e475

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/test_data.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1+
import json
12
from pathlib import Path
23

34
from gendiff.data import read_data
45

56

67
def get_test_data_path(filename):
7-
return Path(__file__).parent / "tests" / filename
8+
return Path(__file__).parent / filename
89

910

1011
def read_file(filename):
11-
return get_test_data_path(filename).read_text()
12+
with open(get_test_data_path(filename), "r") as file:
13+
text = json.load(file)
14+
return text
1215

1316

1417
def test_read_data():
1518
file1 = get_test_data_path("file_1.json")
1619
file2 = get_test_data_path("file_2.json")
17-
expec1 = read_file("r_data1.txt")
18-
expec2 = read_file("r_data2.txt")
20+
expec1 = read_file("file_1.json")
21+
expec2 = read_file("file_2.json")
1922

2023
assert read_data(file1) == expec1
2124
assert read_data(file2) == expec2

0 commit comments

Comments
 (0)