Spaces:
Sleeping
Sleeping
Clement Vachet
commited on
Commit
·
0626826
1
Parent(s):
c46990d
Add test suites via pytest
Browse files- tests/__init__.py +0 -0
- tests/test_classifier.py +24 -0
tests/__init__.py
ADDED
|
File without changes
|
tests/test_classifier.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
from classification.classifier import Classifier
|
| 3 |
+
|
| 4 |
+
@pytest.fixture
|
| 5 |
+
def setup_pipeline():
|
| 6 |
+
pipeline = Classifier()
|
| 7 |
+
pipeline.train_and_save()
|
| 8 |
+
return pipeline
|
| 9 |
+
|
| 10 |
+
@pytest.fixture
|
| 11 |
+
def requests():
|
| 12 |
+
return {
|
| 13 |
+
"features": [
|
| 14 |
+
[6.5, 3.0, 5.8, 2.2],
|
| 15 |
+
[6.1, 2.8, 4.7, 1.2]
|
| 16 |
+
]
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
@pytest.fixture
|
| 20 |
+
def response():
|
| 21 |
+
return ['virginica', 'versicolor']
|
| 22 |
+
|
| 23 |
+
def test_response(setup_pipeline, requests, response):
|
| 24 |
+
assert response == setup_pipeline.load_and_test(requests)['predictions']
|