From e0c27174b344aed3df58ab94deb128b65c0392bc Mon Sep 17 00:00:00 2001 From: ai-ag2026 <261867348+ai-ag2026@users.noreply.github.com> Date: Thu, 28 May 2026 20:30:33 +0200 Subject: [PATCH] test: cover code-only title language fallback --- tests/test_title_aux_routing.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_title_aux_routing.py b/tests/test_title_aux_routing.py index d1007924..816314f5 100644 --- a/tests/test_title_aux_routing.py +++ b/tests/test_title_aux_routing.py @@ -305,6 +305,16 @@ class TestGenerateTitleRawViaAuxTimeout(unittest.TestCase): self.assertNotEqual(title, 'Session Bilder') self.assertIn('Warum', title) + def test_code_only_first_message_does_not_trigger_german_language_guard(self): + """Code-only starts should fall through to the neutral/default title path.""" + from api.streaming import _detect_title_language, _title_language_mismatch, _title_prompt_language_rule + + code_only = "print('hello')\nfor i in range(3):\n print(i)" + + self.assertEqual(_detect_title_language(code_only), '') + self.assertEqual(_title_prompt_language_rule(code_only), 'Match the language of the user question.\n') + self.assertFalse(_title_language_mismatch(code_only, 'Python Hello Loop')) + def test_configured_api_key_is_not_sent_to_caller_supplied_route(self): """Regression: title task keys must not leak to explicit fallback routes.