From 5d0ff7b2e0d1c63d9551e44ed3ffd96c695b69d9 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Tue, 25 Jul 2023 18:48:00 +0200 Subject: face reader exception tests --- test/reader/test_face.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'test') 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 ## -- cgit v1.2.3