import importlib.util import os _SPEC = importlib.util.spec_from_file_location( "friction_scan", os.path.join(os.path.dirname(__file__), "..", "scripts", "friction-scan.py"), ) fs = importlib.util.module_from_spec(_SPEC) _SPEC.loader.exec_module(fs) SAMPLE = """# FRICTION.md ## Open signals _(append new raw signals here)_ - `[gotcha]` **First thing** (2026-06-01): body line one. continuation line two. - `[friction]` **Second thing** (2026-06-10): only one line. --- ## Kaizen reviews — decisions ledger - `[gotcha]` **Should not be parsed** (2026-01-01): in the ledger. """ def test_extract_open_section_stops_at_next_heading(): section = fs.extract_open_section(SAMPLE) assert "First thing" in section assert "Second thing" in section assert "Should not be parsed" not in section def test_split_signals_finds_two_items_and_joins_continuations(): signals = fs.split_signals(fs.extract_open_section(SAMPLE)) assert len(signals) == 2 assert "continuation line two" in signals[0] assert signals[1].startswith("`[friction]`")