"""Static-analysis tests for the conversation outline panel (issue #2124).""" from pathlib import Path import re ROOT = Path(__file__).parent.parent STATIC = ROOT / "static" INDEX_HTML = (STATIC / "index.html").read_text(encoding="utf-8") I18N_JS = (STATIC / "i18n.js").read_text(encoding="utf-8") OUTLINE_JS = (STATIC / "outline.js").read_text(encoding="utf-8") STYLE_CSS = (STATIC / "style.css").read_text(encoding="utf-8") BOOT_JS = (STATIC / "boot.js").read_text(encoding="utf-8") PANELS_JS = (STATIC / "panels.js").read_text(encoding="utf-8") CONFIG_PY = (ROOT / "api" / "config.py").read_text(encoding="utf-8") # Number of locale blocks in i18n.js: en, it, ja, ru, es, de, zh, zh-Hant, pt, ko, fr, tr LOCALE_COUNT = 12 def _css_rule_body(selector): rule = re.search(re.escape(selector) + r"\{(?P
[^}]*)\}", STYLE_CSS, re.S) assert rule return rule.group("body") def _css_px(rule_body, property_name): match = re.search(rf"{re.escape(property_name)}:(?P