File size: 595 Bytes
1cfefea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import numpy as np
from app import predict_iris

def test_predict_iris():
    # Test with known input values and expected output
    assert predict_iris(5.1, 3.5, 1.4, 0.2) == "setosa"
    assert predict_iris(6.9, 3.1, 5.4, 2.1) == "virginica"

    # Test with out-of-range input values
    assert predict_iris(0, 0, 0, 0) == "setosa"
    assert predict_iris(10, 10, 10, 10) == "virginica"

    # Test with random input values
    assert predict_iris(5.8, 2.7, 3.9, 1.2) in ["versicolor", "virginica", "setosa"]

if __name__ == "__main__":
    test_predict_iris()
    print("All tests passed!")