mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-29 06:09:25 +08:00
BUG: Allow test suite to pass with scipy < 0.9.
This commit is contained in:
@@ -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)]
|
||||
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user