@@ -203,8 +203,8 @@ class Mutation(object):
203203 pass
204204
205205 class Xact (object ):
206- def mutation ( self ):
207- return Mutation ()
206+ mutation = Mutation ()
207+
208208 conn = self ._makeOne ()
209209 conn .transaction (Xact ())
210210 found = conn .mutation ()
@@ -765,8 +765,8 @@ def test_commit_w_transaction(self):
765765 from gcloud .datastore import datastore_v1_pb2 as datastore_pb
766766
767767 class Xact (object ):
768- def id ( self ):
769- return 'xact'
768+ id = 'xact'
769+
770770 DATASET_ID = 'DATASET'
771771 key_pb = self ._make_key_pb (DATASET_ID )
772772 rsp_pb = datastore_pb .CommitResponse ()
@@ -808,9 +808,8 @@ def test_rollback_wo_existing_transaction(self):
808808 def test_rollback_w_existing_transaction_no_id (self ):
809809
810810 class Xact (object ):
811+ id = None
811812
812- def id (self ):
813- return None
814813 DATASET_ID = 'DATASET'
815814 conn = self ._makeOne ()
816815 conn .transaction (Xact ())
@@ -823,9 +822,8 @@ def test_rollback_ok(self):
823822 TRANSACTION = 'xact'
824823
825824 class Xact (object ):
825+ id = TRANSACTION
826826
827- def id (self ):
828- return TRANSACTION
829827 rsp_pb = datastore_pb .RollbackResponse ()
830828 conn = self ._makeOne ()
831829 conn .transaction (Xact ())
@@ -1038,11 +1036,9 @@ def test_save_entity_wo_transaction_w_auto_id(self):
10381036 def test_save_entity_w_transaction (self ):
10391037 from gcloud .datastore import datastore_v1_pb2 as datastore_pb
10401038
1041- mutation = datastore_pb .Mutation ()
1042-
10431039 class Xact (object ):
1044- def mutation ( self ):
1045- return mutation
1040+ mutation = datastore_pb . Mutation ()
1041+
10461042 DATASET_ID = 'DATASET'
10471043 key_pb = self ._make_key_pb (DATASET_ID )
10481044 rsp_pb = datastore_pb .CommitResponse ()
@@ -1059,11 +1055,9 @@ def test_save_entity_w_transaction_nested_entity(self):
10591055 from gcloud .datastore import datastore_v1_pb2 as datastore_pb
10601056 from gcloud .datastore .entity import Entity
10611057
1062- mutation = datastore_pb .Mutation ()
1063-
10641058 class Xact (object ):
1065- def mutation ( self ):
1066- return mutation
1059+ mutation = datastore_pb . Mutation ()
1060+
10671061 DATASET_ID = 'DATASET'
10681062 nested = Entity ()
10691063 nested ['bar' ] = u'Bar'
@@ -1114,11 +1108,9 @@ def test_delete_entities_wo_transaction(self):
11141108 def test_delete_entities_w_transaction (self ):
11151109 from gcloud .datastore import datastore_v1_pb2 as datastore_pb
11161110
1117- mutation = datastore_pb .Mutation ()
1118-
11191111 class Xact (object ):
1120- def mutation ( self ):
1121- return mutation
1112+ mutation = datastore_pb . Mutation ()
1113+
11221114 DATASET_ID = 'DATASET'
11231115 key_pb = self ._make_key_pb (DATASET_ID )
11241116 rsp_pb = datastore_pb .CommitResponse ()
@@ -1162,6 +1154,7 @@ class Transaction(object):
11621154 def __init__ (self , id ):
11631155 self ._id = id
11641156
1157+ @property
11651158 def id (self ):
11661159 return self ._id
11671160
0 commit comments