Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
tenzin3 committed Oct 21, 2024
1 parent ad951a2 commit ddd271b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/prepare/test_prepare.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import tempfile
from pathlib import Path

from bo_rag_prep_tool.prepare import prepare
Expand All @@ -8,12 +9,14 @@ def test_prepare():
data = Path(__file__).parent / "data"
opf_path = data / "I46409446.opf"

output_path = Path(__file__).parent / "output"
json_output_path = prepare(opf_path, output_path)
with tempfile.TemporaryDirectory() as tmpdirname:
output_path = Path(tmpdirname)

expected_output = read_json(data / "expected_output.json")
json_output_path = prepare(opf_path, output_path)

json_output = read_json(json_output_path)
assert len(json_output) == len(expected_output)
for json_data in json_output:
assert json_data in expected_output
expected_output = read_json(data / "expected_output.json")

json_output = read_json(json_output_path)
assert len(json_output) == len(expected_output)
for json_data in json_output:
assert json_data in expected_output

0 comments on commit ddd271b

Please sign in to comment.