diff --git a/kwant/tests/test_plotter.py b/kwant/tests/test_plotter.py index fb21bea86f1099e7b074402ef635835c962565ef..a21be99e3e8a882c8e45995da6c54ca3180852ba 100644 --- a/kwant/tests/test_plotter.py +++ b/kwant/tests/test_plotter.py @@ -151,7 +151,7 @@ def test_map(): with warnings.catch_warnings(): warnings.simplefilter("ignore") plotter.map(sys.finalized(), xrange(len(sys.sites())), - file=out) + file=out) nose.tools.assert_raises(ValueError, plotter.map, sys, xrange(len(sys.sites())), file=out) @@ -160,7 +160,6 @@ def test_mask_interpolate(): # A coordinate array with coordinates of two points almost coinciding. coords = np.array([[0, 0], [1e-7, 1e-7], [1, 1], [1, 0]]) - warnings.simplefilter("ignore") with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") plotter.mask_interpolate(coords, np.ones(len(coords)), a=1) @@ -168,7 +167,9 @@ def test_mask_interpolate(): assert issubclass(w[-1].category, RuntimeWarning) assert "coinciding" in str(w[-1].message) - assert_raises(ValueError, plotter.mask_interpolate, - coords, np.ones(len(coords))) - assert_raises(ValueError, plotter.mask_interpolate, - coords, np.ones(2 * len(coords))) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + assert_raises(ValueError, plotter.mask_interpolate, + coords, np.ones(len(coords))) + assert_raises(ValueError, plotter.mask_interpolate, + coords, np.ones(2 * len(coords)))