updated readme, changed routes, and included some additional infrastructure

This commit is contained in:
Slater-Victoroff
2014-05-14 00:04:16 -04:00
parent 67d53d25d8
commit 97ab57fbfe
8 changed files with 73 additions and 14 deletions
+37 -1
View File
@@ -1,5 +1,9 @@
import unittest
from IndicoIo.text.sentiment import political, spam, posneg
import numpy as np
from IndicoIo import political, spam, posneg, fer, facial_features
class FullAPIRun(unittest.TestCase):
@@ -27,5 +31,37 @@ class FullAPIRun(unittest.TestCase):
self.assertTrue(isinstance(response, dict))
self.assertEqual(posneg_set, set(response.keys()))
def test_good_fer(self):
fer_set = set(['Angry', 'Sad', 'Neutral', 'Surprise', 'Fear', 'Happy'])
test_face = np.linspace(0,50,48*48).reshape(48,48).tolist()
response = fer(test_face)
self.assertTrue(isinstance(response, dict))
self.assertEqual(fer_set, set(response.keys()))
def test_bad_fer(self):
fer_set = set(['Angry', 'Sad', 'Neutral', 'Surprise', 'Fear', 'Happy'])
test_face = np.linspace(0,50,56*56).reshape(56,56).tolist()
response = fer(test_face)
self.assertTrue(isinstance(response, dict))
self.assertEqual(fer_set, set(response.keys()))
def test_good_facial_features(self):
test_face = np.linspace(0,50,48*48).reshape(48,48).tolist()
response = facial_features(test_face)
self.assertTrue(isinstance(response, list))
self.assertEqual(len(response), 48)
def test_full_facial_features(self):
features_set = set(['feature_vector', 'warnings'])
test_face = np.linspace(0,50,56*56).reshape(56,56).tolist()
response = facial_features(test_face, True)
self.assertEqual(set(response.keys()), features_set)
self.assertEqual(response['warnings'], 'Using a 48x48 array will produce the best results')
if __name__ == "__main__":
unittest.main()