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
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
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:
Hello,
would be gratefull for the explonation.
I did a simple test case:
def setUp(self):
self.testListNone = None
def testListSlicing(self):
self.assertRaises(TypeError, self.testListNone[:1])
and I am expecting test to pass, but I am getting exception:
Traceback (most recent call last):