def test_predict_rest_categorical(mock_post):
    filename = os.path.join(RESOURCES_PATH, "contract.json")
    args_dict = {
        "contract": filename,
        "host": "a",
        "port": 1000,
        "n_requests": 1,
        "batch_size": 1,
        "endpoint": "predict",
        "prnt": True,
        "grpc": False,
        "tensor": False,
    }
    args = Bunch(args_dict)
    run_method(args, "predict")
Example #2
0
def test_predict_rest_categorical(mock_post):
    filename = join(dirname(__file__), "resources", "contract.json")
    args_dict = {
        "contract": filename,
        "host": "a",
        "port": 1000,
        "n_requests": 1,
        "batch_size": 1,
        "endpoint": "predict",
        "prnt": True,
        "grpc": False,
        "tensor": False,
    }
    args = Bunch(args_dict)
    run_method(args, "predict")
Example #3
0
def test_predict_rest(mock_post):
    filename = join(dirname(__file__), "model-template-app", "contract.json")
    args_dict = {
        "contract": filename,
        "host": "a",
        "port": 1000,
        "n_requests": 1,
        "batch_size": 1,
        "endpoint": "predict",
        "prnt": True,
        "grpc": False,
        "tensor": True
    }
    args = Bunch(args_dict)
    run_method(args, "predict")
    print(mock_post.call_args[1])
    payload = json.loads(mock_post.call_args[1]["data"]["json"])
    assert payload["data"]["names"] == [
        "sepal_length", "sepal_width", "petal_length", "petal_width"
    ]