Skip to content

Commit 47e766b

Browse files
committed
Update finish website tests for new format
1 parent 7e8380e commit 47e766b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/workflow_utils/test_finish_website.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ def test_construct_index(monkeypatch, tmp_path):
7171
finish_website.construct_index()
7272

7373
# Check index.
74-
index_file = plots_dir / "index.json"
74+
index_file = plots_dir / "index.jsonl"
7575
assert index_file.is_file()
7676
with open(index_file, "rt", encoding="UTF-8") as fp:
77-
index = json.load(fp)
78-
expected = {"Category": {"20250101": {"p1": "P1", "p2": "P2"}}}
77+
index = fp.read()
78+
expected = (
79+
'{"case_date":"20250101","category":"Category","path":"p1","title":"P1"}\n'
80+
'{"case_date":"20250101","category":"Category","path":"p2","title":"P2"}\n'
81+
)
7982
assert index == expected
8083

8184

@@ -94,11 +97,11 @@ def test_construct_index_aggregation_case(monkeypatch, tmp_path):
9497
finish_website.construct_index()
9598

9699
# Check index.
97-
index_file = plots_dir / "index.json"
100+
index_file = plots_dir / "index.jsonl"
98101
assert index_file.is_file()
99102
with open(index_file, "rt", encoding="UTF-8") as fp:
100103
index = json.load(fp)
101-
expected = {"Category": {"Aggregation": {"p1": "P1"}}}
104+
expected = {"category": "Category", "path": "p1", "title": "P1"}
102105
assert index == expected
103106

104107

@@ -121,12 +124,9 @@ def test_construct_index_invalid(monkeypatch, tmp_path, caplog):
121124
assert level == logging.ERROR
122125
assert "p1/meta.json is invalid, skipping." in message
123126

124-
index_file = plots_dir / "index.json"
127+
index_file = plots_dir / "index.jsonl"
125128
assert index_file.is_file()
126-
with open(index_file, "rt", encoding="UTF-8") as fp:
127-
index = json.load(fp)
128-
expected = {}
129-
assert index == expected
129+
assert index_file.stat().st_size == 0
130130

131131

132132
def test_entrypoint(monkeypatch):

0 commit comments

Comments
 (0)