def test_nearly_image(self):
     """
     Broken images are passed silently.
     """
     data = self.create_image(None, None)
     trunc_data = BytesIO()
     trunc_data.write(data.read()[:-10])
     trunc_data.seek(0)
     self.assertEqual(source_generators.pil_image(data), None)
Exemple #2
0
 def test_nearly_image(self):
     """
     Broken images are passed silently.
     """
     data = self.create_image(None, None)
     trunc_data = BytesIO()
     trunc_data.write(data.read()[:-10])
     trunc_data.seek(0)
     self.assertEqual(source_generators.pil_image(data), None)
 def test_nearly_image(self):
     """
     Broken images raise an exception.
     """
     data = self.create_image(None, None)
     trunc_data = BytesIO()
     trunc_data.write(data.read()[:-10])
     trunc_data.seek(0)
     self.assertRaises(IOError, source_generators.pil_image, data)
Exemple #4
0
 def test_nearly_image(self):
     """
     Broken images raise an exception.
     """
     data = self.create_image(None, None)
     trunc_data = BytesIO()
     trunc_data.write(data.read()[:-10])
     trunc_data.seek(0)
     self.assertRaises(IOError, source_generators.pil_image, data)
 def test_nearly_image(self):
     """
     Truncated images *don't* raise an exception if they can still be read.
     """
     data = self.create_image(None, None)
     reference = source_generators.pil_image(data)
     data.seek(0)
     trunc_data = BytesIO()
     trunc_data.write(data.read()[:-10])
     trunc_data.seek(0)
     im = source_generators.pil_image(trunc_data)
     # im will be truncated, but it should be the same dimensions.
     self.assertEqual(im.size, reference.size)
 def test_nearly_image(self):
     """
     Truncated images *don't* raise an exception if they can still be read.
     """
     data = self.create_image(None, None)
     reference = source_generators.pil_image(data)
     data.seek(0)
     trunc_data = BytesIO()
     trunc_data.write(data.read()[:-10])
     trunc_data.seek(0)
     im = source_generators.pil_image(trunc_data)
     # im will be truncated, but it should be the same dimensions.
     self.assertEqual(im.size, reference.size)