Skip to content
Snippets Groups Projects
Commit ac2c5163 authored by florian's avatar florian
Browse files

TST: Add unittest for merge conflict

parent ab1e6de7
Branches
Tags
2 merge requests!91Release 0.3,!62Fix merge conflict in split_into_inserts_and_updates
...@@ -99,12 +99,21 @@ def test_issue_39(): ...@@ -99,12 +99,21 @@ def test_issue_39():
# a1 (has id) references b1 (has no id) # a1 (has id) references b1 (has no id)
a1 = db.Record(name="A", id=101).add_parent(name="RT_A") a1 = db.Record(name="A", id=101).add_parent(name="RT_A")
b1 = db.Record(name="B").add_parent(name="RT_B") b1 = db.Record(name="B").add_parent(name="RT_B")
a1.add_property(name="RT_B", value=b1)
# a2 (no id) references b2 (has id) # a2 (no id) references b2 (has id)
a2 = db.Record(name="A").add_parent(name="RT_A") a2 = db.Record(name="A").add_parent(name="RT_A")
b2 = db.Record(name="B", id=102).add_parent(name="RT_B") b2 = db.Record(name="B", id=102).add_parent(name="RT_B")
a2.add_property(name="RT_B", value=b2)
flat_list = [b2, a2, a1, b1] flat_list = [b2, a2, a1, b1]
# the two records with ids exist remotely
crawler.add_to_remote_existing_cache(a1)
crawler.add_to_remote_existing_cache(b2)
# this would result in a merge conflict before
ins, ups = crawler.split_into_inserts_and_updates(flat_list) ins, ups = crawler.split_into_inserts_and_updates(flat_list)
print(ins) print(ins)
print(ups)
assert False
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment