TST: only test sum_labels on SciPy >= 1.6
@@ -11,10 +11,17 @@ from cupy._core import _accelerator
import cupyx.scipy.ndimage # NOQA
try:
+ import scipy
import scipy.ndimage # NOQA
+ scipy_version = numpy.lib.NumpyVersion(scipy.__version__)
except ImportError:
pass
+stats_ops = ['sum', 'mean', 'variance', 'standard_deviation', 'center_of_mass']
+if scipy_version >= '1.6.0':
+ # 'scipy 1.6 added a copy of sum under the name sum_labels'
+ stats_ops += ['sum_labels']
+
def _generate_binary_structure(rank, connectivity):
if connectivity < 1:
@@ -105,8 +112,7 @@ class TestLabelSpecialCases:
@testing.gpu
@testing.parameterize(*testing.product({
- 'op': ['sum', 'sum_labels', 'mean', 'variance', 'standard_deviation',
- 'center_of_mass'],
+ 'op': stats_ops,
}))
@testing.with_requires('scipy')
class TestStats:
