Unit testing beginner question

Roy Smith roy at panix.com
Mon May 23 20:19:01 EDT 2011


In article <mailman.1991.1306191316.9059.python-list at python.org>,
 Ian Kelly <ian.g.kelly at gmail.com> wrote:

> This would work:
> 
> self.assertRaises(TypeError, lambda: self.testListNone[:1])

If you're using the version of unittest from python 2.7, there's an even 
nicer way to write this:

with self.assertRaises(TypeError):
    self.testListNone[:1]



More information about the Python-list mailing list