예제 #1
0
def test_load_and_run_prediction_multi():

    model = smartreply.SmartReplyRuntime()
    preds = model.predictMultiple(["hi how are you", "I am hungry"])

    assert(len(preds) == 2)
    for pred in preds:
        assert(len(pred) != 0)
예제 #2
0
def test_exception_invalid_input():

    model = smartreply.SmartReplyRuntime()
    
    with pytest.raises(smartreply.InvalidInputException):
        model.predict(1022)
    
    with pytest.raises(smartreply.InvalidInputException):
        model.predictMultiple(["hello", "hi", 122, "doing good"])
예제 #3
0
def test_load_default_model():
    #should load the default model automatically
    model = smartreply.SmartReplyRuntime()
예제 #4
0
def test_string_with_punctuation():

    model = smartreply.SmartReplyRuntime()
    pred = model.predict("Hi!! How are you???")
    
    assert(len(pred) != 0)
예제 #5
0
def test_load_and_run_prediction():

    model = smartreply.SmartReplyRuntime()
    preds = model.predict(text = "I am good")

    assert(len(preds) != 0)
예제 #6
0
def test_exception_on_improper_model():

    with pytest.raises(smartreply.ModelLoadFailedException):
        model = smartreply.SmartReplyRuntime(model_file = "tests/fake_model")
예제 #7
0
def test_exception_on_unknwon_model():

    with pytest.raises(smartreply.ModelNotFoundException):
        model = smartreply.SmartReplyRuntime(model_file = "unknown_model.tflite")