def test_get_model_metadata_method(self): """Testing get_model_metadata method.""" # arrange model_manager = ModelManager() model_manager.load_model("tests.mocks.MLModelMock") # act model_metadata = model_manager.get_model_metadata( qualified_name="qualified_name") # assert self.assertTrue(model_metadata["display_name"] == "display_name") self.assertTrue(model_metadata["qualified_name"] == "qualified_name") self.assertTrue(model_metadata["description"] == "description") self.assertTrue(model_metadata["version"] == "1.0.0") self.assertTrue(type(model_metadata["input_schema"]) is dict) self.assertTrue(type(model_metadata["output_schema"]) is dict)
def test_get_model_metadata_method_with_missing_model(self): """Testing get_model_metadata method with missing model.""" # arrange model_manager = ModelManager() model_manager.load_model("tests.mocks.MLModelMock") # act excpeption_raised = False exception_message = None try: model_metadata = model_manager.get_model_metadata( qualified_name="asdf") except Exception as e: excpeption_raised = True exception_message = str(e) # assert self.assertTrue(excpeption_raised) self.assertTrue(exception_message == "Instance of model 'asdf' not found in ModelManager.")