Skip to content

Commit 2ac3226

Browse files
committed
Removing xrange and making test _Key return _Key instances.
1 parent 483d05c commit 2ac3226

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

gcloud/datastore/test_dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def test_allocate_ids(self):
228228
result = DATASET.allocate_ids(INCOMPLETE_KEY, NUM_IDS)
229229

230230
# Check the IDs returned match _PathElementProto.
231-
self.assertEqual(result, range(NUM_IDS))
231+
self.assertEqual([key._id for key in result], range(NUM_IDS))
232232

233233
# Check connection is called correctly.
234234
self.assertEqual(CONNECTION._called_dataset_id, DATASET_ID)
@@ -269,7 +269,7 @@ def allocate_ids(self, dataset_id, key_pbs):
269269
self._called_dataset_id = dataset_id
270270
self._called_key_pbs = key_pbs
271271
num_pbs = len(key_pbs)
272-
return [_KeyProto(i) for i in xrange(num_pbs)]
272+
return [_KeyProto(i) for i in range(num_pbs)]
273273

274274

275275
class _PathElementProto(object):

gcloud/datastore/test_entity.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,13 @@ class _Key(object):
239239
_key = 'KEY'
240240
_partial = False
241241
_path = None
242+
_id = None
242243

243244
def id(self, id_to_set):
244245
self._called_id = id_to_set
245-
return id_to_set
246+
clone = _Key()
247+
clone._id = id_to_set
248+
return clone
246249

247250
def to_protobuf(self):
248251
return self._key

0 commit comments

Comments
 (0)