Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Виталий 2026-03-05 18:16:47 +03:00 committed by Vitaly312
parent 80b4abd3b5
commit 24fdd285fd
4 changed files with 21 additions and 19 deletions

View file

@ -189,14 +189,16 @@ class TestMediaGroupAggregator:
assert await aggregator.get_group("42") == []
async def test_acquire_lock(self, aggregator: BaseMediaGroupAggregator):
await aggregator.acquire_lock("42", "key1")
assert not await aggregator.acquire_lock("42", "key2")
await aggregator.release_lock("42", "key1")
for i in ("key2", "key3"):
for i in ("key1", "key2"):
assert await aggregator.acquire_lock("42", i)
assert not await aggregator.acquire_lock("42", i)
await aggregator.release_lock("42", i)
async def test_lock_not_acquired_with_wrong_key(self, aggregator: BaseMediaGroupAggregator):
await aggregator.acquire_lock("42", "key1")
await aggregator.release_lock("42", "key2")
assert not await aggregator.acquire_lock("42", "key1")
async def test_expired_objects_removed(self):
aggregator = MemoryMediaGroupAggregator()
await aggregator.add_into_group("42", _get_message(1))