BUG: Allow test suite to pass with scipy < 0.9.

This commit is contained in:
Stefan van der Walt
2011-10-28 14:56:41 -07:00
parent 2191d29611
commit 33469fa69e
2 changed files with 15 additions and 2 deletions
+6 -1
View File
@@ -1,7 +1,6 @@
__all__ = ['convex_hull']
import numpy as np
from scipy.spatial import Delaunay
from ._pnpoly import points_inside_poly, grid_points_inside_poly
from ._convex_hull import possible_hull
@@ -44,6 +43,12 @@ def convex_hull(image):
coords = coords_corners
try:
from scipy.spatial import Delaunay
except ImportError:
raise ImportError('Could not import scipy.spatial, only available in '
'scipy >= 0.9.')
# Find the convex hull
chull = Delaunay(coords).convex_hull
v = coords[np.unique(chull)]
+9 -1
View File
@@ -1,8 +1,16 @@
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing.decorators import skipif
from skimage.morphology import convex_hull
from skimage.morphology._convex_hull import possible_hull
try:
import scipy.spatial
scipy_spatial = True
except ImportError:
scipy_spatial = False
@skipif(not scipy_spatial)
def test_basic():
image = np.array(
[[0, 0, 0, 0, 0, 0, 0, 0, 0],
@@ -22,7 +30,7 @@ def test_basic():
assert_array_equal(convex_hull(image), expected)
@skipif(not scipy_spatial)
def test_possible_hull():
image = np.array(
[[0, 0, 0, 0, 0, 0, 0, 0, 0],