unit testing

Ben Finney bignose+hates-spam at benfinney.id.au
Sat Oct 6 03:24:27 CEST 2007


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:

> Giampaolo Rodolà <gnewsg at gmail.com> writes:
> > def test_answer():
> >     assert 42 == 43
> > 
> > What's the equivalent of unittest's "assertRaises"?
> 
> def test_raises():
>     try:
>        thingy()
>        assert 42 == 43

Clearer would be:

        assert False

>     except GoodException:
>        pass

-- 
 \        "Some people, when confronted with a problem, think 'I know, |
  `\       I'll use regular expressions'. Now they have two problems." |
_o__)                           —Jamie Zawinski, in alt.religion.emacs |
Ben Finney



More information about the Python-list mailing list