Skip to content

Commit e75899b

Browse files
committed
add a test for odd list and nonetype
1 parent e47ccc1 commit e75899b

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

gcloud/datastore/test_dataset.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,26 @@ def test_get_entity_path(self):
151151
self.assertEqual(list(result), ['foo'])
152152
self.assertEqual(result['foo'], 'Foo')
153153

154+
def test_get_entity_odd_nonetype(self):
155+
from gcloud.datastore.connection import datastore_pb
156+
DATASET_ID = 'DATASET'
157+
KIND = 'Kind'
158+
ID = 1234
159+
entity_pb = datastore_pb.Entity()
160+
entity_pb.key.partition_id.dataset_id = DATASET_ID
161+
path_element = entity_pb.key.path_element.add()
162+
path_element.kind = KIND
163+
path_element.id = ID
164+
prop = entity_pb.property.add()
165+
prop.name = 'foo'
166+
prop.value.string_value = 'Foo'
167+
connection = _Connection(entity_pb)
168+
dataset = self._makeOne(DATASET_ID, connection)
169+
with self.assertRaises(ValueError):
170+
dataset.get_entity([KIND])
171+
with self.assertRaises(TypeError):
172+
dataset.get_entity(None)
173+
154174

155175
class _Connection(object):
156176
_called_with = None

0 commit comments

Comments
 (0)