bc1d56d1a4
P0.6: gcov infrastructure P1: extract_structure output expansion (11 new feature fields) P2: Confusion group rule engine (8 pairs + contradiction + backtrack) P3: 4-factor confidence calculation + quality gate update P4: 33+2 COBOL program type test samples (22 files, 7 categories) P5: parametrized/ test data generation engine P6: japanese_data.py lookup tables P7-10: Type-specific test suites (~159 parametrized tests) P11: Full classification pipeline (classify_program) + orchestrator integration P12: Documentation (module-interfaces, test-plan v3.0, coverage-matrix) Architecture decisions: - classification_pipeline/ merged to hina/pipeline/ - parametrized/ as independent module - japanese_data.py as root-level file - hina/__all__ only exports classify_program() Co-Authored-By: Claude <noreply@anthropic.com>
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""CF-01~07: Config + MappingConfig"""
|
|
|
|
import sys, os, tempfile, json
|
|
from pathlib import Path
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
|
|
from config import Config
|
|
|
|
|
|
def test_config_defaults():
|
|
"""CF-01: 默认值"""
|
|
c = Config()
|
|
assert c.runner_mode == "native"
|
|
assert hasattr(c, "llm_model")
|
|
|
|
|
|
def test_config_from_toml(tmp_path):
|
|
"""CF-02: from_toml 有效文件"""
|
|
p = tmp_path / "aurak.toml"
|
|
p.write_text('[runner]\nmode = "spark"\n[llm]\nmodel = "gpt-4"\n')
|
|
c = Config.from_toml(str(p))
|
|
assert c.runner_mode == "spark"
|
|
assert c.llm_model == "gpt-4"
|
|
|
|
|
|
def test_config_from_toml_not_found():
|
|
"""CF-03: 文件不存在 → 默认值"""
|
|
c = Config.from_toml("/nonexistent/aurak.toml")
|
|
assert c.runner_mode == "native"
|
|
|
|
|
|
def test_config_from_toml_invalid():
|
|
"""CF-04: 非法 TOML → 返回默认"""
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
p = Path(tmp) / "bad.toml"
|
|
p.write_text("= invalid toml [[[")
|
|
c = Config.from_toml(str(p))
|
|
assert c is not None
|