From 22aa4a3c74e6dc9ef4f6ff125d50e3b7eb618bb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Tue, 23 May 2023 14:17:42 +0200
Subject: [PATCH] TST: enhance doc and fix test

---
 src/caoscrawler/crawl.py  | 4 ++--
 unittests/test_crawler.py | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py
index 5475d2c1..3fd67e4b 100644
--- a/src/caoscrawler/crawl.py
+++ b/src/caoscrawler/crawl.py
@@ -641,7 +641,7 @@ class Crawler(object):
                              + str(self.compact_entity_list_representation(flat)))
             else:
                 logger.error("Found circular dependency (Note that this might include references "
-                             "that are not identifying properties: "
+                             "that are not identifying properties): "
                              + self.compact_entity_list_representation(circle))
             raise RuntimeError(
                 f"Could not finish split_into_inserts_and_updates. Circular dependency: "
@@ -681,7 +681,7 @@ class Crawler(object):
         """
         Detects whether there are circular references in the given entity list and returns a list
         where the entities are ordered according to the chain of references (and only the entities
-        contained in the circle are included.
+        contained in the circle are included. Returns None if no circular dependency is found.
 
         TODO: for the sake of detecting problems for split_into_inserts_and_updates we should only
         consider references that are identifying properties.
diff --git a/unittests/test_crawler.py b/unittests/test_crawler.py
index 8db4e9c5..7c592b43 100644
--- a/unittests/test_crawler.py
+++ b/unittests/test_crawler.py
@@ -874,8 +874,7 @@ def test_detect_circular_dependency(crawler_mocked_identifiable_retrieve, caplog
     circle = Crawler.detect_circular_dependency(flat)
     assert [id(el) for el in circle] == [id(el) for el in [a, c, b, a]]
 
-    with raises(Exception):
-        detect_circular_dependency([d])
+    assert detect_circular_dependency([d]) is None
     with raises(RuntimeError):
         _, _ = crawler.split_into_inserts_and_updates(flat)
     caplog.set_level(logging.ERROR, logger="caoscrawler.converters")
-- 
GitLab