mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-08 08:04:55 -04:00
Add type hints to some tests files (#12371)
This commit is contained in:
parent
42d8710f38
commit
d666fc02fa
6 changed files with 58 additions and 42 deletions
|
@ -14,12 +14,18 @@
|
|||
# limitations under the License.
|
||||
|
||||
import secrets
|
||||
from typing import Any, Dict, Generator, List, Tuple
|
||||
|
||||
from twisted.test.proto_helpers import MemoryReactor
|
||||
|
||||
from synapse.server import HomeServer
|
||||
from synapse.util import Clock
|
||||
|
||||
from tests import unittest
|
||||
|
||||
|
||||
class UpsertManyTests(unittest.HomeserverTestCase):
|
||||
def prepare(self, reactor, clock, hs):
|
||||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
|
||||
self.storage = hs.get_datastores().main
|
||||
|
||||
self.table_name = "table_" + secrets.token_hex(6)
|
||||
|
@ -40,11 +46,13 @@ class UpsertManyTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
)
|
||||
|
||||
def _dump_to_tuple(self, res):
|
||||
def _dump_to_tuple(
|
||||
self, res: List[Dict[str, Any]]
|
||||
) -> Generator[Tuple[int, str, str], None, None]:
|
||||
for i in res:
|
||||
yield (i["id"], i["username"], i["value"])
|
||||
|
||||
def test_upsert_many(self):
|
||||
def test_upsert_many(self) -> None:
|
||||
"""
|
||||
Upsert_many will perform the upsert operation across a batch of data.
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue