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


Groups > comp.lang.python > #6105

Re: Unit testing beginner question

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!panix!roy
From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: Unit testing beginner question
Date Mon, 23 May 2011 20:19:01 -0400
Organization PANIX Public Access Internet and UNIX, NYC
Lines 12
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>
NNTP-Posting-Host localhost
X-Trace reader1.panix.com 1306196341 18869 127.0.0.1 (24 May 2011 00:19:01 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Tue, 24 May 2011 00:19:01 +0000 (UTC)
User-Agent MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6105

Show key headers only | 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