File size: 643 Bytes
6a63889
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from fastapi.testclient import TestClient
from main import app
import pandas as pd


client = TestClient(app)


def test_home():
    """Test home page."""
    response = client.get("/")
    assert response.status_code == 200


def test_predict():
    """Test predict method on an example video."""
    TEST_VIDEO_ID = "0peXnOnDgQ8"
    response = client.get(
        "/predict/",
        params={"video_id": TEST_VIDEO_ID}
    )
    df = pd.read_json(response, orient='records')

    # Ensure the DataFrame has the right amount of columns
    assert df.shape[1] == 39
    # Ensure there are no NaN values
    assert df.isna().sum().sum() == 0