Re: Unit testing beginner question

2011-05-23 Thread Roy Smith
In article , Ian Kelly 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] -- http://mail.pyth

Re: Unit testing beginner question

2011-05-23 Thread Ian Kelly
On Mon, May 23, 2011 at 4:30 PM, Andrius wrote: > and I am expecting test to pass, but I am getting exception: > Traceback (most recent call last): >    self.assertRaises(TypeError, self.testListNone[:1]) > TypeError: 'NoneType' object is unsubscriptable > > I thought that assertRaises will pass s

Re: Unit testing beginner question

2011-05-23 Thread Andrius A
That was quick! Thanks Ian On 23 May 2011 23:46, Ian Kelly wrote: > On Mon, May 23, 2011 at 4:30 PM, Andrius wrote: > > and I am expecting test to pass, but I am getting exception: > > Traceback (most recent call last): > >self.assertRaises(TypeError, self.testListNone[:1]) > > TypeError: