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

[Python-Dev] unittest missing assertNotRaises

[Python-Dev] unittest missing assertNotRaises [Python-Dev] unittest missing assertNotRaisesOleg Broytman phd at phdru.name
Tue Sep 27 21:05:32 CEST 2011
On Tue, Sep 27, 2011 at 07:46:52PM +0100, Wilfred Hughes wrote:
> +    def assertNotRaises(self, excClass, callableObj=None, *args, **kwargs):
> +        """Fail if an exception of class excClass is thrown by
> +        callableObj when invoked with arguments args and keyword
> +        arguments kwargs.
> +        
> +        """
> +        try:
> +            callableObj(*args, **kwargs)
> +        except excClass:
> +            raise self.failureException("%s was raised" % excClass)
> +            
> +

   What if I want to assert my test raises neither OSError nor IOError?

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.
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