aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--test/reader/test_face.py11
2 files changed, 11 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 1cdad33..0f13151 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,8 @@ test/extractor/image/face/*.jpg
test/extractor/image/face/*.npy
test/reader/faces-ivan.jpg
test/reader/faces-noface.jpg
+test/reader/faces-dimerr.gif
+test/reader/faces-valueerr.gif
test/reader/image/testimage.nef*
test/reader/preview/testimage.nef*
diff --git a/test/reader/test_face.py b/test/reader/test_face.py
index f462853..6164143 100644
--- a/test/reader/test_face.py
+++ b/test/reader/test_face.py
@@ -31,6 +31,9 @@ class TestFaceExtract(unittest.TestCase):
fetch('https://www.bsfs.io/testdata/Quiejoore1ahxa9jahma.jpg', 'faces-noface.jpg')
# download test image w/ face
fetch('https://www.bsfs.io/testdata/ONekai7Ohphooch3aege.jpg', 'faces-ivan.jpg')
+ # download errounous images
+ fetch('https://www.bsfs.io/testdata/kie7wo7sheix7thieG2f.gif', 'faces-dimerr.gif')
+ fetch('https://www.bsfs.io/testdata/Mee1aunooneoSaexohTh.gif', 'faces-valueerr.gif')
def test_essentials(self):
# repr respects min_face_prob
@@ -185,6 +188,12 @@ class TestFaceExtract(unittest.TestCase):
# raises on missing file
self.assertRaises(errors.ReaderError, rdr,
os.path.join(os.path.dirname(__file__), 'invalid.jpg'))
+ # raises on dimensions error (pytorch RuntimeError)
+ self.assertRaises(errors.ReaderError, rdr,
+ os.path.join(os.path.dirname(__file__), 'faces-dimerr.gif'))
+ # raises on content error (ValueError)
+ self.assertRaises(errors.ReaderError, rdr,
+ os.path.join(os.path.dirname(__file__), 'faces-valueerr.gif'))
# may return empty list
self.assertListEqual(FaceExtract(min_face_prob=1)(
@@ -208,8 +217,6 @@ class TestFaceExtract(unittest.TestCase):
self.assertAlmostEqual(faces[0]['width'], 50.5, 2)
self.assertAlmostEqual(faces[0]['height'], 65.42, 2)
- # FIXME: RuntimeError
- # FIXME: ValueError
## main ##