mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-26 19:55:21 -04:00
Add type hints for tests/unittest.py
. (#12347)
In particular, add type hints for get_success and friends, which are then helpful in a bunch of places.
This commit is contained in:
parent
33ebee47e4
commit
f0b03186d9
12 changed files with 97 additions and 48 deletions
|
@ -28,7 +28,7 @@ class LockTestCase(unittest.HomeserverTestCase):
|
|||
"""
|
||||
# First to acquire this lock, so it should complete
|
||||
lock = self.get_success(self.store.try_acquire_lock("name", "key"))
|
||||
self.assertIsNotNone(lock)
|
||||
assert lock is not None
|
||||
|
||||
# Enter the context manager
|
||||
self.get_success(lock.__aenter__())
|
||||
|
@ -45,7 +45,7 @@ class LockTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
# We can now acquire the lock again.
|
||||
lock3 = self.get_success(self.store.try_acquire_lock("name", "key"))
|
||||
self.assertIsNotNone(lock3)
|
||||
assert lock3 is not None
|
||||
self.get_success(lock3.__aenter__())
|
||||
self.get_success(lock3.__aexit__(None, None, None))
|
||||
|
||||
|
@ -53,7 +53,7 @@ class LockTestCase(unittest.HomeserverTestCase):
|
|||
"""Test that we don't time out locks while they're still active"""
|
||||
|
||||
lock = self.get_success(self.store.try_acquire_lock("name", "key"))
|
||||
self.assertIsNotNone(lock)
|
||||
assert lock is not None
|
||||
|
||||
self.get_success(lock.__aenter__())
|
||||
|
||||
|
@ -69,7 +69,7 @@ class LockTestCase(unittest.HomeserverTestCase):
|
|||
"""Test that we time out locks if they're not updated for ages"""
|
||||
|
||||
lock = self.get_success(self.store.try_acquire_lock("name", "key"))
|
||||
self.assertIsNotNone(lock)
|
||||
assert lock is not None
|
||||
|
||||
self.get_success(lock.__aenter__())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue