From 3ca094717e8422bd0d6c6ac721c7129d425fd73c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Tue, 12 Oct 2021 11:33:42 +0200
Subject: [PATCH] MAINT: added comments and used different ids

---
 CHANGELOG.md            |  2 +-
 unittests/test_cfood.py | 27 +++++++++++++++++----------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 046f848a..159a6eb0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -69,7 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   of a RecordType. This is fixed now.
 * #52 `XLSimporter.read_xls` throwed a wrong error when reading from a file with a wrong ending. 
   Now, a `DataInconsistencyError` is raised instead of a ValueError.
-* List properties are now treated properly in the crawler.
+* List properties are no longer updated unnecessarily by the crawler.
 
 ### Security ###
 
diff --git a/unittests/test_cfood.py b/unittests/test_cfood.py
index 5f257468..f5125166 100644
--- a/unittests/test_cfood.py
+++ b/unittests/test_cfood.py
@@ -191,25 +191,32 @@ class InsertionTest(unittest.TestCase):
         assert to_be_updated[0] is entity
 
         """Test properties with lists"""
-        rec1 = db.Record(id=12323)
-        rec1.add_property("Exp", value=[123333], datatype=db.LIST("Exp"))
-        rec2 = db.Record(id=123333)
+        rec1 = db.Record(id=12345)
+        rec1.add_property("Exp", value=[98765], datatype=db.LIST("Exp"))
+        rec2 = db.Record(id=98765)
         update = []
+        # compare Entity with id
         assure_has_property(rec1, "Exp", [rec2], to_be_updated=update)
         assert len(update) == 0
         update = []
-        assure_has_property(rec1, "Exp", [123333], to_be_updated=update)
+        # compare id with id
+        assure_has_property(rec1, "Exp", [98765], to_be_updated=update)
         assert len(update) == 0
         update = []
-        assure_has_property(rec1, "Exp2", [123333, 456, 789], to_be_updated=update)
+        # compare id with different list of ids
+        assure_has_property(rec1, "Exp2", [98765, 444, 555],
+                            to_be_updated=update)
         assert len(update) == 1
 
-        rec = db.Record(id=456456)
-        rec3 = db.Record(id=789789)
-        rec.add_property("Exp", value=[123123, rec3], datatype=db.LIST("Exp"))
-        rec2 = db.Record(id=123123)
+        rec = db.Record(id=666666)
+        rec3 = db.Record(id=777777)
+        rec.add_property("Exp", value=[888888, rec3], datatype=db.LIST("Exp"))
+        rec2 = db.Record(id=888888)
         update = []
-        assure_has_property(rec, "Exp", [rec2, 789789], to_be_updated=update)
+        # compare id and Entity with id and Entity
+        # i.e. check that conversion from Entity to id works in both
+        # directions.
+        assure_has_property(rec, "Exp", [rec2, 777777], to_be_updated=update)
         assert len(update) == 0
 
     def test_property_is(self):
-- 
GitLab