From 0a4fcdad0a46387cb5c6324dd82034d978c6e613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Thu, 20 Jun 2013 22:46:37 +0200 Subject: [PATCH] fix imports --- skimage/color/tests/test_colorconv.py | 33 +++++++++++++++------------ skimage/feature/tests/test_hog.py | 10 +++++++- skimage/graph/tests/test_heap.py | 3 +-- skimage/graph/tests/test_mcp.py | 5 +++- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/skimage/color/tests/test_colorconv.py b/skimage/color/tests/test_colorconv.py index 7f1d7c73..05ab6915 100644 --- a/skimage/color/tests/test_colorconv.py +++ b/skimage/color/tests/test_colorconv.py @@ -14,23 +14,27 @@ Authors import os.path import numpy as np -from numpy.testing import * +from numpy.testing import (assert_equal, + assert_almost_equal, + assert_array_almost_equal, + assert_raises, + TestCase, + ) from skimage import img_as_float, img_as_ubyte from skimage.io import imread -from skimage.color import ( - rgb2hsv, hsv2rgb, - rgb2xyz, xyz2rgb, - rgb2hed, hed2rgb, - separate_stains, - combine_stains, - rgb2rgbcie, rgbcie2rgb, - convert_colorspace, - rgb2grey, gray2rgb, - xyz2lab, lab2xyz, - lab2rgb, rgb2lab, - is_rgb, is_gray - ) +from skimage.color import (rgb2hsv, hsv2rgb, + rgb2xyz, xyz2rgb, + rgb2hed, hed2rgb, + separate_stains, + combine_stains, + rgb2rgbcie, rgbcie2rgb, + convert_colorspace, + rgb2grey, gray2rgb, + xyz2lab, lab2xyz, + lab2rgb, rgb2lab, + is_rgb, is_gray + ) from skimage import data_dir, data @@ -267,4 +271,5 @@ def test_is_rgb(): if __name__ == "__main__": + from numpy.testing import run_module_suite run_module_suite() diff --git a/skimage/feature/tests/test_hog.py b/skimage/feature/tests/test_hog.py index cfef2da0..b37513a5 100644 --- a/skimage/feature/tests/test_hog.py +++ b/skimage/feature/tests/test_hog.py @@ -4,7 +4,10 @@ from skimage import data from skimage import feature from skimage import img_as_float from skimage import draw -from numpy.testing import * +from numpy.testing import (assert_raises, + assert_almost_equal, + ) + def test_histogram_of_oriented_gradients(): img = img_as_float(data.lena()[:256, :].mean(axis=2)) @@ -14,16 +17,19 @@ def test_histogram_of_oriented_gradients(): assert len(fd) == 9 * (256 // 8) * (512 // 8) + def test_hog_image_size_cell_size_mismatch(): image = data.camera()[:150, :200] fd = feature.hog(image, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(1, 1)) assert len(fd) == 9 * (150 // 8) * (200 // 8) + def test_hog_color_image_unsupported_error(): image = np.zeros((20, 20, 3)) assert_raises(ValueError, feature.hog, image) + def test_hog_basic_orientations_and_data_types(): # scenario: # 1) create image (with float values) where upper half is filled by zeros, bottom half by 100 @@ -90,6 +96,7 @@ def test_hog_basic_orientations_and_data_types(): assert_almost_equal(actual, desired, decimal=2) + def test_hog_orientations_circle(): # scenario: # 1) create image with blurred circle in the middle @@ -129,6 +136,7 @@ def test_hog_orientations_circle(): desired = np.mean(hog_matrix) assert_almost_equal(actual, desired, decimal=1) + if __name__ == '__main__': from numpy.testing import run_module_suite run_module_suite() diff --git a/skimage/graph/tests/test_heap.py b/skimage/graph/tests/test_heap.py index 8322fd4e..cf7e3d0b 100644 --- a/skimage/graph/tests/test_heap.py +++ b/skimage/graph/tests/test_heap.py @@ -1,5 +1,3 @@ -from numpy.testing import * - import time import random import skimage.graph.heap as heap @@ -49,4 +47,5 @@ def _test_heap(n, fast_update): return t1 - t0 if __name__ == "__main__": + from numpy.testing import run_module_suite run_module_suite() diff --git a/skimage/graph/tests/test_mcp.py b/skimage/graph/tests/test_mcp.py index e3fd45a0..8712c0e9 100644 --- a/skimage/graph/tests/test_mcp.py +++ b/skimage/graph/tests/test_mcp.py @@ -1,5 +1,8 @@ import numpy as np -from numpy.testing import * +from numpy.testing import (assert_array_equal, + assert_almost_equal, + ) + import skimage.graph.mcp as mcp