Ben Finney <[EMAIL PROTECTED]> writes:

> Paul Rubin <http://[EMAIL PROTECTED]> writes:
> 
> > Giampaolo RodolĂ  <[EMAIL PROTECTED]> writes:
> > > What's the equivalent of unittest's "assertRaises"?
> > 
> > def test_raises():
> >     try:
> >        thingy()
> >        assert 42 == 43
> 
> Clearer would be:
> 
>         assert False

Or even better:

    def test_raises_good_exception():
        try:
            thingy()
        except GoodException:
            pass
        else:
            raise AssertionError("Did not raise expected GoodException")

-- 
 \         "Dad always thought laughter was the best medicine, which I |
  `\        guess is why several of us died of tuberculosis."  -- Jack |
_o__)                                                           Handey |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to