Skip to content

Commit

Permalink
add currently-failing static analysis test files
Browse files Browse the repository at this point in the history
  • Loading branch information
Anvil committed Dec 10, 2023
1 parent 9784cba commit 26ab631
Show file tree
Hide file tree
Showing 33 changed files with 1,002 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_args_any_any.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_args_any_any.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(*args: Any) -> Any:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(1, 2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_args_any_str.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_args_any_str.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(*args: Any) -> str:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(1, 2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_args_int_any.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_args_int_any.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(*args: int) -> Any:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(1, 2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_kwargs_any_any.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_kwargs_any_any.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(**kwargs: Any) -> Any:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(x=1, y=2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_kwargs_any_str.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_kwargs_any_str.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(**kwargs: Any) -> str:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(x=1, y=2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_kwargs_int_any.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_kwargs_int_any.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(**kwargs: int) -> Any:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(x=1, y=2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_param_any_any.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_param_any_any.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(x: Any, y: Any) -> Any:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(1, 2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_param_any_str.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_param_any_str.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(x: Any, y: Any) -> str:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(1, 2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
30 changes: 30 additions & 0 deletions test/static_analysis/aioretry_built_direct_async_param_int_any.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''Test aioretry_built_direct_async_param_int_any.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


@Retry(exceptions=(ValueError, NotImplementedError), context=Context(tries=5, delay=2)).aioretry
async def func(x: int, y: int) -> Any:
''' ... '''
return 'return_value'
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await func(1, 2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'''Test aioretry_main_by_call_named_sync_args_any_str.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


def func(*args: Any) -> str:
''' ... '''
return 'return_value'

wrapped: Callable[[VarArg(Any)], Awaitable[str]] = aioretry(exceptions=Exception, tries=2)(func)
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await wrapped(1, 2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'''Test aioretry_main_by_call_named_sync_args_int_str.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


def func(*args: int) -> str:
''' ... '''
return 'return_value'

wrapped: Callable[[VarArg(int)], Awaitable[str]] = aioretry(exceptions=Exception, tries=2)(func)
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await wrapped(1, 2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'''Test aioretry_main_by_call_named_sync_kwargs_any_str.py '''

# pylint: disable=unused-import, unused-argument, invalid-name, R0801


import asyncio
from typing import Any
from collections.abc import Callable, Awaitable
from mypy_extensions import VarArg, KwArg
from kaioretry import retry, aioretry, Retry, Context


def func(**kwargs: Any) -> str:
''' ... '''
return 'return_value'

wrapped: Callable[[KwArg(Any)], Awaitable[str]] = aioretry(exceptions=Exception, tries=2)(func)
from typing_extensions import reveal_type
reveal_type(func)



async def use_decoration(parameter: str) -> str:
''' obtain result and use it '''
result = await wrapped(x=1, y=2)
assert isinstance(result, str)
return f"parameter is {parameter}. result is {result}"


if __name__ == "__main__":
print(asyncio.run(use_decoration("value")))
Loading

0 comments on commit 26ab631

Please sign in to comment.