Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sanche committed Jan 31, 2024
1 parent ed60cc1 commit 07ae10b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/unit/retry/test_retry_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def test_constructor_options(self):
assert retry_._on_error is _some_function

@pytest.mark.parametrize("use_deadline", [True, False])
def test_with_timeout(self, use_deadline):
@pytest.mark.parametrize("value", [None, 0, 1, 4, 42, 5.5])
def test_with_timeout(self, use_deadline, value):
retry_ = self._make_one(
predicate=mock.sentinel.predicate,
initial=1,
Expand All @@ -148,11 +149,11 @@ def test_with_timeout(self, use_deadline):
on_error=mock.sentinel.on_error,
)
new_retry = (
retry_.with_timeout(42) if not use_deadline else retry_.with_deadline(42)
retry_.with_timeout(value) if not use_deadline else retry_.with_deadline(value)
)
assert retry_ is not new_retry
assert new_retry._timeout == 42
assert new_retry.timeout == 42 if not use_deadline else new_retry.deadline == 42
assert new_retry._timeout == value
assert new_retry.timeout == value if not use_deadline else new_retry.deadline == value

# the rest of the attributes should remain the same
assert new_retry._predicate is retry_._predicate
Expand Down

0 comments on commit 07ae10b

Please sign in to comment.