Spaces:
Sleeping
Sleeping
update tests for dictionary output
Browse files- tests/model_tests.py +8 -7
tests/model_tests.py
CHANGED
@@ -19,17 +19,18 @@ class TestClassifier(unittest.TestCase):
|
|
19 |
"""Test if the response of the main function is correct"""
|
20 |
text = "حاجة حلوة اكيد"
|
21 |
predictions = classify_arabic_dialect(text)
|
22 |
-
self.assertEqual(len(predictions),
|
23 |
-
for
|
24 |
-
self.assertIn(
|
25 |
-
self.assertGreaterEqual(
|
26 |
-
self.assertLessEqual(
|
27 |
|
28 |
def test_model_output(self):
|
29 |
"""Test that the model correctly classifies obvious dialects"""
|
30 |
for country, text, in self.test_set.items():
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
|
35 |
if __name__ == "__main__":
|
|
|
19 |
"""Test if the response of the main function is correct"""
|
20 |
text = "حاجة حلوة اكيد"
|
21 |
predictions = classify_arabic_dialect(text)
|
22 |
+
self.assertEqual(len(predictions), len(self.dialects))
|
23 |
+
for key, value in predictions.items():
|
24 |
+
self.assertIn(key, self.dialects)
|
25 |
+
self.assertGreaterEqual(value, 0)
|
26 |
+
self.assertLessEqual(value, 1)
|
27 |
|
28 |
def test_model_output(self):
|
29 |
"""Test that the model correctly classifies obvious dialects"""
|
30 |
for country, text, in self.test_set.items():
|
31 |
+
predictions = classify_arabic_dialect(text)
|
32 |
+
label = max(predictions, key=predictions.get)
|
33 |
+
self.assertEqual(label, country)
|
34 |
|
35 |
|
36 |
if __name__ == "__main__":
|