Create test/
Browse files
test
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tests/test_model.py
|
| 2 |
+
import pytest
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
|
| 5 |
+
class TestOrcaleSeek:
|
| 6 |
+
def setup_method(self):
|
| 7 |
+
self.classifier = pipeline(
|
| 8 |
+
"text-classification",
|
| 9 |
+
model="your-username/OrcaleSeek"
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
def test_basic_prediction(self):
|
| 13 |
+
result = self.classifier("This is great!")
|
| 14 |
+
assert isinstance(result, list)
|
| 15 |
+
assert 'label' in result[0]
|
| 16 |
+
assert 'score' in result[0]
|
| 17 |
+
|
| 18 |
+
def test_batch_prediction(self):
|
| 19 |
+
texts = ["First text", "Second text"]
|
| 20 |
+
results = self.classifier(texts)
|
| 21 |
+
assert len(results) == 2
|
| 22 |
+
|
| 23 |
+
def test_edge_cases(self):
|
| 24 |
+
# Test empty string
|
| 25 |
+
result = self.classifier("")
|
| 26 |
+
assert result is not None
|
| 27 |
+
|
| 28 |
+
# Test very long string
|
| 29 |
+
long_text = "word " * 1000
|
| 30 |
+
result = self.classifier(long_text)
|
| 31 |
+
assert result is not None
|