Skip to content
Snippets Groups Projects
Commit 5294849c authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Add test for non-contiguous image saving

parent df5fffd3
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -62,6 +62,7 @@ def test_png_gray_alpha(): ...@@ -62,6 +62,7 @@ def test_png_gray_alpha():
def transcode(filename): def transcode(filename):
tmpname = test_utils.temporary_filename(suffix=os.path.splitext(filename)[1]) tmpname = test_utils.temporary_filename(suffix=os.path.splitext(filename)[1])
tmpnam_ = test_utils.temporary_filename(suffix=os.path.splitext(filename)[1])
try: try:
# complete transcoding test # complete transcoding test
...@@ -75,9 +76,22 @@ def transcode(filename): ...@@ -75,9 +76,22 @@ def transcode(filename):
assert numpy.array_equal(image, image2) assert numpy.array_equal(image, image2)
# test getting part of the image as well
if len(image.shape) == 3:
subsample = image[:,::2,::2]
else:
subsample = image[::2,::2]
assert not subsample.flags.contiguous
write(subsample, tmpnam_)
image3 = load(tmpnam_)
assert numpy.array_equal(subsample, image3)
finally: finally:
if os.path.exists(tmpname): if os.path.exists(tmpname):
os.unlink(tmpname) os.unlink(tmpname)
if os.path.exists(tmpnam_):
os.unlink(tmpnam_)
def test_netpbm(): def test_netpbm():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment