Skip to content

Commit

Permalink
add aioretry typing tests cases with an *args signature
Browse files Browse the repository at this point in the history
  • Loading branch information
Anvil committed Dec 2, 2023
1 parent ebd7383 commit 13074e8
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/static_analysis/41_aioretry_args.py
Original file line number Diff line number Diff line change
@@ -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)
25 changes: 25 additions & 0 deletions test/static_analysis/42_aioretry_args_explicit_decorate.py
Original file line number Diff line number Diff line change
@@ -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)
23 changes: 23 additions & 0 deletions test/static_analysis/43_aioretry_params.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 13074e8

Please sign in to comment.