mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-25 13:30:51 +08:00
Fix test cases
This commit is contained in:
@@ -3,8 +3,7 @@ from numpy.testing import assert_array_equal, assert_raises
|
||||
from skimage import data
|
||||
from skimage import transform as tf
|
||||
from skimage.color import rgb2gray
|
||||
from skimage.feature import (BRIEF, match_binary_descriptors,
|
||||
corner_peaks, corner_harris)
|
||||
from skimage.feature import BRIEF, corner_peaks, corner_harris
|
||||
|
||||
|
||||
def test_color_image_unsupported_error():
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
import numpy as np
|
||||
from numpy.testing import assert_array_equal
|
||||
from skimage.feature.util import pairwise_hamming_distance
|
||||
|
||||
|
||||
def test_pairwise_hamming_distance_range():
|
||||
"""Values of all the pairwise hamming distances should be in the range
|
||||
[0, 1]."""
|
||||
a = np.random.random_sample((10, 50)) > 0.5
|
||||
b = np.random.random_sample((20, 50)) > 0.5
|
||||
dist = pairwise_hamming_distance(a, b)
|
||||
assert np.all((0 <= dist) & (dist <= 1))
|
||||
|
||||
|
||||
def test_pairwise_hamming_distance_value():
|
||||
"""The result of pairwise_hamming_distance of two fixed sets of boolean
|
||||
vectors should be same as expected."""
|
||||
np.random.seed(10)
|
||||
a = np.random.random_sample((4, 100)) > 0.5
|
||||
np.random.seed(20)
|
||||
b = np.random.random_sample((3, 100)) > 0.5
|
||||
result = pairwise_hamming_distance(a, b)
|
||||
expected = np.array([[0.5 , 0.49, 0.44],
|
||||
[0.44, 0.53, 0.52],
|
||||
[0.4 , 0.55, 0.5 ],
|
||||
[0.47, 0.48, 0.57]])
|
||||
assert_array_equal(result, expected)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user