예제 #1
0
def test_model_predict_untrained(dummy_pipeline, dummy_data_single):
    """check error value for model without `trained` flag set.
    """
    df, y, yp = dummy_data_single

    with pytest.raises(ValueError) as e:
        build_prediction(dummy_pipeline, df)
    assert "untrained" in str(e.value)
예제 #2
0
def test_model_predict_missing_data(dummy_pipeline_trained, missing_data):
    """check error value for inputs with missing data.
    """
    df, y, yp = missing_data

    with pytest.raises(KeyError) as e:
        build_prediction(dummy_pipeline_trained, df)
    assert "not in index" in str(e.value)
예제 #3
0
def test_model_predict_bad_data(dummy_pipeline_logistic, bad_data):
    """check error value for malformed data.

    Requires use of real model rather than `DummyClassifier`.
    """
    df, y, yp = bad_data

    with pytest.raises(ValueError) as e:
        build_prediction(dummy_pipeline_logistic, df)
    assert "misformatted" in str(e.value)
예제 #4
0
def test_model_predict_multi(dummy_pipeline_trained, dummy_data_multi):
    """check formation for multi-sample prediction.
    """
    df, y, yp = dummy_data_multi
    pred, pred_prob = build_prediction(dummy_pipeline_trained, df)
    assert ((y == pred) & (yp == pred_prob))