mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 18:04:49 -04:00
User Cursor.__iter__ instead of fetchall
This prevents unnecessary construction of lists
This commit is contained in:
parent
59358cd3e7
commit
00957d1aa4
16 changed files with 41 additions and 42 deletions
|
@ -89,7 +89,7 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
|||
@defer.inlineCallbacks
|
||||
def test_select_one_1col(self):
|
||||
self.mock_txn.rowcount = 1
|
||||
self.mock_txn.fetchall.return_value = [("Value",)]
|
||||
self.mock_txn.__iter__ = Mock(return_value=iter([("Value",)]))
|
||||
|
||||
value = yield self.datastore._simple_select_one_onecol(
|
||||
table="tablename",
|
||||
|
@ -136,7 +136,7 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
|||
@defer.inlineCallbacks
|
||||
def test_select_list(self):
|
||||
self.mock_txn.rowcount = 3
|
||||
self.mock_txn.fetchall.return_value = ((1,), (2,), (3,))
|
||||
self.mock_txn.__iter__ = Mock(return_value=iter([(1,), (2,), (3,)]))
|
||||
self.mock_txn.description = (
|
||||
("colA", None, None, None, None, None, None),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue