diff --git a/Tests/test_numpy.py b/Tests/test_numpy.py index 02ae5e50b..8a530ce1b 100644 --- a/Tests/test_numpy.py +++ b/Tests/test_numpy.py @@ -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. diff --git a/Tests/test_scipy.py b/Tests/test_scipy.py index 8be16c518..1f4f016d1 100644 --- a/Tests/test_scipy.py +++ b/Tests/test_scipy.py @@ -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]])