A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-September/113703.html below:

[Python-Dev] unittest missing assertNotRaises

[Python-Dev] unittest missing assertNotRaisesTerry Reedy tjreedy at udel.edu
Tue Sep 27 22:06:22 CEST 2011
On 9/27/2011 2:46 PM, Wilfred Hughes wrote:
> Hi folks
>
> I wasn't sure if this warranted a bug in the tracker, so I thought I'd
> raise it here first.
>
> unittest has assertIn, assertNotIn, assertEqual, assertNotEqual and so

These all test possible specification conditions and sensible test 
conditions. For instance -1 and particularly 3 should not be in 
range(3). Including 3 is a realistic possible error. If you partition a 
set into subsets < x and > x, x should not be in either, but an easy 
mistake would put it in either or both.

> Is there any particular motivation for not putting it in?

You have 'motivation' backwards. There are an infinity of things we 
could add. We need a positive, substantial reason with real use cases to 
add something.

An expression should return a particular value or return a particular 
expression. If it returns a value, testing that it is the correct value 
eliminates all exceptions. And testing for an expected exception 
eliminates all others. If there is an occasional needed for the 
proposal, one can write the same code you did, but with the possibility 
of excluding more than one exception. So I do not see any need for the 
proposal.

-- 
Terry Jan Reedy

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4