zaidmehdi commited on
Commit
9480e34
1 Parent(s): ec4a7b0

setting up test class and writing firt test of model output

Browse files
Files changed (1) hide show
  1. tests/model_tests.py +21 -1
tests/model_tests.py CHANGED
@@ -1 +1,21 @@
1
- import unittest
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import unittest
3
+
4
+
5
+ class TestClassifier(unittest.TestCase):
6
+ def setUp(self) -> None:
7
+ self.API_URL = "http://localhost:5000/classify"
8
+ self.dialects = ['Egypt', 'Iraq', 'Saudi_Arabia', 'Mauritania', 'Algeria', 'Syria',
9
+ 'Oman', 'Tunisia', 'Lebanon', 'Morocco', 'Djibouti','United_Arab_Emirates','Kuwait',
10
+ 'Libya', 'Bahrain', 'Qatar', 'Yemen', 'Palestine', 'Jordan', 'Somalia', 'Sudan']
11
+
12
+ def test_output(self):
13
+ request_data = {"text": "حاجة حلوة اكيد"}
14
+ response = requests.post(self.API_URL, json=request_data)
15
+ self.assertEqual(response.status_code, 200)
16
+ self.assertIn("class", response.json())
17
+ self.assertIn(response.json()["class"], self.dialects)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ unittest.main()