Skip to content

Commit 0807cbd

Browse files
committed
Add DELETE tests for compiled cache in SAConnection.executemany
1 parent 94c2bcb commit 0807cbd

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

tests/sa/test_sa_compiled_cache.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,8 @@ async def go():
7171
]))
7272
self.assertEqual(0, len(cache))
7373

74-
# check insert with incorrectly bound params not added to cache
74+
# check insert with bound param added to cache
7575
q = tbl.insert().values(val=bindparam('value'))
76-
await conn.execute(q, [
77-
{'value': 'some_val_103'},
78-
{'value': 'some_val_104'},
79-
{'value': 'some_val_105', 'id': 12345},
80-
])
81-
self.assertEqual(0, len(cache))
82-
83-
# check insert with bound params added to cache
8476
test_values = [
8577
{'value': 'some_val_103'},
8678
{'value': 'some_val_104'},
@@ -94,7 +86,7 @@ async def go():
9486

9587
cursor = await conn.execute(select_all)
9688
rows = await cursor.fetchall()
97-
self.assertEqual(15, len(rows))
89+
self.assertEqual(12, len(rows))
9890
self.assertEqual(2, len(cache))
9991

10092
# check update with bound params added to cache
@@ -127,6 +119,20 @@ async def go():
127119
row = await cursor.fetchone()
128120
self.assertEqual(test_value['update'], row.val)
129121

122+
self.assertEqual(4, len(cache))
123+
124+
# check delete with bound params added to cache
125+
q = tbl.delete().where(tbl.c.val == bindparam('value'))
126+
127+
test_del_values = [
128+
{'value': 'updated_val_200'},
129+
{'value': 'updated_val_201'},
130+
{'value': 'updated_val_202'},
131+
]
132+
res = await conn.execute(q, test_del_values)
133+
self.assertEqual(3, res.rowcount)
134+
self.assertEqual(5, len(cache))
135+
130136
self.loop.run_until_complete(go())
131137

132138
def test_cache(self):

0 commit comments

Comments
 (0)