Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c855310

Browse files
committed
test_compare_images: Import nose.tools at the top, instead of in a function.
1 parent 9701a43 commit c855310

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/matplotlib/tests/test_compare_images.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import print_function
22
from matplotlib.testing.compare import compare_images
33
from matplotlib.testing.decorators import _image_directories
4+
import nose.tools
45
import os
56
import shutil
67

@@ -18,8 +19,6 @@ def image_comparison_expect_rms(im1, im2, tol, expect_rms):
1819
succeed if compare_images succeeds. Otherwise, the test will succeed if
1920
compare_images fails and returns an RMS error almost equal to this value.
2021
"""
21-
from nose.tools import assert_almost_equal
22-
from nose.tools import assert_is_none, assert_is_not_none
2322
im1 = os.path.join(baseline_dir, im1)
2423
im2_src = os.path.join(baseline_dir, im2)
2524
im2 = os.path.join(result_dir, im2)
@@ -30,10 +29,10 @@ def image_comparison_expect_rms(im1, im2, tol, expect_rms):
3029
results = compare_images(im1, im2, tol=tol, in_decorator=True)
3130

3231
if expect_rms is None:
33-
assert_is_none(results)
32+
nose.tools.assert_is_none(results)
3433
else:
35-
assert_is_not_none(results)
36-
assert_almost_equal(expect_rms, results['rms'], places=4)
34+
nose.tools.assert_is_not_none(results)
35+
nose.tools.assert_almost_equal(expect_rms, results['rms'], places=4)
3736

3837
def test_image_compare_basic():
3938
"""Test comparison of an image and the same image with minor differences."""

0 commit comments

Comments
 (0)