Spaces:
Sleeping
Sleeping
update tests to receive 3 predictions and their probabilities
Browse files- tests/model_tests.py +9 -4
tests/model_tests.py
CHANGED
@@ -18,14 +18,19 @@ class TestClassifier(unittest.TestCase):
|
|
18 |
def test_response(self):
|
19 |
"""Test if the response of the main function is correct"""
|
20 |
text = "حاجة حلوة اكيد"
|
21 |
-
|
22 |
-
self.
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
def test_model_output(self):
|
25 |
"""Test that the model correctly classifies obvious dialects"""
|
26 |
for country, text, in self.test_set.items():
|
27 |
-
|
28 |
-
self.assertEqual(
|
29 |
|
30 |
|
31 |
if __name__ == "__main__":
|
|
|
18 |
def test_response(self):
|
19 |
"""Test if the response of the main function is correct"""
|
20 |
text = "حاجة حلوة اكيد"
|
21 |
+
predictions, probabilities = classify_arabic_dialect(text)
|
22 |
+
self.assertEqual(len(predictions), 3)
|
23 |
+
self.assertEqual(len(probabilities), 3)
|
24 |
+
for i in range(3):
|
25 |
+
self.assertIn(predictions[i], self.dialects)
|
26 |
+
self.assertGreaterEqual(probabilities[i], 0)
|
27 |
+
self.assertLessEqual(probabilities[i], 1)
|
28 |
|
29 |
def test_model_output(self):
|
30 |
"""Test that the model correctly classifies obvious dialects"""
|
31 |
for country, text, in self.test_set.items():
|
32 |
+
predictions, _ = classify_arabic_dialect(text)
|
33 |
+
self.assertEqual(predictions[0], country)
|
34 |
|
35 |
|
36 |
if __name__ == "__main__":
|