Code Duplication    Length = 9-10 lines in 3 locations

tests/test_formatxml.py 3 locations

@@ 134-143 (lines=10) @@
131
        self.assertHasAttributeWithValue(refEnt, 'prov:ref', entId)
132
        self.assertHasAttributeWithValue(refAct, 'prov:ref', actId)
133
134
    def test_file_with_transformation_has_wasGeneratedBy_with_time(self):
135
        from niprov.formatxml import XmlFormat
136
        form = XmlFormat(self.dependencies)
137
        aFile = self.aFile()
138
        aFile.provenance['transformation'] = 'enchantment'
139
        aFile.provenance['created'] = datetime.datetime.now()
140
        doc = self.parseDoc(form.serializeSingle(aFile))
141
        wasGen = self.assertOneChildWithTagName(doc, "prov:wasGeneratedBy")
142
        self.assertOneChildWithTagAndText(wasGen, 'prov:time', 
143
            aFile.provenance['created'].isoformat())
144
145
    def parseDoc(self, xmlString):
146
        from xml.dom.minidom import parseString
@@ 90-98 (lines=9) @@
87
        self.assertOneChildWithTagAndText(hashEl, 'nfo:hashValue', 
88
            aFile.provenance['hash'])
89
90
    def test_FileHash_id_follows_sensible_format(self):
91
        from niprov.formatxml import XmlFormat
92
        form = XmlFormat(self.dependencies)
93
        aFile = self.aFile()
94
        aFile.provenance['hash'] = 'abraca777'
95
        doc = self.parseDoc(form.serializeSingle(aFile))
96
        entity = doc.getElementsByTagName("prov:entity")[0]
97
        fileId = entity.attributes['id'].value
98
        self.assertOneChildWithTagAndText(entity, 'nfo:hasHash', fileId+'.hash')
99
100
    def test_file_with_transformation_has_activity_w_corresponding_id(self):
101
        from niprov.formatxml import XmlFormat
@@ 63-71 (lines=9) @@
60
        entity = doc.getElementsByTagName("prov:entity")[0]
61
        self.assertOneChildWithTagAndText(entity, 'nfo:fileSize', str(56789))
62
63
    def test_serialize_file_entity_has_fileLastModified_prop(self):
64
        from niprov.formatxml import XmlFormat
65
        form = XmlFormat(self.dependencies)
66
        aFile = self.aFile()
67
        aFile.provenance['created'] = datetime.datetime.now()
68
        doc = self.parseDoc(form.serializeSingle(aFile))
69
        entity = doc.getElementsByTagName("prov:entity")[0]
70
        self.assertOneChildWithTagAndText(entity, 'nfo:fileLastModified', 
71
            aFile.provenance['created'].isoformat())
72
73
    def test_serialize_file_entity_has_hash(self):
74
        from niprov.formatxml import XmlFormat