예제 #1
0
 def test_open_img(self):
     img = imgs.create_rgb()
     # given an Pillow Image, open_img should return the same instance
     self.assertEqual(id(img), id(analyse.open_img(img)))
     # given an path, open_img should return a Pillow Image instance
     with imgs.TempFile(img) as img_path:
         opened_img = analyse.open_img(img_path)
         self.assertTrue(isinstance(opened_img, Image.Image))
         self.assertEqual(list(img.getdata()), list(opened_img.getdata()))
예제 #2
0
파일: test_analyse.py 프로젝트: qll/shit
 def test_open_img(self):
     img = imgs.create_rgb()
     # given an Pillow Image, open_img should return the same instance
     self.assertEqual(id(img), id(analyse.open_img(img)))
     # given an path, open_img should return a Pillow Image instance
     with imgs.TempFile(img) as img_path:
         opened_img = analyse.open_img(img_path)
         self.assertTrue(isinstance(opened_img, Image.Image))
         self.assertEqual(list(img.getdata()), list(opened_img.getdata()))
예제 #3
0
 def test_open_img_nonexistent(self):
     with self.assertRaisesRegexp(AssertionError, 'not a file'):
         analyse.open_img('nonexistent')
예제 #4
0
파일: test_analyse.py 프로젝트: qll/shit
 def test_open_img_nonexistent(self):
     with self.assertRaisesRegexp(AssertionError, 'not a file'):
         analyse.open_img('nonexistent')