Skip to content
Snippets Groups Projects
Commit 3ca09471 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: added comments and used different ids

parent c9609d2d
No related branches found
No related tags found
1 merge request!22Release 0.3
Pipeline #14759 canceled
......@@ -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 ###
......
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment