Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6105

Re: Unit testing beginner question

From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: Unit testing beginner question
Date 2011-05-23 20:19 -0400
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <roy-171A63.20190123052011@news.panix.com> (permalink)
References <b34bbd5b-bd87-43e0-85a9-1cfbdcc4ca8c@y12g2000yqh.googlegroups.com> <mailman.1991.1306191316.9059.python-list@python.org>

Show all headers | View raw


In article <mailman.1991.1306191316.9059.python-list@python.org>,
 Ian Kelly <ian.g.kelly@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]

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Unit testing beginner question Andrius <andrius.a@gmail.com> - 2011-05-23 15:30 -0700
  Re: Unit testing beginner question Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-23 16:46 -0600
    Re: Unit testing beginner question Roy Smith <roy@panix.com> - 2011-05-23 20:19 -0400

csiph-web