Dateien nach "tests" hochladen
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
This commit is contained in:
parent
3a88caac69
commit
c0b96f7c05
35
tests/test_type_registry.py
Normal file
35
tests/test_type_registry.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, tempfile, textwrap
|
||||
from app.core.type_registry import load_type_registry, resolve_note_type, get_type_config, effective_chunk_profile, profile_overlap
|
||||
|
||||
def test_defaults_when_missing():
|
||||
# ensure default kicks in if file does not exist
|
||||
reg = load_type_registry(os.path.join("config", "does_not_exist.yaml"))
|
||||
assert reg.get("_using_defaults", False) is True
|
||||
t = resolve_note_type(None, reg)
|
||||
assert t == "concept"
|
||||
cfg = get_type_config(t, reg)
|
||||
assert cfg.get("chunk_profile") in ("medium", "long", "short")
|
||||
|
||||
def test_custom_file():
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
p = os.path.join(td, "types.yaml")
|
||||
with open(p, "w", encoding="utf-8") as f:
|
||||
f.write(textwrap.dedent('''
|
||||
version: 1.0
|
||||
types:
|
||||
concept:
|
||||
chunk_profile: medium
|
||||
edge_defaults: ["references"]
|
||||
retriever_weight: 1.0
|
||||
task:
|
||||
chunk_profile: short
|
||||
edge_defaults: ["depends_on"]
|
||||
retriever_weight: 0.8
|
||||
'''))
|
||||
reg = load_type_registry(p)
|
||||
assert resolve_note_type("task", reg) == "task"
|
||||
assert effective_chunk_profile("task", reg) == "short"
|
||||
assert profile_overlap("short")[0] < profile_overlap("long")[0]
|
||||
Loading…
Reference in New Issue
Block a user