find_handlers_code = ''' def dec(n): return n - 1 # mlrun:handler def inc(n): return n + 1 ''' find_handlers_expected = [ { 'name': 'inc', 'doc': '', 'return': funcdoc.param_dict(), 'params': [ funcdoc.param_dict('n'), ], 'lineno': 6, }, ] def test_find_handlers(): funcs = funcdoc.find_handlers(find_handlers_code) assert find_handlers_expected == funcs ast_code_cases = [ "{'x': 1, 'y': 2}",
find_handlers_code = ''' def dec(n): return n - 1 # mlrun:handler def inc(n): return n + 1 ''' find_handlers_expected = [ { 'name': 'inc', 'doc': '', 'return': funcdoc.param_dict(), 'params': [funcdoc.param_dict('n')], 'lineno': 6, }, ] def test_find_handlers(): funcs = funcdoc.find_handlers(find_handlers_code) assert find_handlers_expected == funcs ast_code_cases = [ "{'x': 1, 'y': 2}", 'dict(x=1, y=2)', '{}',