Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion autoform_cli/claims.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ def expired(cls, lease: Mapping[str, Any], now: float | None = None) -> bool:
return expires_at <= comparison_time

def acquire(self, key: str, ttl: int | float = CLAIM_TTL_S, steal: bool = False, note: str = "") -> bool:
"""CAS-acquire a free, expired, malformed, owned, or explicitly stolen lease."""
"""CAS-acquire a free, expired, owned, or explicitly stolen lease.

A malformed lease raises ``MalformedLeaseError``, even with ``steal``.
"""
key = _validate_key(key)
_validate_ttl(ttl)
self._ensure_scratch()
Expand Down
1 change: 1 addition & 0 deletions tests/test_claims.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def test_malformed_lease_is_unverifiable_and_not_takeover_eligible(tmp_path: Pat
lambda: board.renew("malformed"),
lambda: board.release("malformed"),
lambda: board.acquire("malformed", ttl=600),
lambda: board.acquire("malformed", ttl=600, steal=True),
):
with pytest.raises(claims.MalformedLeaseError):
operation()
Expand Down
Loading