Skip to content

Commit 778309c

Browse files
committed
test prov of secondary files
1 parent c979aa1 commit 778309c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_provenance.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,29 @@ def check_prov(self, nested=False, single_tool=False, directory=False,
482482
if not files:
483483
self.assertTrue((d,RDF.type,PROV.EmptyCollection) in g)
484484
self.assertTrue((d,RDF.type,PROV.EmptyDictionary) in g)
485+
if secondary_files:
486+
derivations = set(g.subjects(RDF.type, CWLPROV.SecondaryFile))
487+
self.assertTrue(derivations)
488+
for der in derivations:
489+
sec = set(g.subjects(PROV.qualifiedDerivation, der)).pop()
490+
prim = set(g.objects(der, PROV.entity)).pop()
491+
492+
# UUID specializes a hash checksum
493+
self.assertTrue(set(g.objects(sec, PROV.specializationOf)))
494+
# extensions etc.
495+
sec_basename = set(g.objects(sec, CWLPROV.basename)).pop()
496+
sec_nameroot = set(g.objects(sec, CWLPROV.nameroot)).pop()
497+
sec_nameext = set(g.objects(sec, CWLPROV.nameext)).pop()
498+
self.assertEquals(str(sec_basename), "%s%s" % (sec_nameroot, sec_nameext))
499+
# TODO: Check hash data file exist in RO
500+
501+
# The primary entity should have the same, but different values
502+
self.assertTrue(set(g.objects(prim, PROV.specializationOf)))
503+
prim_basename = set(g.objects(prim, CWLPROV.basename)).pop()
504+
prim_nameroot = set(g.objects(prim, CWLPROV.nameroot)).pop()
505+
prim_nameext = set(g.objects(prim, CWLPROV.nameext)).pop()
506+
self.assertEquals(sec_nameroot, prim_basename)
507+
self.assertEquals(str(prim_basename), "%s%s" % (prim_nameroot, prim_nameext))
485508

486509

487510
class TestConvertPath(unittest.TestCase):

0 commit comments

Comments
 (0)