Skip to content

Commit

Permalink
test2.py: fail if a downloaded image can't be decoded
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Donchenko committed Sep 17, 2015
1 parent 293ea03 commit 56f17e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/python/test/test2.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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):
Expand Down

0 comments on commit 56f17e4

Please sign in to comment.