From cd12abf3c50df4ac62d27d67edfce602c5c26693 Mon Sep 17 00:00:00 2001 From: Isla-Liu Date: Wed, 8 Jul 2026 11:54:50 +0800 Subject: [PATCH] test: harden wakeup label locale coverage --- tests/test_process_wakeup_rendering.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/test_process_wakeup_rendering.py b/tests/test_process_wakeup_rendering.py index cee5b91b..25a42f3f 100644 --- a/tests/test_process_wakeup_rendering.py +++ b/tests/test_process_wakeup_rendering.py @@ -218,8 +218,14 @@ def test_process_wakeup_label_key_exists_in_all_locales(): r"^\s{2}(?:'(?P[A-Za-z0-9-]+)'|(?P[A-Za-z0-9-]+))\s*:\s*\{", re.MULTILINE, ) - locales = [m.group("quoted") or m.group("plain") for m in locale_pattern.finditer(I18N_JS)] - assert locales, "expected at least the English locale" - key_defs = re.findall(r"\bprocess_wakeup_label\s*:", I18N_JS) - assert len(key_defs) >= len(locales), "process_wakeup_label must be defined in every locale" + locale_matches = list(locale_pattern.finditer(I18N_JS)) + assert locale_matches, "expected at least the English locale" + for idx, match in enumerate(locale_matches): + name = match.group("quoted") or match.group("plain") + start = match.end() + end = locale_matches[idx + 1].start() if idx + 1 < len(locale_matches) else I18N_JS.find("\n};", start) + block = I18N_JS[start:end] + assert re.search(r"\bprocess_wakeup_label\s*:", block), ( + f"process_wakeup_label missing from locale {name}" + ) assert "process_wakeup_label:'Background wakeup'" in I18N_JS