Beispiel #1
0
    def test_raise_not_found_issue(self):
        from libcellml import Annotator, Parser

        annotator = Annotator()
        parser = Parser()

        message = 'Could not find an item with an id of \'i_dont_exist\' in the model.'

        model = parser.parseModel(file_contents('annotator/unique_ids.cellml'))
        annotator.setModel(model)
        annotator.item('i_dont_exist')

        self.assertEqual(1, annotator.issueCount())
        self.assertEqual(message, annotator.issue(0).description())
Beispiel #2
0
    def test_raise_non_unique_issue(self):
        from libcellml import Annotator, Parser

        annotator = Annotator()
        parser = Parser()

        non_unique_message = 'The identifier \'duplicateId\' occurs 29 times in the model so a unique item cannot be located.'

        model = parser.parseModel(file_contents('annotator/duplicate_ids.cellml'))
        annotator.setModel(model)

        annotator.item('duplicateId')
        self.assertEqual(1, annotator.issueCount())
        self.assertEqual(non_unique_message, annotator.issue(0).description())