"""Read one mechanically relocated section for existing boundary assertions.""" from pathlib import Path import re def section(name): source = (Path(__file__).resolve().parents[1] / "plugins/ita_plugin.py").read_text() sections = re.split(r"\n# ={76}\n# (\w+) \(from plugins/ita_\w+\.py\)\n# ={76}\n", source) matches = [sections[i + 1] for i in range(1, len(sections), 2) if sections[i] == name.upper()] if len(matches) != 1: raise AssertionError(f"Missing/duplicate Italy section: {name}") return matches[0]