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


Groups > comp.lang.python > #63748

Re: parametized unittest

Path csiph.com!usenet.pasdenom.info!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <wking@tremily.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '[1]:': 0.09; 'option,': 0.09; 'unittest': 0.09; 'val': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; '[1].': 0.16; 'failure.': 0.16; 'filename:fname piece:signature': 0.16; 'gnupg': 0.16; 'loop.': 0.16; 'received:76.96': 0.16; 'received:mail.comcast.net': 0.16; 'sat,': 0.16; 'url:org)': 0.16; 'wrote:': 0.18; 'library': 0.18; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'advise.': 0.24; 'received:comcast.net': 0.24; 'stick': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'signed': 0.27; 'header:In-Reply-To:1': 0.27; 'received:24': 0.27; "i'm": 0.30; 'url:wiki': 0.31; 'url:wikipedia': 0.31; 'anyone': 0.31; 'url:python': 0.33; 'something': 0.35; 'charset :us-ascii': 0.36; 'url:org': 0.36; 'received:76': 0.38; 'url:library': 0.38; 'break': 0.61; 'url:3': 0.61; 'information,': 0.61; 'first': 0.61; 'content-disposition:inline': 0.62; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'url:4': 0.69; '3.4': 0.84; 'trevor': 0.84; 'encrypted': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; t=1389500919; bh=1/NITt9QkYI1hS7yL14S1fGh+2LNvqhHXaQR5XrJ1Uw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Xo7DSbqTr5jec73FpVyFiD7vksmHexncE3O7coIPsrgwL/gOi/veOzi68/sBuK+Xy YlESdZEYIxD5LHp5o01EadwnsUDyzuhBnsgn+sDJzT3+L7gv+2XltZffuiiLYs6KQV oCr3zV4iH2mxaujkq1avM9meszHHBOjr+NDxY4w4=
Date Sat, 11 Jan 2014 20:28:38 -0800
From "W. Trevor King" <wking@tremily.us>
To CraftyTech <hmmedina@gmail.com>
Subject Re: parametized unittest
References <c11a3b62-2053-4b6f-afda-d2df305f58e5@googlegroups.com>
MIME-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Hy6Wd/+xmQCqA1QQ"
Content-Disposition inline
In-Reply-To <c11a3b62-2053-4b6f-afda-d2df305f58e5@googlegroups.com>
OpenPGP id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8; url=http://tremily.us/pubkey.txt
User-Agent Mutt/1.5.22 (2013-10-16)
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1389500921; bh=BHKo0G7ndjhL66RzUlFZK7iBxpniGYwBQ7uWdm0LxsU=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=dh1XfOB+BBBuTRY9+7lkoXHOBpaNzehPAcL71RjMK1YtOE+iPwV2SWXyZfbqGWlye ikzSmbPR7DBXWIcowghb5/zibXIMF1YadTRjqncCr5KxbyDlJmhpgBlNCSCUdhPQFT EmFT1WgWjU1IoLCR+oP8fqZ6zbF0ucorSp/CZbjaiSe2Iy3TMMsgKy2zsf2WV/Apc/ fE4FogejjVol4X6HTmBkK2gJx5S6jy1mB8E2of7fp+G3Rh0iGzuBrmRt+UUZMzaFOd k2kcry9NiL/cIpw349FCVafvYsN+pK6/E2FSlhb4O97PM/y2pG3ir3PZ5QbehOHgJO Nq91YhJHU6Cnw==
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5355.1389500996.18130.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389500996 news.xs4all.nl 2888 [2001:888:2000:d::a6]:55826
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63748

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Sat, Jan 11, 2014 at 08:00:05PM -0800, CraftyTech wrote:
> I'm finding it hard to use unittest in a for loop.  Perhaps something like:
> 
> for val in range(25):
>   self.assertEqual(val,5,"not equal)
> 
> The loop will break after the first failure.  Anyone have a good
> approach for this?  please advise.

If Python 3.4 is an option, you can stick to the standard library and
use subtests [1].

Cheers,
Trevor

[1]: http://docs.python.org/3.4/library/unittest.html#distinguishing-test-iterations-using-subtests

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

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


Thread

parametized unittest CraftyTech <hmmedina@gmail.com> - 2014-01-11 20:00 -0800
  Re: parametized unittest Ben Finney <ben+python@benfinney.id.au> - 2014-01-12 15:22 +1100
  Re: parametized unittest "W. Trevor King" <wking@tremily.us> - 2014-01-11 20:28 -0800
    Re: parametized unittest Roy Smith <roy@panix.com> - 2014-01-11 23:34 -0500
      Re: parametized unittest CraftyTech <hmmedina@gmail.com> - 2014-01-12 08:57 -0800

csiph-web