Skip to content

Commit 94cc72a

Browse files
committed
disable tests broken on old system versions of numpy/scipy
1 parent 3c7798b commit 94cc72a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Tests/test_numpy.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ def test_1bit(self):
135135
img = Image.fromarray(arr * 255).convert('1')
136136
self.assertEqual(img.mode, '1')
137137
arr_back = numpy.array(img)
138-
numpy.testing.assert_array_equal(arr, arr_back)
138+
# numpy 1.8 and earlier return this as a boolean. (trusty/precise)
139+
if arr_back.dtype == numpy.bool:
140+
arr_bool = numpy.array([[1, 0, 0, 1, 0], [0, 1, 0, 0, 0]], 'bool')
141+
numpy.testing.assert_array_equal(arr_bool, arr_back)
142+
else:
143+
numpy.testing.assert_array_equal(arr, arr_back)
139144

140145
def test_save_tiff_uint16(self):
141146
# Tests that we're getting the pixel value in the right byte order.

Tests/test_scipy.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from helper import unittest, PillowTestCase
2-
2+
from distutils.version import StrictVersion
33
try:
44
import numpy as np
55
from numpy.testing import assert_equal
66

77
from scipy import misc
8+
import scipy
89
HAS_SCIPY = True
910
except ImportError:
1011
HAS_SCIPY = False
@@ -27,6 +28,11 @@ def test_imresize(self):
2728
im1 = misc.imresize(im, T(1.101))
2829
self.assertEqual(im1.shape, (11, 22))
2930

31+
# this test fails prior to scipy 0.14.0b1
32+
# https://github.com/scipy/scipy/commit/855ff1fff805fb91840cf36b7082d18565fc8352
33+
@unittest.skipIf(HAS_SCIPY and
34+
(StrictVersion(scipy.__version__) < StrictVersion('0.14.0')),
35+
"Test fails on scipy < 0.14.0")
3036
def test_imresize4(self):
3137
im = np.array([[1, 2],
3238
[3, 4]])

0 commit comments

Comments
 (0)