mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-15 11:25:53 +08:00
Add assert_greater compatibility function.
Fix tests to work with nose < 1.1.3. Compatibility functions borrowed from scikit-learn.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""Testing utilities."""
|
||||
|
||||
# Copyright (c) 2011 Pietro Berkes
|
||||
# License: Simplified BSD
|
||||
|
||||
def _assert_less(a, b, msg=None):
|
||||
message = "%r is not lower than %r" % (a, b)
|
||||
if msg is not None:
|
||||
message += ": " + msg
|
||||
assert a < b, message
|
||||
|
||||
|
||||
def _assert_greater(a, b, msg=None):
|
||||
message = "%r is not greater than %r" % (a, b)
|
||||
if msg is not None:
|
||||
message += ": " + msg
|
||||
assert a > b, message
|
||||
|
||||
|
||||
try:
|
||||
from nose.tools import assert_less
|
||||
except ImportError:
|
||||
assert_less = _assert_less
|
||||
|
||||
try:
|
||||
from nose.tools import assert_greater
|
||||
except ImportError:
|
||||
assert_greater = _assert_greater
|
||||
@@ -1,6 +1,6 @@
|
||||
import numpy as np
|
||||
from numpy.testing import assert_equal, assert_array_equal
|
||||
from nose.tools import assert_greater
|
||||
from skimage._shared.testing import assert_greater
|
||||
from skimage.segmentation import felzenszwalb
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import numpy as np
|
||||
from numpy.testing import assert_equal, assert_array_equal
|
||||
from nose.tools import assert_true, assert_greater
|
||||
from nose.tools import assert_true
|
||||
from skimage._shared.testing import assert_greater
|
||||
from skimage.segmentation import quickshift
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user