From 31dbc2493fc5fe4d98c460cdc79d28fd415aa5a2 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 29 Aug 2026 20:29:51 -0700 Subject: [PATCH] test: cover InlineQueryHandler in lazy-install rebind and handler-count contracts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The lazy-install placeholder test failing mid-run also left the adapter module's ParseMode as None, cascading into test_telegram_thread_fallback failures in the same CI process — all downstream of the same root. --- tests/gateway/test_gateway_platform_event_hook.py | 13 +++++++------ .../test_telegram_lazy_install_typehandler.py | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/gateway/test_gateway_platform_event_hook.py b/tests/gateway/test_gateway_platform_event_hook.py index e65dc1418f..cb712bfda2 100644 --- a/tests/gateway/test_gateway_platform_event_hook.py +++ b/tests/gateway/test_gateway_platform_event_hook.py @@ -672,13 +672,14 @@ class TestRegisterHandlers: app = MagicMock() a._register_handlers(app) - # Five core handlers (default group, no group kwarg) plus the - # gateway_platform_event observer alone in group 99, so it observes - # alongside rather than displacing the core handlers. + # Six core handlers (default group, no group kwarg — incl. the + # inline command picker) plus the gateway_platform_event observer + # alone in group 99, so it observes alongside rather than + # displacing the core handlers. calls = app.add_handler.call_args_list - assert len(calls) == 6 + assert len(calls) == 7 assert len([c for c in calls if c.kwargs.get("group") == 99]) == 1 - assert len([c for c in calls if not c.kwargs]) == 5 + assert len([c for c in calls if not c.kwargs]) == 6 def test_rebuild_re_registers_observer(self): """A second call on a fresh app (e.g. a future rebuild) re-registers @@ -690,7 +691,7 @@ class TestRegisterHandlers: a._register_handlers(first_app) a._register_handlers(rebuilt_app) # the rebuild path - assert rebuilt_app.add_handler.call_count == 6 + assert rebuilt_app.add_handler.call_count == 7 assert len(self._observer_calls(rebuilt_app)) == 1 def test_transient_init_rebuild_uses_shared_registration(self, monkeypatch): diff --git a/tests/gateway/test_telegram_lazy_install_typehandler.py b/tests/gateway/test_telegram_lazy_install_typehandler.py index f26c493c8e..39cd251a84 100644 --- a/tests/gateway/test_telegram_lazy_install_typehandler.py +++ b/tests/gateway/test_telegram_lazy_install_typehandler.py @@ -47,6 +47,7 @@ def fake_telegram_sdk(monkeypatch): "Application", "CommandHandler", "CallbackQueryHandler", + "InlineQueryHandler", "MessageHandler", "TypeHandler", "HTTPXRequest", @@ -69,6 +70,7 @@ def fake_telegram_sdk(monkeypatch): "Application", "CommandHandler", "CallbackQueryHandler", + "InlineQueryHandler", "MessageHandler", "TypeHandler", ): @@ -119,6 +121,7 @@ def test_lazy_install_rebinds_every_placeholder(monkeypatch, fake_telegram_sdk): "Application", "CommandHandler", "CallbackQueryHandler", + "InlineQueryHandler", "TelegramMessageHandler", "TypeHandler", "ContextTypes",