Ejemplo n.º 1
0
 def test_open_img_array(self):
     img_array = scipy.misc.lena()
     # given an numpy.ndarray, open_img_array should return the same inst
     self.assertEqual(id(img_array), id(analyse.open_img_array(img_array)))
     # given an path, open_img_array should return an numpy.ndarray
     with imgs.TempFile(img_array) as img_path:
         opened_array = analyse.open_img_array(img_path)
         self.assertTrue(isinstance(opened_array, np.ndarray))
Ejemplo n.º 2
0
 def test_open_img_array(self):
     img_array = scipy.misc.lena()
     # given an numpy.ndarray, open_img_array should return the same inst
     self.assertEqual(id(img_array), id(analyse.open_img_array(img_array)))
     # given an path, open_img_array should return an numpy.ndarray
     with imgs.TempFile(img_array) as img_path:
         opened_array = analyse.open_img_array(img_path)
         self.assertTrue(isinstance(opened_array, np.ndarray))
Ejemplo n.º 3
0
 def test_open_img_array_nonexistent(self):
     with self.assertRaisesRegexp(AssertionError, 'not a file'):
         analyse.open_img_array('nonexistent')
Ejemplo n.º 4
0
 def test_open_img_array_nonexistent(self):
     with self.assertRaisesRegexp(AssertionError, 'not a file'):
         analyse.open_img_array('nonexistent')