Path: blob/main/singlestoredb/docstring/tests/test_util.py
469 views
"""Test for utility functions."""1from typing import Any23from singlestoredb.docstring.common import DocstringReturns4from singlestoredb.docstring.util import combine_docstrings567def test_combine_docstrings() -> None:8"""Test combine_docstrings wrapper."""910def fun1(arg_a: Any, arg_b: Any, arg_c: Any, arg_d: Any) -> None:11"""short_description: fun11213:param arg_a: fun114:param arg_b: fun115:return: fun116"""17assert arg_a and arg_b and arg_c and arg_d1819def fun2(arg_b: Any, arg_c: Any, arg_d: Any, arg_e: Any) -> None:20"""short_description: fun22122long_description: fun22324:param arg_b: fun225:param arg_c: fun226:param arg_e: fun227"""28assert arg_b and arg_c and arg_d and arg_e2930@combine_docstrings(fun1, fun2)31def decorated1(32arg_a: Any, arg_b: Any, arg_c: Any,33arg_d: Any, arg_e: Any, arg_f: Any,34) -> None:35"""36:param arg_e: decorated37:param arg_f: decorated38"""39assert arg_a and arg_b and arg_c and arg_d and arg_e and arg_f4041assert decorated1.__doc__ == (42'short_description: fun2\n'43'\n'44'long_description: fun2\n'45'\n'46':param arg_a: fun1\n'47':param arg_b: fun1\n'48':param arg_c: fun2\n'49':param arg_e: fun2\n'50':param arg_f: decorated\n'51':returns: fun1'52)5354@combine_docstrings(fun1, fun2, exclude=[DocstringReturns])55def decorated2(56arg_a: Any, arg_b: Any, arg_c: Any, arg_d: Any, arg_e: Any, arg_f: Any,57) -> None:58assert arg_a and arg_b and arg_c and arg_d and arg_e and arg_f5960assert decorated2.__doc__ == (61'short_description: fun2\n'62'\n'63'long_description: fun2\n'64'\n'65':param arg_a: fun1\n'66':param arg_b: fun1\n'67':param arg_c: fun2\n'68':param arg_e: fun2'69)707172