Skip to content
Snippets Groups Projects
Commit 3cc69d7d authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

FIX: bug in compare datatype and importance and unit function

parent d6b5a41f
No related branches found
No related tags found
1 merge request!53Release 0.1
......@@ -233,11 +233,11 @@ class Crawler(object):
if not identical:
break
for key in comp[0]["properties"]:
for attribute in ("datatype", "importance"):
if ("datatype" in comp[0]["properties"][key] and
comp[0]["properties"][key]["datatype"] is not None and
comp[1]["properties"][key]["datatype"] !=
comp[1]["properties"][key]["datatype"]):
for attribute in ("datatype", "importance", "unit"):
if (attribute in comp[0]["properties"][key] and
comp[0]["properties"][key][attribute] is not None and
comp[0]["properties"][key][attribute] !=
comp[1]["properties"][key][attribute]):
identical = False
break
......@@ -251,7 +251,6 @@ class Crawler(object):
del updateList[i]
continue
else:
breakpoint()
pass
return (insertList, updateList)
......
......@@ -290,6 +290,27 @@ def test_crawler_update_list(crawler, ident):
assert len(insl) == 0
assert len(updl) == 0
def test_identifiable_update(crawler, ident):
# change one value in updateList and then run the synchronization:
meas = [r for r in crawler.updateList if r.parents[0].name == "Measurement"][0]
meas.get_property("responsible").value = []
insl, updl = crawler.synchronize(crawler.updateList)
assert len(updl) == 1
def test_identifiable_update2(crawler, ident):
# change one unit in updateList and then run the synchronization:
meas = [r for r in crawler.updateList if r.parents[0].name == "Measurement"][0]
meas.get_property("description").unit = "cm"
insl, updl = crawler.synchronize(crawler.updateList)
assert len(updl) == 1
def test_identifiable_update3(crawler, ident):
# change values of multiple records in updateList and then run the synchronization:
meas = [r for r in crawler.updateList if r.parents[0].name == "Measurement"]
meas[0].get_property("responsible").value = []
meas[3].get_property("responsible").value = []
insl, updl = crawler.synchronize(crawler.updateList)
assert len(updl) == 2
def test_identifiable_adapter():
query = IdentifiableAdapter.create_query_for_identifiable(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment