@@ -106,6 +106,36 @@ async def no_view(*_args: object, **kwargs: object) -> object:
106106 assert attempts == [False , True ]
107107
108108
109+ async def test_help_interception_leaves_ineligible_outputs_to_alconna (
110+ picmenu_plugin : object ,
111+ monkeypatch : "pytest.MonkeyPatch" ,
112+ ) -> None :
113+ """Only owned Help output enters the PicMenu interception pipeline."""
114+ from nonebot_plugin_picmenu_next import __main__ as main
115+
116+ async def unexpected_pipeline_call (* _args : object , ** _kwargs : object ) -> None :
117+ raise AssertionError ("ineligible output entered the interception pipeline" )
118+
119+ ext = main .PMNHelpExtension ()
120+ monkeypatch .setattr (ext , "inject" , unexpected_pipeline_call )
121+ monkeypatch .setattr (main , "render_menu" , unexpected_pipeline_call )
122+
123+ ext .command = _owned_command ("not-help-picmenu" , "not_help_plugin" )
124+ assert (
125+ await ext .output_converter ("error" , "Alconna error" )
126+ ).extract_plain_text () == "Alconna error"
127+
128+ ext .command = None
129+ assert (
130+ await ext .output_converter ("help" , "Uninitialized fallback" )
131+ ).extract_plain_text () == "Uninitialized fallback"
132+
133+ ext .command = Alconna ("unowned-picmenu" )
134+ assert (
135+ await ext .output_converter ("help" , "Unowned fallback" )
136+ ).extract_plain_text () == "Unowned fallback"
137+
138+
109139async def test_help_interception_uses_hidden_snapshot_for_adapter_hidden_plugin (
110140 picmenu_plugin : object ,
111141 monkeypatch : "pytest.MonkeyPatch" ,
0 commit comments