@@ -1704,7 +1704,9 @@ def _unit_of_work(txn):
17041704 return NOW
17051705
17061706 # Mock the transaction commit method to return NOW
1707- with mock .patch ('google.cloud.spanner_v1.transaction.Transaction.commit' , return_value = NOW ):
1707+ with mock .patch (
1708+ "google.cloud.spanner_v1.transaction.Transaction.commit" , return_value = NOW
1709+ ):
17081710 committed = database .run_in_transaction (_unit_of_work )
17091711
17101712 self .assertEqual (committed , NOW )
@@ -1729,7 +1731,9 @@ def _unit_of_work(txn, *args, **kwargs):
17291731 return NOW
17301732
17311733 # Mock the transaction commit method to return NOW
1732- with mock .patch ('google.cloud.spanner_v1.transaction.Transaction.commit' , return_value = NOW ):
1734+ with mock .patch (
1735+ "google.cloud.spanner_v1.transaction.Transaction.commit" , return_value = NOW
1736+ ):
17331737 committed = database .run_in_transaction (_unit_of_work , SINCE , until = UNTIL )
17341738
17351739 self .assertEqual (committed , NOW )
@@ -3517,20 +3521,22 @@ def __init__(
35173521 self .observability_options = observability_options
35183522 self ._nth_client_id = _Client .NTH_CLIENT .increment ()
35193523 self ._nth_request = AtomicCounter ()
3520-
3524+
35213525 # Mock credentials with proper attributes
35223526 self .credentials = mock .Mock ()
35233527 self .credentials .token = "mock_token"
35243528 self .credentials .expiry = None
35253529 self .credentials .valid = True
3526-
3530+
35273531 # Mock the spanner API to return proper session names
35283532 self ._spanner_api = mock .Mock ()
3533+
35293534 # Configure create_session to return a proper session with string name
35303535 def mock_create_session (request , ** kwargs ):
35313536 session_response = mock .Mock ()
35323537 session_response .name = f"projects/{ self .project } /instances/instance-id/databases/database-id/sessions/session-{ self ._nth_request .increment ()} "
35333538 return session_response
3539+
35343540 self ._spanner_api .create_session = mock_create_session
35353541
35363542 @property
0 commit comments