Skip to content

Commit afaf070

Browse files
Add more tests.
1 parent 89adfff commit afaf070

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

stage5.2_first_application/pycasa/model/tests/test_image_file.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,18 @@ def test_image_metadata(self):
3838
expected_shape = (img.metadata['ExifImageHeight'],
3939
img.metadata['ExifImageWidth'], 3)
4040
self.assertEqual(data.shape, expected_shape)
41+
42+
def test_image_data(self):
43+
img = ImageFile(filepath=SAMPLE_IMG1)
44+
self.assertNotIn(0, img.data.shape)
45+
np.testing.assert_almost_equal(img.data, img.to_array())
46+
self.assertIsInstance(img.data, np.ndarray)
47+
self.assertNotEqual(img.data.mean(), 0)
48+
49+
def test_face_detection(self):
50+
img = ImageFile(filepath=SAMPLE_IMG1)
51+
faces = img.detect_faces()
52+
self.assertIsInstance(faces, list)
53+
for face in faces:
54+
self.assertIsInstance(face, dict)
55+
self.assertEqual(len(faces), 5)

0 commit comments

Comments
 (0)