def test_parse_model_missing_model(bad_pipeline_no_model): """check error value for missing model. """ with pytest.raises(ValueError) as e: parse_model(bad_pipeline_no_model) assert "Estimator" in str(e.value)
def test_parse_model_no_pipeline(): """check error value for missing pipeline. """ with pytest.raises(TypeError) as e: parse_model(None) assert "Pipeline" in str(e.value)
def test_parse_model_missing_mapper(bad_pipeline_no_mapper): """check error value for missing `DataFrameMapper`. """ with pytest.raises(ValueError) as e: parse_model(bad_pipeline_no_mapper) assert "DataFrameMapper" in str(e.value)
def test_parse_model_model(dummy_pipeline): """ensure we can get a model class from the pipeline. """ model = parse_model(dummy_pipeline) assert model.get("model") == "DummyClassifier"
def test_parse_model_timestamp(patch_datetime, dummy_time, dummy_pipeline): """ensure we can get an upload timestamp. """ model = parse_model(dummy_pipeline) assert model.get('uploaded') == dummy_time
def test_parse_model_steps(dummy_pipeline): """ensure we can get pipeline steps. """ model = parse_model(dummy_pipeline) assert model.get('steps') == ["Mapper", "Classifier"]
def test_parse_model_args(dummy_pipeline): """ensure we can get the flattened args from the pipeline. """ model = parse_model(dummy_pipeline) assert set(model.get('args')) == {"X", "Y"}
def test_parse_model(dummy_pipeline): """ensure we can parse names/attributes from model pipeline. """ assert parse_model(dummy_pipeline) is not None