Skip to content

Commit

Permalink
Review Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelnucfin committed Mar 9, 2018
1 parent 69a67ac commit 1f4d8d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion firestore/google/cloud/firestore_v1beta1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def _parse_batch_get(get_doc_response, reference_map, client):
a document factory.
Returns:
Optional[.DocumentSnapshot]: The retrieved snapshot.
[.DocumentSnapshot]: The retrieved snapshot.
Raises:
ValueError: If the response has a ``result`` field (a oneof) other
Expand Down
9 changes: 6 additions & 3 deletions firestore/google/cloud/firestore_v1beta1/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,15 @@ def get(self, field_paths=None, transaction=None):
Returns:
~.firestore_v1beta1.document.DocumentSnapshot: A snapshot of
the current document.
the current document. If the document does not exist at
the time of `snapshot`, the snapshot `reference`, `data`,
`update_time`, and `create_time` attributes of the
document will all be `None` and `exists` will
be `False`.
"""
snapshot_generator = self._client.get_all(
[self], field_paths=field_paths, transaction=transaction)
snapshot = _consume_single_get(snapshot_generator)
return snapshot
return _consume_single_get(snapshot_generator)


class DocumentSnapshot(object):
Expand Down
6 changes: 3 additions & 3 deletions firestore/tests/unit/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ def test_get_not_found(self):

# Create a minimal fake client with a dummy response.
read_time = 123
snapshot = DocumentSnapshot(None, None, False, read_time, None, None)
response_iterator = iter([snapshot])
expected = DocumentSnapshot(None, None, False, read_time, None, None)
response_iterator = iter([expected])
client = mock.Mock(
_database_string='sprinklez',
spec=['_database_string', 'get_all'])
Expand All @@ -463,7 +463,7 @@ def test_get_not_found(self):
self.assertIsNone(snapshot.reference)
self.assertIsNone(snapshot._data)
self.assertFalse(snapshot.exists)
self.assertEqual(snapshot.read_time, read_time)
self.assertEqual(snapshot.read_time, expected.read_time)
self.assertIsNone(snapshot.create_time)
self.assertIsNone(snapshot.update_time)

Expand Down

0 comments on commit 1f4d8d4

Please sign in to comment.