Skip to content
Snippets Groups Projects
Commit 12929415 authored by Christoph Groth's avatar Christoph Groth
Browse files

get rid of side effect in test

parent f2ba3eb2
No related branches found
No related tags found
No related merge requests found
...@@ -151,7 +151,7 @@ def test_map(): ...@@ -151,7 +151,7 @@ def test_map():
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.simplefilter("ignore") warnings.simplefilter("ignore")
plotter.map(sys.finalized(), xrange(len(sys.sites())), plotter.map(sys.finalized(), xrange(len(sys.sites())),
file=out) file=out)
nose.tools.assert_raises(ValueError, plotter.map, sys, nose.tools.assert_raises(ValueError, plotter.map, sys,
xrange(len(sys.sites())), file=out) xrange(len(sys.sites())), file=out)
...@@ -160,7 +160,6 @@ def test_mask_interpolate(): ...@@ -160,7 +160,6 @@ def test_mask_interpolate():
# A coordinate array with coordinates of two points almost coinciding. # A coordinate array with coordinates of two points almost coinciding.
coords = np.array([[0, 0], [1e-7, 1e-7], [1, 1], [1, 0]]) coords = np.array([[0, 0], [1e-7, 1e-7], [1, 1], [1, 0]])
warnings.simplefilter("ignore")
with warnings.catch_warnings(record=True) as w: with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always") warnings.simplefilter("always")
plotter.mask_interpolate(coords, np.ones(len(coords)), a=1) plotter.mask_interpolate(coords, np.ones(len(coords)), a=1)
...@@ -168,7 +167,9 @@ def test_mask_interpolate(): ...@@ -168,7 +167,9 @@ def test_mask_interpolate():
assert issubclass(w[-1].category, RuntimeWarning) assert issubclass(w[-1].category, RuntimeWarning)
assert "coinciding" in str(w[-1].message) assert "coinciding" in str(w[-1].message)
assert_raises(ValueError, plotter.mask_interpolate, with warnings.catch_warnings():
coords, np.ones(len(coords))) warnings.simplefilter("ignore")
assert_raises(ValueError, plotter.mask_interpolate, assert_raises(ValueError, plotter.mask_interpolate,
coords, np.ones(2 * len(coords))) coords, np.ones(len(coords)))
assert_raises(ValueError, plotter.mask_interpolate,
coords, np.ones(2 * len(coords)))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment