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/113726.html below:

[Python-Dev] unittest missing assertNotRaises

[Python-Dev] unittest missing assertNotRaises [Python-Dev] unittest missing assertNotRaisesWilfred Hughes wilfred at potatolondon.com
Wed Sep 28 12:20:54 CEST 2011
On 27 September 2011 19:59, Laurens Van Houtven <_ at lvh.cc> wrote:
> Sure, you just *do* it. The only advantage I see in assertNotRaises is that when that exception is raised, you should (and would) get a failure, not an error.

It's a useful distinction. I have found myself writing code of the form:

def test_old_exception_no_longer_raised(self):
    try:
        do_something():
    except OldException:
        self.assertTrue(False)

in order to distinguish between a regression and something new
erroring. The limitation of this pattern is that the test failure
message is not as good.
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