Skip to content

Instantly share code, notes, and snippets.

@mcdonc
Created October 12, 2018 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcdonc/7db257d78173197f5957940307bfda37 to your computer and use it in GitHub Desktop.
Save mcdonc/7db257d78173197f5957940307bfda37 to your computer and use it in GitHub Desktop.
=================================== FAILURES ===================================
_________ TestWatch.test__compute_snapshot_operation_relative_ordering _________
self = <tests.unit.test_watch.TestWatch testMethod=test__compute_snapshot_operation_relative_ordering>
def test__compute_snapshot_operation_relative_ordering(self):
from google.cloud.firestore_v1beta1.watch import WatchDocTree
doc_tree = WatchDocTree()
class DummyDoc(object):
update_time = mock.sentinel
deleted_doc = DummyDoc()
added_doc = DummyDoc()
added_doc._document_path = '/added'
updated_doc = DummyDoc()
updated_doc._document_path = '/updated'
doc_tree = doc_tree.insert('/deleted', deleted_doc)
doc_tree = doc_tree.insert('/updated', updated_doc)
doc_map = {'/deleted': deleted_doc, '/updated': updated_doc}
added_snapshot = DummyDocumentSnapshot(added_doc, None, True,
None, None, None)
added_snapshot.reference = added_doc
updated_snapshot = DummyDocumentSnapshot(updated_doc, None, True,
None, None, None)
updated_snapshot.reference = updated_doc
delete_changes = ['/deleted']
add_changes = [added_snapshot]
update_changes = [updated_snapshot]
inst = self._makeOne()
updated_tree, updated_map, applied_changes = inst._compute_snapshot(
doc_tree,
doc_map,
delete_changes,
add_changes,
> update_changes
)
tests/unit/test_watch.py:649:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
google/cloud/firestore_v1beta1/watch.py:686: in _compute_snapshot
name, updated_tree, updated_map)
google/cloud/firestore_v1beta1/watch.py:622: in delete_doc
existing = updated_tree.find(old_document)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <google.cloud.firestore_v1beta1.watch.WatchDocTree object at 0x7f2568d4aeb8>
key = <tests.unit.test_watch.TestWatch.test__compute_snapshot_operation_relative_ordering.<locals>.DummyDoc object at 0x7f2568d4a160>
def find(self, key):
> return self._dict[key]
E KeyError: <tests.unit.test_watch.TestWatch.test__compute_snapshot_operation_relative_ordering.<locals>.DummyDoc object at 0x7f2568d4a160>
google/cloud/firestore_v1beta1/watch.py:96: KeyError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment