summary refs log tree commit diff
path: root/tests/storage/test__base.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-10-26 13:01:36 -0400
committerGitHub <noreply@github.com>2023-10-26 13:01:36 -0400
commit9407d5ba78d1e5275b5817ae9e6aedf7d1ca14f7 (patch)
tree70935c19b787e89115d6f8884f3d134a6bacf264 /tests/storage/test__base.py
parentPin the recommended poetry version in contributors' guide (#16550) (diff)
downloadsynapse-9407d5ba78d1e5275b5817ae9e6aedf7d1ca14f7.tar.xz
Convert simple_select_list and simple_select_list_txn to return lists of tuples (#16505)
This should use fewer allocations and improves type hints.
Diffstat (limited to 'tests/storage/test__base.py')
-rw-r--r--tests/storage/test__base.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/storage/test__base.py b/tests/storage/test__base.py
index 8bbf936ae9..8cbc974ac4 100644
--- a/tests/storage/test__base.py
+++ b/tests/storage/test__base.py
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 import secrets
-from typing import Generator, Tuple
+from typing import Generator, List, Tuple, cast
 
 from twisted.test.proto_helpers import MemoryReactor
 
@@ -47,15 +47,15 @@ class UpdateUpsertManyTests(unittest.HomeserverTestCase):
         )
 
     def _dump_table_to_tuple(self) -> Generator[Tuple[int, str, str], None, None]:
-        res = self.get_success(
-            self.storage.db_pool.simple_select_list(
-                self.table_name, None, ["id, username, value"]
-            )
+        yield from cast(
+            List[Tuple[int, str, str]],
+            self.get_success(
+                self.storage.db_pool.simple_select_list(
+                    self.table_name, None, ["id, username, value"]
+                )
+            ),
         )
 
-        for i in res:
-            yield (i["id"], i["username"], i["value"])
-
     def test_upsert_many(self) -> None:
         """
         Upsert_many will perform the upsert operation across a batch of data.