コード例 #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')