File size: 619 Bytes
510a9b0
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from utils.evaluation import evaluate_predictions

def test_evaluate_predictions():
    y_true = ["Positive", "Negative", "Positive"]
    y_pred = ["Positive", "Negative", "Positive"]

    # Test perfect match
    report = evaluate_predictions(y_true, y_pred)
    assert report["accuracy"] == 1.0, "Accuracy should be 100% for perfect predictions"

    # Test mismatched predictions
    y_pred_mismatch = ["Negative", "Negative", "Positive"]
    report_mismatch = evaluate_predictions(y_true, y_pred_mismatch)
    assert report_mismatch["accuracy"] < 1.0, "Accuracy should be less than 100% for mismatched predictions"