Esempio n. 1
0
    def test_cause(self):
        from libcellml import Issue

        # Cause cause()
        e = Issue()
        self.assertEqual(e.cause(), Issue.Cause.UNDEFINED)
        e.setCause(Issue.Cause.MATHML)
        self.assertEqual(e.cause(), Issue.Cause.MATHML)
Esempio n. 2
0
    def test_cause_enum(self):
        from libcellml import Issue

        self.assertIsInstance(Issue.Cause.COMPONENT, int)
        self.assertIsInstance(Issue.Cause.CONNECTION, int)
        self.assertIsInstance(Issue.Cause.ENCAPSULATION, int)
        self.assertIsInstance(Issue.Cause.IMPORT, int)
        self.assertIsInstance(Issue.Cause.MATHML, int)
        self.assertIsInstance(Issue.Cause.MODEL, int)
        self.assertIsInstance(Issue.Cause.UNDEFINED, int)
        self.assertIsInstance(Issue.Cause.UNITS, int)
        self.assertIsInstance(Issue.Cause.VARIABLE, int)
        self.assertIsInstance(Issue.Cause.XML, int)

        # Test conversion to enum
        e = Issue()
        e.setCause(Issue.Cause.COMPONENT)
        self.assertRaises(RuntimeError, e.setCause, Issue.Cause.COMPONENT - 1)
        self.assertRaises(RuntimeError, e.setCause, Issue.Cause.XML + 1)
Esempio n. 3
0
    def test_set_cause(self):
        from libcellml import Issue

        # void setCause(Cause cause)
        e = Issue()
        e.setCause(Issue.Cause.CONNECTION)