Skip to content

Commit 1f0fd9a

Browse files
committed
Implementing test for execute_many in transaction
1 parent a070654 commit 1f0fd9a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

python/tests/test_transaction.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,15 @@ async def test_transaction_execute_many(
222222
) -> None:
223223
connection = await psql_pool.connection()
224224
async with connection.transaction() as transaction:
225-
await transaction.execute_many(
226-
f"INSERT INTO {table_name} VALUES ($1, $2)",
227-
insert_values,
228-
)
229-
assert await count_rows_in_test_table(
230-
table_name,
231-
transaction,
232-
) - number_database_records == len(insert_values)
225+
try:
226+
await transaction.execute_many(
227+
f"INSERT INTO {table_name} VALUES ($1, $2)",
228+
insert_values,
229+
)
230+
except DBTransactionError:
231+
assert not insert_values
232+
else:
233+
assert await count_rows_in_test_table(
234+
table_name,
235+
transaction,
236+
) - number_database_records == len(insert_values)

0 commit comments

Comments
 (0)