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)
def test_load(self): """Tests the image loading function.""" img = beam_image.load(self.image_file) self.assertIsInstance(img, PIL.JpegImagePlugin.JpegImageFile)
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')
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')