def test_inheritance(self): import libcellml from libcellml import Validator # Test inheritance x = Validator() self.assertIsInstance(x, libcellml.Logger) # Test access to inherited methods self.assertIsNone(x.getError(0)) self.assertIsNone(x.getError(-1)) self.assertEqual(x.errorCount(), 0) x.addError(libcellml.Error()) self.assertEqual(x.errorCount(), 1)
print(" Printing the parsed model ") print("-----------------------------------------------") print_model_to_terminal(model) # --------------------------------------------------------------------------- # STEP 3: Check that the model meets the CellML2.0 specifications using the Validator # # 2.a Create a Validator and pass the model into it print("-----------------------------------------------") print(" Validating the parsed model") print("-----------------------------------------------") validator = Validator() validator.validateModel(model) # 2.b Check whether there were errors returned from the validator number_of_validation_errors = validator.errorCount() if number_of_validation_errors != 0: print("The validator has found {n} errors!".format( n=number_of_validation_errors)) # 2.c Retrieve the errors, and print their description and specification reference to the terminal for e in range(0, number_of_validation_errors): validator_error = validator.error(e) specification_heading = validator_error.specificationHeading() print(" Validator error[{e}]: ".format(e=e)) print(" Description: " + validator_error.description()) if specification_heading != "":