Exemplo n.º 1
0
    def test_emendations_02(self):
        name = 'TC_Emendations.02 - Emendations across barlines'
        mei_file = 'dat/TC.Emendations.02.mei'
        transform_data = TransformData()
        transform_data.editorial_resp = 'ZK'
        transform_data.alternates_list = [
                ('1', VARIANT, '1', ''),
                ('2', EMENDATION, '1', 'Editor1'),
                ('3', EMENDATION, '1', 'Editor2'),
                ]
        transformed_mei_doc = TransformTestCase(name, mei_file, transform_data).Run()
        MEI_tree = transformed_mei_doc.getRootElement()
        annots = utilities.get_descendants(MEI_tree, 'annot')
        self.assertEqual(len(annots), 2)
        choices = get_descendants(MEI_tree, 'choice')
        self.assertEqual(len(choices), 8)

        idtokens = get_attribute_val(annots[0], 'plist').split(' ')
        self.assertEqual(len(idtokens), 2)
        self.assertEqual(idtokens[0], '#' + choices[0].getId())
        self.assertEqual(idtokens[1], '#' + choices[1].getId())

        idtokens = get_attribute_val(annots[1], 'plist').split(' ')
        self.assertEqual(len(idtokens), 2)
        self.assertEqual(idtokens[0], '#' + choices[2].getId())
        self.assertEqual(idtokens[1], '#' + choices[3].getId())
Exemplo n.º 2
0
 def test_variants_continuous(self):
     name = 'TC_Variants.04 - Continuos variant'
     mei_file = 'dat/TC.Variants.04.mei'
     transform_data = TransformData()
     transform_data.editorial_resp = 'ZK'
     transform_data.alternates_list = [
             ('1', VARIANT, '1', ''),
             ('2', VARIANT, '1', 'SourceA 1552/01'),
             ]
     transformed_mei_doc = TransformTestCase(name, mei_file, transform_data).Run()
     MEI_tree = transformed_mei_doc.getRootElement()
     annots = utilities.get_descendants(MEI_tree, 'annot')
     self.assertEqual(len(annots), 1)
     self.assertEqual(len(get_attribute_val(annots[0], 'plist').split(' ')), 4)