From 1cb73c79d65fb3f093b92321fed741eea190b93e Mon Sep 17 00:00:00 2001 From: Adam Feuer Date: Sun, 3 Aug 2014 10:46:06 -0700 Subject: [PATCH] improved name of pil import/export functions - to make it clear what the functions actually do: ndarray_to_pil() and pil_to_ndarray() - as per code review feedback - updated tests to use the new function names - incoming change to pil_plugin assumed PIL Image objects will always be from files; this is not always true anymore. Now pil_plugin checks to see if the Image came from a file before trying to close its associated file. --- skimage/io/tests/test_pil.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/skimage/io/tests/test_pil.py b/skimage/io/tests/test_pil.py index e5e7647c..5cd36f92 100644 --- a/skimage/io/tests/test_pil.py +++ b/skimage/io/tests/test_pil.py @@ -14,7 +14,7 @@ from six import BytesIO try: from PIL import Image - from skimage.io._plugins.pil_plugin import imimport, imexport, _palette_is_grayscale + from skimage.io._plugins.pil_plugin import pil_to_ndarray, ndarray_to_pil, _palette_is_grayscale use_plugin('pil') except ImportError: PIL_available = False @@ -122,8 +122,8 @@ class TestSave: return y def roundtrip_pil_image(self, x): - pil_image = imexport(x) - y = imimport(pil_image) + pil_image = ndarray_to_pil(x) + y = pil_to_ndarray(pil_image) return y def verify_roundtrip(self, dtype, x, y, scaling=1): @@ -169,8 +169,8 @@ def test_imsave_filelike(): def test_imexport_imimport(): shape = (2, 2) image = np.zeros(shape) - pil_image = imexport(image) - out = imimport(pil_image) + pil_image = ndarray_to_pil(image) + out = pil_to_ndarray(pil_image) assert out.shape == shape