Skip to content

The agent that grows with you

test: cover InlineQueryHandler in lazy-install rebind and handler-count contracts

Teknium31dbc2493fc5
diff --git a/tests/gateway/test_gateway_platform_event_hook.py b/tests/gateway/test_gateway_platform_event_hook.py
index e65dc1418f5..cb712bfda26 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 f26c493c8ee..39cd251a84f 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",