def test_train_model_no_test(gm, ms, imp, config, caplog): with caplog.at_level(logging.DEBUG): _, metrics = ma.train_model(config, cache=False, test=False) assert metrics == {} assert "training".lower() in caplog.text.lower() ms_instance = ms.return_value ms_instance.dump_trained_model.assert_called_once()
def test_train_model_no_persist(gm, ms, imp, config): model, _ = ma.train_model(config, cache=False, persist=False) ms_instance = ms.return_value ms_instance.dump_trained_model.assert_not_called()
def test_train_model(gm, ms, imp, config): ma.train_model(config, cache=False) ms_instance = ms.return_value ms_instance.dump_trained_model.assert_called_once()
def test_train_model_renamed(gm, ms, imp, config, caplog): with caplog.at_level(logging.DEBUG): ma.train_model(config, cache=False) assert "renamed".lower() in caplog.text.lower()
def test_train_model_not_found(gm, ms, imp, config, caplog): with caplog.at_level(logging.DEBUG): ma.train_model(config, cache=False) assert "No old model".lower() in caplog.text.lower()
def test_train_model_own_model(gm, ms, imp, config): model, _ = ma.train_model(config, cache=False, model=mock.Mock()) gm.assert_not_called()