bug in python documentation?

Thomas Jollans thomas at jollybox.de
Sat Sep 11 11:47:32 EDT 2010


On Saturday 11 September 2010, it occurred to Vito 'ZeD' De Tullio to exclaim:
> from http://docs.python.org/library/unittest.html
> 
> $ python test_unittest.py
> .E.
> ======================================================================
> ERROR: test_sample (__main__.TestSequenceFunctions)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "./test_data_manip.py", line 23, in test_sample
>     with self.assertRaises(ValueError):
> TypeError: failUnlessRaises() takes at least 3 arguments (2 given)
> 
> ----------------------------------------------------------------------
> Ran 3 tests in 0.001s
> 
> FAILED (errors=1)
> $

Which Python version are you using?
To quote the docs you linked:
http://docs.python.org/library/unittest.html#unittest.TestCase.assertRaises

"""	
Changed in version 2.7: Added the ability to use assertRaises() as a context 
manager.
"""

Are you using Python 2.7 (or 3.x)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100911/86bc4520/attachment.html>


More information about the Python-list mailing list