Spaces:
Sleeping
Sleeping
File size: 745 Bytes
ca264b8 0626826 ca264b8 0626826 ca264b8 0626826 ca264b8 0626826 ca264b8 0626826 ca264b8 7e709ed 0626826 ca264b8 0626826 ca264b8 f4e0e4a |
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 |
"""
Testing Classifier module
"""
import pytest
from classification.classifier import Classifier
@pytest.fixture
def setup_pipeline():
"""Setup classifier pipeline - training classifier and saving model"""
pipeline = Classifier()
pipeline.train_and_save()
return pipeline
@pytest.fixture
def requests():
"""Example dataset"""
return {"features": [[6.5, 3.0, 5.8, 2.2], [6.1, 2.8, 4.7, 1.2]]}
@pytest.fixture
def response():
"""Ground truth response from classifier"""
return ["virginica", "versicolor"]
def test_response(setup_pipeline, requests, response):
"""Tests if classifier returns correct prediction"""
assert response == setup_pipeline.load_and_test(requests["features"])["predictions"]
|