Exemplo n.º 1
0
 def test_base64_encode(self):
     """Tests encode function."""
     img = beam_image.load(self.image_file)
     enc = beam_image.encode(img)
     decode = base64.b64decode(enc, altchars=beam_image.BASE64_ALTCHARS)
     self.assertEqual(img.tobytes(), decode)
Exemplo n.º 2
0
 def test_load(self):
     """Tests the image loading function."""
     img = beam_image.load(self.image_file)
     self.assertIsInstance(img, PIL.JpegImagePlugin.JpegImageFile)
Exemplo n.º 3
0
 def test_file_not_found_load(self):
     """Test loading an image that doesn't exist."""
     with self.assertRaises(OSError):
         _ = beam_image.load('tfrecorder/test_data/images/cat/food.jpg')
Exemplo n.º 4
0
 def test_file_not_found_load(self):
     """Test loading an image that doesn't exist."""
     with self.assertRaises(OSError):
         _ = beam_image.load('/some/image/dir/food.jpg')