[opencv] 01/19: test2.py: fail if a downloaded image can't be decoded

Mattia Rizzolo mattia at debian.org
Tue Oct 4 17:51:09 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 2.4.12.3
in repository opencv.

commit 7d28541bbeed68647d0294a829f3d8dc9253cf2c
Author: Roman Donchenko <roman.donchenko at itseez.com>
Date:   Thu Sep 17 18:17:06 2015 +0300

    test2.py: fail if a downloaded image can't be decoded
    
    (cherry picked from commit 56f17e4921a379317a0602d92d7ca3677cabe9d6)
---
 modules/python/test/test2.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/python/test/test2.py b/modules/python/test/test2.py
index 9126160..d0912cd 100644
--- a/modules/python/test/test2.py
+++ b/modules/python/test/test2.py
@@ -22,7 +22,9 @@ class NewOpenCVTests(unittest.TestCase):
     def get_sample(self, filename, iscolor = cv.CV_LOAD_IMAGE_COLOR):
         if not filename in self.image_cache:
             filedata = urllib.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read()
-            self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
+            image = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
+            self.assertFalse(image is None)
+            self.image_cache[filename] = image
         return self.image_cache[filename]
 
     def setUp(self):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list