Skip to content

Commit

Permalink
add test to check for cogent3#1844
Browse files Browse the repository at this point in the history
  • Loading branch information
khiron committed May 2, 2024
1 parent 407b927 commit 3911017
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_app/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3911017

Please sign in to comment.