Skip to content

Commit 1bc320a

Browse files
authored
tests(spanner): harden 'test_transaction_batch_update_w_syntax_error' (#9395)
Closes #8474
1 parent 2af15e8 commit 1bc320a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/system/test_system.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,18 +893,18 @@ def test_transaction_batch_update_w_syntax_error(self):
893893
{"contact_id": Type(code=INT64)},
894894
)
895895

896-
with session.transaction() as transaction:
896+
def unit_of_work(transaction):
897897
rows = list(transaction.read(self.TABLE, self.COLUMNS, self.ALL))
898898
self.assertEqual(rows, [])
899899

900900
status, row_counts = transaction.batch_update(
901901
[insert_statement, update_statement, delete_statement]
902902
)
903+
self.assertEqual(status.code, code_pb2.INVALID_ARGUMENT)
904+
self.assertEqual(len(row_counts), 1)
905+
self.assertEqual(row_counts[0], 1)
903906

904-
self.assertEqual(status.code, 3) # XXX: where are values defined?
905-
self.assertEqual(len(row_counts), 1)
906-
for row_count in row_counts:
907-
self.assertEqual(row_count, 1)
907+
session.run_in_transaction(unit_of_work)
908908

909909
def test_transaction_batch_update_wo_statements(self):
910910
from google.api_core.exceptions import InvalidArgument

0 commit comments

Comments
 (0)