From 71aaad6e7fa30d776d100bbb9151e7e085ec4379 Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Sun, 10 May 2026 17:13:52 +0000 Subject: [PATCH] fix(stage-330): broaden chinese-locale test to accept both \uXXXX and literal CJK forms (PR #2002 source-form refresh) --- tests/test_chinese_locale.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tests/test_chinese_locale.py b/tests/test_chinese_locale.py index cac42178..ac06bd04 100644 --- a/tests/test_chinese_locale.py +++ b/tests/test_chinese_locale.py @@ -79,18 +79,23 @@ def test_chinese_locale_block_exists(): def test_chinese_locale_includes_representative_translations(): src = read(REPO / "static" / "i18n.js") - expected = [ - "settings_title: '\\u8bbe\\u7f6e'", - "login_title: '\\u767b\\u5f55'", - "approval_heading: '需要审批'", - "tab_tasks: '任务'", - "tab_profiles: '配置'", - "session_time_bucket_today: '今天'", - "onboarding_title: '欢迎使用 Hermes Web UI'", - "onboarding_complete: '引导完成'", + # Each tuple is a list of acceptable source forms for the same translation — + # either escape-encoded `\uXXXX` form or literal CJK characters. They produce + # the same runtime string; do not pin source encoding. + expected_alternatives = [ + [r"settings_title: '\u8bbe\u7f6e'", "settings_title: '设置'"], + [r"login_title: '\u767b\u5f55'", "login_title: '登录'"], + ["approval_heading: '需要审批'"], + ["tab_tasks: '任务'"], + ["tab_profiles: '配置'"], + ["session_time_bucket_today: '今天'"], + ["onboarding_title: '欢迎使用 Hermes Web UI'"], + ["onboarding_complete: '引导完成'"], ] - for entry in expected: - assert entry in src + for alts in expected_alternatives: + assert any(alt in src for alt in alts), ( + f"None of the expected forms found in i18n.js: {alts!r}" + ) def test_chinese_locale_covers_english_keys():