Skip to content

Commit

Permalink
add a test for odd list and nonetype
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanyang0528 committed Nov 28, 2014
1 parent e47ccc1 commit e75899b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gcloud/datastore/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,26 @@ def test_get_entity_path(self):
self.assertEqual(list(result), ['foo'])
self.assertEqual(result['foo'], 'Foo')

def test_get_entity_odd_nonetype(self):
from gcloud.datastore.connection import datastore_pb
DATASET_ID = 'DATASET'
KIND = 'Kind'
ID = 1234
entity_pb = datastore_pb.Entity()
entity_pb.key.partition_id.dataset_id = DATASET_ID
path_element = entity_pb.key.path_element.add()
path_element.kind = KIND
path_element.id = ID
prop = entity_pb.property.add()
prop.name = 'foo'
prop.value.string_value = 'Foo'
connection = _Connection(entity_pb)
dataset = self._makeOne(DATASET_ID, connection)
with self.assertRaises(ValueError):
dataset.get_entity([KIND])
with self.assertRaises(TypeError):
dataset.get_entity(None)


class _Connection(object):
_called_with = None
Expand Down

0 comments on commit e75899b

Please sign in to comment.