From e38fed98b8a95be2dea65759e99fac9ff322428d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Mon, 17 Oct 2022 10:01:11 +0200 Subject: [PATCH] MAINT: doc and rename test --- src/caoscrawler/crawl.py | 13 +++++++------ unittests/test_tool.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py index a117aeb2..03a856c1 100644 --- a/src/caoscrawler/crawl.py +++ b/src/caoscrawler/crawl.py @@ -193,8 +193,9 @@ class Crawler(object): Please use SecurityMode Enum """ - # TODO: check if this feature is really needed - + # The following caches store records, where we checked whether they exist on the remote + # server. Since, it is important to know whether they exist or not, we store them into two + # different caches. self.remote_existing_cache = IdentifiedCache() self.remote_missing_cache = IdentifiedCache() self.recordStore = RecordStore() @@ -525,10 +526,10 @@ class Crawler(object): def has_missing_object_in_references(self, record: db.Record): """ - returns False if any property value is a db.Entity object that does not have an ID and also - is not contained in the local cache. For example, if it was checked before whether such an - db.Entity object existed remotely and it was not found, it would have been added to the - local cache. + returns False if any property value is a db.Entity object that + is contained in the `remote_missing_cache`. If the record has such an object in the + reference properties, it means that it references another Entity, where we checked + whether it exists remotely and it was not found. """ for p in record.properties: # if (is_reference(p) diff --git a/unittests/test_tool.py b/unittests/test_tool.py index 7eba03fe..5ffb9a45 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -498,7 +498,7 @@ def test_split_into_inserts_and_updates_with_copy_attr(crawler_mocked_identifiab crawler.identifiableAdapter.retrieve_identified_record_for_record.assert_called() -def test_no_uncached_entity_object_in_references(crawler): +def test_has_missing_object_in_references(crawler): # Simulate remote server content by using the names to identify records # There are only two known Records with name A and B crawler.identifiableAdapter.get_registered_identifiable = Mock(side_effect=partial( -- GitLab