Esempio n. 1
0
 def test_batch_content_filtering(self):
     test_data = [os.path.normpath(os.path.join(DIR, "data/48by48.png"))]
     response = content_filtering(test_data, api_key=self.api_key)
     self.assertTrue(isinstance(response, list))
     self.assertTrue(isinstance(response[0], float))
Esempio n. 2
0
 def test_resize_content_filtering(self):
     test_face = os.path.normpath(os.path.join(DIR, "data/happy.png"))
     response = content_filtering(test_face)
     self.assertTrue(isinstance(response, float))
Esempio n. 3
0
 def test_resize_content_filtering_numpy_arrays(self):
     test_image = np.random.randint(0, 255, size=(480,248, 3))
     response = content_filtering(test_image)
     self.assertTrue(isinstance(response, float))
Esempio n. 4
0
 def test_safe_content_filtering(self):
     test_face = os.path.normpath(os.path.join(DIR, "data/happy.png"))
     response = content_filtering(test_face)
     self.assertTrue(response < 0.5)
Esempio n. 5
0
 def test_safe_content_filtering(self):
     test_face = os.path.normpath(os.path.join(DIR, "data/happy.png"))
     response = content_filtering(test_face)
     self.assertTrue(response < 0.5)
Esempio n. 6
0
 def test_resize_content_filtering_numpy_arrays(self):
     np = self._require_numpy()
     test_image = np.random.randint(0, 255, size=(480, 248, 3))
     response = content_filtering(test_image)
     self.assertTrue(isinstance(response, float))
Esempio n. 7
0
 def test_resize_content_filtering(self):
     test_face = os.path.normpath(os.path.join(DIR, "data/happy.png"))
     response = content_filtering(test_face)
     self.assertTrue(isinstance(response, float))
Esempio n. 8
0
 def test_batch_content_filtering(self):
     test_data = [os.path.normpath(os.path.join(DIR, "data/48by48.png"))]
     response = content_filtering(test_data)
     self.assertTrue(isinstance(response, list))
     self.assertTrue(isinstance(response[0], float))