File size: 921 Bytes
cf08f42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pytest
from app import predict_ai_text


def test_basic_ai_detection():
    # Simple test input
    text = "This article explores the evolution of artificial intelligence in modern society."

    result = predict_ai_text(text)

    # Check it's a string and includes expected keywords
    assert isinstance(result, str)
    assert "Confidence" in result
    assert any(label in result for label in ["AI-Generated", "Human-Written"])


def test_empty_input():
    result = predict_ai_text("")
    assert isinstance(result, str)
    assert "Confidence" in result


@pytest.mark.parametrize(
    "text",
    [
        "The quick brown fox jumps over the lazy dog.",
        "As technology advances, so does our understanding of machine learning.",
        "Hello world!",
    ],
)
def test_multiple_inputs(text):
    result = predict_ai_text(text)
    assert isinstance(result, str)
    assert "Confidence" in result