fix: fail-loud on node without time info; anchor test store path

This commit is contained in:
2026-07-15 22:16:39 -04:00
parent 05294412df
commit d6c595c4a4
2 changed files with 17 additions and 3 deletions
+11 -1
View File
@@ -7,7 +7,7 @@ import pytest
from app.harness.tree_nodes import load_tree_data_for_videos, load_tree_nodes
_STORE = Path("store")
_STORE = Path(__file__).resolve().parents[2] / "store"
_VID = "0RxMZBLeqRI" # 真实样本,111 节点
@@ -68,6 +68,16 @@ def test_roots_not_list_raises_value_error(tmp_path):
load_tree_nodes(tmp_path, "vX")
def test_node_without_time_info_raises_value_error(tmp_path):
vdir = tmp_path / "videos" / "vX"
vdir.mkdir(parents=True)
(vdir / "tree.json").write_text(
json.dumps({"roots": [{"id": "n1", "card": {}}]}), encoding="utf-8"
)
with pytest.raises(ValueError):
load_tree_nodes(tmp_path, "vX")
def test_load_for_videos_dedups():
data = load_tree_data_for_videos(_STORE, [_VID, _VID])
assert set(data.keys()) == {_VID}