Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hasier committed Jul 4, 2024
1 parent 5138fd8 commit e5a5387
Show file tree
Hide file tree
Showing 4 changed files with 467 additions and 5 deletions.
6 changes: 4 additions & 2 deletions tenacity/asyncio/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(self, *retries: typing.Union[retry_base, async_retry_base]) -> None
async def __call__(self, retry_state: "RetryCallState") -> bool: # type: ignore[override]
result = False
for r in self.retries:
result = result or await _utils.wrap_to_async_func(r)(retry_state)
result = result or (await _utils.wrap_to_async_func(r)(retry_state) is True)
if result:
break
return result
Expand All @@ -119,7 +119,9 @@ def __init__(self, *retries: typing.Union[retry_base, async_retry_base]) -> None
async def __call__(self, retry_state: "RetryCallState") -> bool: # type: ignore[override]
result = True
for r in self.retries:
result = result and await _utils.wrap_to_async_func(r)(retry_state)
result = result and (
await _utils.wrap_to_async_func(r)(retry_state) is True
)
if not result:
break
return result
4 changes: 2 additions & 2 deletions tenacity/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def __init__(self, *retries: retry_base) -> None:
self.retries = retries

def __call__(self, retry_state: "RetryCallState") -> bool:
return any(r(retry_state) for r in self.retries)
return any(r(retry_state) is True for r in self.retries)


class retry_all(retry_base):
Expand All @@ -293,4 +293,4 @@ def __init__(self, *retries: retry_base) -> None:
self.retries = retries

def __call__(self, retry_state: "RetryCallState") -> bool:
return all(r(retry_state) for r in self.retries)
return all(r(retry_state) is True for r in self.retries)
Loading

0 comments on commit e5a5387

Please sign in to comment.