Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/test_origin_revision_layer.py
Show First 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | for synth_org in synthetic_origin_revision_result(syntheticfile): | ||||
), synth_org["snap"] | ), synth_org["snap"] | ||||
# check for O-R (head) entries | # check for O-R (head) entries | ||||
# these are added in the revision_in_origin relation | # these are added in the revision_in_origin relation | ||||
rows["revision_in_origin"] |= set( | rows["revision_in_origin"] |= set( | ||||
(x["dst"], x["src"], None) for x in synth_org["O_R"] | (x["dst"], x["src"], None) for x in synth_org["O_R"] | ||||
) | ) | ||||
assert rows["revision_in_origin"] == { | assert rows["revision_in_origin"] == { | ||||
(rel.src, rel.dst, rel.path) | (src, rel.dst, rel.path) | ||||
for rel in provenance.storage.relation_get_all(RelationType.REV_IN_ORG) | for src, rels in provenance.storage.relation_get_all( | ||||
RelationType.REV_IN_ORG | |||||
).items() | |||||
for rel in rels | |||||
}, synth_org["snap"] | }, synth_org["snap"] | ||||
# check for R-R entries | # check for R-R entries | ||||
# these are added in the revision_before_revision relation | # these are added in the revision_before_revision relation | ||||
rows["revision_before_revision"] |= set( | rows["revision_before_revision"] |= set( | ||||
(x["dst"], x["src"], None) for x in synth_org["R_R"] | (x["dst"], x["src"], None) for x in synth_org["R_R"] | ||||
) | ) | ||||
assert rows["revision_before_revision"] == { | assert rows["revision_before_revision"] == { | ||||
(rel.src, rel.dst, rel.path) | (src, rel.dst, rel.path) | ||||
for rel in provenance.storage.relation_get_all( | for src, rels in provenance.storage.relation_get_all( | ||||
RelationType.REV_BEFORE_REV | RelationType.REV_BEFORE_REV | ||||
) | ).items() | ||||
for rel in rels | |||||
}, synth_org["snap"] | }, synth_org["snap"] |