More realistic testing

This commit is contained in:
Madison May
2014-10-29 17:02:09 -04:00
parent a76c014c7b
commit bb9bef2cc3
2 changed files with 24 additions and 0 deletions
+12
View File
@@ -15,6 +15,12 @@ class FullAPIRun(unittest.TestCase):
self.assertTrue(isinstance(response, dict))
self.assertEqual(political_set, set(response.keys()))
test_string = "Save the whales"
response = political(test_string)
self.assertTrue(isinstance(response, dict))
assert response['Green'] > 0.5
def test_posneg(self):
test_string = "Worst song ever."
response = sentiment(test_string)
@@ -22,6 +28,11 @@ class FullAPIRun(unittest.TestCase):
self.assertTrue(isinstance(response, float))
self.assertTrue(response < 0.5)
test_string = "Best song ever."
response = sentiment(test_string)
self.assertTrue(isinstance(response, float))
self.assertTrue(response > 0.5)
def test_good_fer(self):
fer_set = set(['Angry', 'Sad', 'Neutral', 'Surprise', 'Fear', 'Happy'])
test_face = np.random.rand(48,48).tolist()
@@ -98,6 +109,7 @@ class FullAPIRun(unittest.TestCase):
])
language_dict = language('clearly an english sentence')
self.assertEqual(language_set, set(language_dict.keys()))
assert language_dict['English'] > 0.25
if __name__ == "__main__":
+12
View File
@@ -15,6 +15,12 @@ class FullAPIRun(unittest.TestCase):
self.assertTrue(isinstance(response, dict))
self.assertEqual(political_set, set(response.keys()))
test_string = "Save the whales"
response = political(test_string)
self.assertTrue(isinstance(response, dict))
assert response['Green'] > 0.5
def test_posneg(self):
test_string = "Worst song ever."
response = sentiment(test_string)
@@ -22,6 +28,11 @@ class FullAPIRun(unittest.TestCase):
self.assertTrue(isinstance(response, float))
self.assertTrue(response < 0.5)
test_string = "Best song ever."
response = sentiment(test_string)
self.assertTrue(isinstance(response, float))
self.assertTrue(response > 0.5)
def test_good_fer(self):
fer_set = set(['Angry', 'Sad', 'Neutral', 'Surprise', 'Fear', 'Happy'])
test_face = np.random.rand(48,48).tolist()
@@ -98,6 +109,7 @@ class FullAPIRun(unittest.TestCase):
])
language_dict = language('clearly an english sentence')
self.assertEqual(language_set, set(language_dict.keys()))
assert language_dict['English'] > 0.25
if __name__ == "__main__":