nose-devs/nose — Issue #280: assert_raises should return the caught exception
Author: jpellerin
Created: 2011-12-14 16:06:20+00:00
State: closed

Often, it's not enough to see that an exception is thrown. There may be
additional status information that should be verified, for instance. The
existing assert_raises is useless in this situation.

Expected use:

def test_something():
assert_equal(404, catch(HTTPError, urlopen, address +
'/test/nonexisting/').code)
assert_equal(404, catch(HTTPError, urlopen, address + '/test/invalid/').code)

But was:

def test_something():
try:
urlopen(address + '/test/nonexisting/')
except HTTPError, exc:
assert_equal(404, exc.code)

try:
urlopen(address + '/test/invalid/')
except HTTPError, exc:
assert_equal(404, exc.code)

Google Code Info:
Issue #: 203
Author: cwi...@gmail.com
Created On: 2008-09-02T06:05:23.000Z
Closed On: 2009-11-04T15:56:05.000Z