示例#1
0
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)
示例#2
0
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)
示例#3
0
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)
示例#4
0
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"
示例#5
0
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
示例#6
0
def test_parse_model_steps(dummy_pipeline):
    """ensure we can get pipeline steps.
    """
    model = parse_model(dummy_pipeline)
    assert model.get('steps') == ["Mapper", "Classifier"]
示例#7
0
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"}
示例#8
0
def test_parse_model(dummy_pipeline):
    """ensure we can parse names/attributes from model pipeline.
    """
    assert parse_model(dummy_pipeline) is not None