From 391101797a58cca3e4f219cd44a74b59d854ddf0 Mon Sep 17 00:00:00 2001 From: richard morris Date: Thu, 2 May 2024 12:42:19 +1000 Subject: [PATCH] add test to check for #1844 --- tests/test_app/test_plugins.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_app/test_plugins.py b/tests/test_app/test_plugins.py index 17682f7e7..bed299d60 100644 --- a/tests/test_app/test_plugins.py +++ b/tests/test_app/test_plugins.py @@ -258,3 +258,20 @@ def main(self, data: int) -> int: assert app_with_default_addapp(5) == 42 app_with_custom_addapp = get_app("AppWithDefault", app=AddApp(10)) assert app_with_custom_addapp(5) == 15 + +def test_app_help_from_function(mock_extension_manager): + """_make_apphelp_docstring on a decorated function should return help""" + + @define_app + def square(val: int) -> int: + """app that returns the square of the input value""" + return val*val + + + mock_extension_manager([create_extension(square, module_name="module1")]) + + assert square.__name__ in cogent3.app.get_app_manager().names() + got = _make_apphelp_docstring(square) + + assert "Options" in got # test help is rendered + assert "square_app" in got # test the help is for the correct app