From 2b863ace9442c4b749eab5ae870275493f5f3d15 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Sun, 12 May 2024 19:43:41 +0200
Subject: [PATCH] test

---
 unittests/test_sync_graph.py | 21 ---------------------
 unittests/test_sync_node.py  | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/unittests/test_sync_graph.py b/unittests/test_sync_graph.py
index c53e7ad4..4c134af9 100644
--- a/unittests/test_sync_graph.py
+++ b/unittests/test_sync_graph.py
@@ -399,27 +399,6 @@ def test_set_id_of_node(simple_adapter):
     assert st.nodes[0].identifiable is not None
     assert len(st.nodes) == 2
 
-    # Test for meaningful exception when having unmergeable properties.
-    ent_list = [
-        db.Record().add_parent("RT3").add_property('a', value=1).add_property('b', value=1),
-        db.Record().add_parent("RT3").add_property('a', value=1).add_property('b', value=2),
-    ]
-
-    st = SyncGraph(ent_list, simple_adapter)
-    with pytest.raises(ImpossibleMergeError):
-        st.export_record_lists()
-    ent_list = [
-        db.Record().add_parent("RT3").add_property('a', value=1)
-        .add_property('b', value=db.Record(name='b').add_parent("RT5")),
-        db.Record().add_parent("RT3").add_property('a', value=1)
-        .add_property('b', value=db.Record(name='a').add_parent("RT5")),
-    ]
-
-    st = SyncGraph(ent_list, simple_adapter)
-    with pytest.raises(ImpossibleMergeError):
-        st.export_record_lists()
-
-
 @patch("caoscrawler.sync_graph.cached_get_entity_by",
        new=Mock(side_effect=mock_get_entity_by))
 def test_merging(simple_adapter):
diff --git a/unittests/test_sync_node.py b/unittests/test_sync_node.py
index 54d1769a..250d3a8a 100644
--- a/unittests/test_sync_node.py
+++ b/unittests/test_sync_node.py
@@ -211,6 +211,20 @@ def test_export_node():
     assert len(exp.properties) == len(rec_a.properties)
     assert len(exp.parents) == len(rec_a.parents)
 
+    # ---------------------------------------------------------------------------------------------
+    # NOTE: in the following we create a SyncNode object with twice the same Property as a short
+    # hand for a SyncNode that was created from one Entity with such a Property and then updating
+    # it with another SyncNode that also has the Property
+    # ---------------------------------------------------------------------------------------------
+
+    # same property name, different values
+    rec_a = (db.Record(id=101)
+             .add_parent("B")
+             .add_property(name="a", value='b')
+             .add_property(name="a", value='a'))
+
+    with pytest.raises(ImpossibleMergeError):
+        exp = SyncNode(rec_a).export_entity()
 
     # SyncNodes with same ID are considered equal
     rec_a = (db.Record(id=101)
-- 
GitLab