Re: [Python-Dev] unittest missing assertNotRaises

2011-09-28 Thread Laurens Van Houtven
Oops, I accidentally hit Reply instead of Reply to All... On Wed, Sep 28, 2011 at 1:05 PM, Michael Foord wrote: > On 27/09/2011 19:59, Laurens Van Houtven wrote: > > Sure, you just *do* it. The only advantage I see in assertNotRaises is that > when that exception is raised, you should (and would

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-28 Thread Michael Foord
On 27/09/2011 19:59, Laurens Van Houtven 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. There are some who don't see the distinction between a failure and an error as a useful

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-28 Thread Michael Foord
On 27/09/2011 19:46, 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 on. So, it seems odd to me that there isn't assertNotRaises. Is there any pa

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-28 Thread Oleg Broytman
On Wed, Sep 28, 2011 at 09:43:13AM +1000, Steven D'Aprano wrote: > Oleg Broytman wrote: > >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 throw

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-28 Thread Wilfred Hughes
On 27 September 2011 19:59, Laurens Van Houtven <_...@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

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread Yuval Greenfield
On Sep 27, 2011 5:56 PM, wrote: > > > assertNotRaises doesn't make anything possible that isn't possible now. It probably doesn't even make anything easier - but if it does, it's so obscure (and I've read and written thousands of tests for all kinds of libraries over the years) that it doesn't mer

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread exarkun
On 27 Sep, 11:58 pm, ckay...@zindagigames.com wrote: On Tue, Sep 27, 2011 at 4:43 PM, Steven D'Aprano wrote: But I can't see this being a useful test. As written, exceptions are still treated as errors, except for excClass, which is treated as a test failure. I can't see the use-case for th

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread Chris Kaynor
On Tue, Sep 27, 2011 at 4:43 PM, Steven D'Aprano wrote: > But I can't see this being a useful test. As written, exceptions are still > treated as errors, except for excClass, which is treated as a test failure. I > can't see the use-case for that. assertRaises is useful: > > "IOError is allowed,

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread Steven D'Aprano
Oleg Broytman wrote: 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 +

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread Terry Reedy
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 condition

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread Oleg Broytman
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 k

Re: [Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread Laurens Van Houtven
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. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python

[Python-Dev] unittest missing assertNotRaises

2011-09-27 Thread Wilfred Hughes
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 on. So, it seems odd to me that there isn't assertNotRaises. Is there any particular motivation for not putting it in? I've