8000 FIX assert_raises cannot be called with ``with\\ by NelleV · Pull Request #1159 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX assert_raises cannot be called with ``with\\ #1159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/matplotlib/tests/test_figure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import matplotlib
from nose.tools import assert_equal, assert_is, assert_is_not
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt
Expand Down
10 changes: 7 additions & 3 deletions lib/matplotlib/tests/test_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ def test_shared():

def test_exceptions():
# TODO should this test more options?
with assert_raises(ValueError):
plt.subplots(2, 2, sharex='blah')
plt.subplots(2, 2, sharey='blah')
assert_raises(ValueError, plt.subplots, 2, 2, sharex='blah')
assert_raises(ValueError, plt.subplots, 2, 2, sharey='blah')


def test_subplots():
Expand All @@ -108,3 +107,8 @@ def test_subplots():
test_shared()
# - are exceptions thrown correctly
test_exceptions()


if __name__ == "__main__":
import nose
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)
14 changes: 6 additions & 8 deletions lib/matplotlib/tests/test_ticker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import print_function
from nose.tools import assert_equal, assert_raises
from nose.tools import assert_raises
from numpy.testing import assert_almost_equal
import numpy as np

Expand All @@ -8,10 +8,10 @@

def test_MaxNLocator():
loc = mticker.MaxNLocator(nbins=5)
test_value = np.array([ 20., 40., 60., 80., 100.])
test_value = np.array([20., 40., 60., 80., 100.])
assert_almost_equal(loc.tick_values(20, 100), test_value)

test_value = np.array([ 0., 0.0002, 0.0004, 0.0006, 0.0008, 0.001])
test_value = np.array([0., 0.0002, 0.0004, 0.0006, 0.0008, 0.001])
assert_almost_equal(loc.tick_values(0.001, 0.0001), test_value)

test_value = np.array([-1.0e+15, -5.0e+14, 0e+00, 5e+14, 1.0e+15])
Expand All @@ -33,9 +33,7 @@ def test_MultipleLocator():
def test_LogLocator():
loc = mticker.LogLocator(numticks=5)

# make sure the 0 case is covered with an exception
with assert_raises(ValueError):
loc.tick_values(0, 1000)
assert_raises(ValueError, loc.tick_values, 0, 1000)

test_value = np.array([1.00000000e-03, 1.00000000e-01, 1.00000000e+01,
1.00000000e+03, 1.00000000e+05, 1.00000000e+07])
Expand All @@ -46,6 +44,6 @@ def test_LogLocator():
assert_almost_equal(loc.tick_values(1, 100), test_value)


if __name__=='__main__':
if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)
0