Add type hints to some tests files (#12371)

This commit is contained in:
Dirk Klimpel 2022-04-05 14:54:41 +02:00 committed by GitHub
parent 42d8710f38
commit d666fc02fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 42 deletions

View file

@ -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.
"""