disable tests broken on old system versions of numpy/scipy

This commit is contained in:
Eric Soroos 2017-01-20 07:50:51 -08:00
parent 3c7798bc7b
commit 94cc72a2ba
2 changed files with 13 additions and 2 deletions

View File

@ -135,7 +135,12 @@ class TestNumpy(PillowTestCase):
img = Image.fromarray(arr * 255).convert('1')
self.assertEqual(img.mode, '1')
arr_back = numpy.array(img)
numpy.testing.assert_array_equal(arr, arr_back)
# numpy 1.8 and earlier return this as a boolean. (trusty/precise)
if arr_back.dtype == numpy.bool:
arr_bool = numpy.array([[1, 0, 0, 1, 0], [0, 1, 0, 0, 0]], 'bool')
numpy.testing.assert_array_equal(arr_bool, arr_back)
else:
numpy.testing.assert_array_equal(arr, arr_back)
def test_save_tiff_uint16(self):
# Tests that we're getting the pixel value in the right byte order.

View File

@ -1,10 +1,11 @@
from helper import unittest, PillowTestCase
from distutils.version import StrictVersion
try:
import numpy as np
from numpy.testing import assert_equal
from scipy import misc
import scipy
HAS_SCIPY = True
except ImportError:
HAS_SCIPY = False
@ -27,6 +28,11 @@ class Test_scipy_resize(PillowTestCase):
im1 = misc.imresize(im, T(1.101))
self.assertEqual(im1.shape, (11, 22))
# this test fails prior to scipy 0.14.0b1
# https://github.com/scipy/scipy/commit/855ff1fff805fb91840cf36b7082d18565fc8352
@unittest.skipIf(HAS_SCIPY and
(StrictVersion(scipy.__version__) < StrictVersion('0.14.0')),
"Test fails on scipy < 0.14.0")
def test_imresize4(self):
im = np.array([[1, 2],
[3, 4]])