Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit 261512b

Browse files
committed
test: add test for invalid isolation level
1 parent 56fe1a5 commit 261512b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/mockserver_tests/test_dbapi_isolation_level.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from google.api_core.exceptions import Unknown
1516
from google.cloud.spanner_dbapi import Connection
1617
from google.cloud.spanner_v1 import (
1718
BeginTransactionRequest,
@@ -141,3 +142,9 @@ def test_begin_isolation_level(self):
141142
self.assertEqual(1, len(begin_requests))
142143
self.assertEqual(begin_requests[0].options.isolation_level, level)
143144
MockServerTestBase.spanner_service.clear_requests()
145+
146+
def test_begin_invalid_isolation_level(self):
147+
connection = Connection(self.instance, self.database)
148+
with connection.cursor() as cursor:
149+
with self.assertRaises(Unknown):
150+
cursor.execute("begin isolation level does_not_exist")

0 commit comments

Comments
 (0)