diff --git a/test/static_analysis/41_aioretry_args.py b/test/static_analysis/41_aioretry_args.py new file mode 100644 index 0000000..6b561aa --- /dev/null +++ b/test/static_analysis/41_aioretry_args.py @@ -0,0 +1,23 @@ + +from __future__ import annotations + +from typing import reveal_type, Any + +from kaioretry import Retry, Context + + +aioretry = Retry( + exceptions=(ValueError, NotImplementedError), + context=Context(tries=5, delay=2)).aioretry + + +@aioretry +async def request(*args: Any) -> str: + """Request server something""" + return "asdf" +reveal_type(request) + +async def get_obj(obj_id: str) -> int: + """obtain an objet through https request""" + response = await request(1, 2, 3) + return int(response) diff --git a/test/static_analysis/42_aioretry_args_explicit_decorate.py b/test/static_analysis/42_aioretry_args_explicit_decorate.py new file mode 100644 index 0000000..6bcbd6c --- /dev/null +++ b/test/static_analysis/42_aioretry_args_explicit_decorate.py @@ -0,0 +1,25 @@ + +from __future__ import annotations + +from typing import reveal_type, Any + +from kaioretry import Retry, Context + + +aioretry = Retry( + exceptions=(ValueError, NotImplementedError), + context=Context(tries=5, delay=2)).aioretry + + +async def request(*args: Any) -> str: + """Request server something""" + return "asdf" + +request = aioretry(request) + + + +async def get_obj(obj_id: str) -> int: + """obtain an objet through https request""" + response = await request(1, 2, 3) + return int(response) diff --git a/test/static_analysis/43_aioretry_params.py b/test/static_analysis/43_aioretry_params.py new file mode 100644 index 0000000..b1498ab --- /dev/null +++ b/test/static_analysis/43_aioretry_params.py @@ -0,0 +1,23 @@ + +from __future__ import annotations + +from typing import reveal_type, Any + +from kaioretry import Retry, Context + + +aioretry = Retry( + exceptions=(ValueError, NotImplementedError), + context=Context(tries=5, delay=2)).aioretry + + +@aioretry +async def request(i: int, j: int, k: int) -> str: + """Request server something""" + return "asdf" + + +async def get_obj(obj_id: str) -> int: + """obtain an objet through https request""" + response = await request(1, 2, 3) + return int(response)