Ejemplo n.º 1
0
    def test_get_kind(self):
        from libcellml import Error

        # Kind getKind()
        e = Error()
        self.assertEqual(e.getKind(), Error.Kind.UNDEFINED)
        e.setKind(Error.Kind.MATHML)
        self.assertEqual(e.getKind(), Error.Kind.MATHML)
Ejemplo n.º 2
0
    def test_get_error(self):
        from libcellml import Logger, Error

        # ErrorPtr getError(size_t index)
        x = Logger()
        self.assertIsNone(x.getError(0))
        self.assertIsNone(x.getError(1))
        self.assertIsNone(x.getError(-1))
        e = Error()
        e.setKind(Error.Kind.MODEL)
        x.addError(e)
        self.assertIsNotNone(x.getError(0))
        self.assertIsNone(x.getError(1))
        self.assertEqual(x.getError(0).getKind(), Error.Kind.MODEL)
Ejemplo n.º 3
0
    def test_kind_enum(self):
        from libcellml import Error

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

        # Test conversion to enum
        e = Error()
        e.setKind(Error.Kind.COMPONENT)
        self.assertRaises(RuntimeError, e.setKind, Error.Kind.COMPONENT - 1)
        self.assertRaises(RuntimeError, e.setKind, Error.Kind.XML + 1)
Ejemplo n.º 4
0
    def test_set_kind(self):
        from libcellml import Error

        # void setKind(Kind kind)
        e = Error()
        e.setKind(Error.Kind.CONNECTION)