mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-28 04:07:14 +08:00
Modified test with a less stringent condition on numerical value for the
mean value of blobs image.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import numpy as np
|
||||
import skimage.data as data
|
||||
from numpy.testing import assert_equal
|
||||
from numpy.testing import assert_equal, assert_almost_equal
|
||||
|
||||
|
||||
def test_lena():
|
||||
@@ -58,11 +58,11 @@ def test_coffee():
|
||||
|
||||
def test_binary_blobs():
|
||||
blobs = data.binary_blobs(length=128)
|
||||
assert blobs.mean() == 0.5
|
||||
assert_almost_equal(blobs.mean(), 0.5, decimal=4)
|
||||
blobs = data.binary_blobs(length=128, volume_fraction=0.25)
|
||||
assert blobs.mean() == 0.25
|
||||
assert_almost_equal(blobs.mean(), 0.25, decimal=4)
|
||||
blobs = data.binary_blobs(length=32, volume_fraction=0.25, n_dim=3)
|
||||
assert blobs.mean() == 0.25
|
||||
assert_almost_equal(blobs.mean(), 0.25, decimal=4)
|
||||
other_realization = data.binary_blobs(length=32, volume_fraction=0.25,
|
||||
n_dim=3)
|
||||
assert not np.all(blobs == other_realization)
|
||||
|
||||
Reference in New Issue
Block a user