- src: phase_z2 composition/mapper/pipeline/placement_planner/retry, ai_fallback(prompts/schema/validate), mdx_text_atoms 신규 - Front: PipelineTracePanel 신규, FramePanel/SlideCanvas/Home/designAgentApi 등 갱신 + 테스트 4종 추가 - templates/phase_z2: catalog(component_expansion_registry, node_slot_mapping 신규), frames, families, slide_base 갱신 - tests/matching: phase2~26 매칭 실험 스크립트·리포트·온톨로지 전체 (미커밋 진행분) - tests: b4_v4 evidence, task5~28.5 시리즈, regression(imp95 baseline) 등 신규 테스트 대량 추가 - docs/reference: MDX 구조 인벤토리, MDX→Frame 구조 계약 문서 - scripts: mdx 계약/parity/coverage/viewport 체크, gitea comment, run sync 유틸 - .gitignore: tmp*.json, chromedriver, .orchestrator, *.pkl, Front_test* 등 임시/스냅샷 제외 미완성 작업의 보존용 스냅샷 커밋 (2026-07-02) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
from pathlib import Path
|
|
|
|
from src.mdx_text_atoms import compare_atom_sets, extract_text_atoms, normalize_text_atom
|
|
|
|
|
|
def test_extract_atoms_ignores_syntax_and_keeps_semantic_text():
|
|
mdx = """---
|
|
title: demo
|
|
---
|
|
|
|
import Demo from './Demo.astro'
|
|
|
|
## 1. Title
|
|
|
|
- **Important** text
|
|
<details>
|
|
<summary style={{cursor: 'pointer'}}>More info</summary>
|
|
<div style={{ color: '#999' }}>
|
|
<p>Nested semantic text</p>
|
|
</div>
|
|
</details>
|
|
|
|
| A | B |
|
|
| :--- | :--- |
|
|
| one | two |
|
|
|
|

|
|
"""
|
|
atoms = extract_text_atoms(mdx, source_name="demo.mdx")
|
|
texts = [a.normalized for a in atoms]
|
|
|
|
assert "1. Title" in texts
|
|
assert "Important text" in texts
|
|
assert "More info" in texts
|
|
assert "Nested semantic text" in texts
|
|
assert "A" in texts
|
|
assert "B" in texts
|
|
assert "one" in texts
|
|
assert "two" in texts
|
|
assert "Diagram caption" in texts
|
|
assert not any("cursor" in t for t in texts)
|
|
|
|
|
|
def test_compare_atom_sets_reports_missing_and_added():
|
|
original = extract_text_atoms("- Original text\n- Shared text\n", source_name="original")
|
|
standardized = extract_text_atoms("- Shared text\n- Added text\n", source_name="standardized")
|
|
|
|
result = compare_atom_sets(original, standardized)
|
|
|
|
assert [a.normalized for a in result["missing_from_standardized"]] == ["Original text"]
|
|
assert [a.normalized for a in result["added_in_standardized"]] == ["Added text"]
|
|
|
|
|
|
def test_normalize_text_atom_removes_markdown_markers_only():
|
|
assert normalize_text_atom("**Digital** `Transformation`") == "Digital Transformation"
|
|
|