Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'explicitly': 0.04; '__name__': 0.07; 'completeness': 0.07; 'escape': 0.07; 'unittest': 0.07; 'python': 0.09; 'abort': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.10; 'itself.': 0.11; 'yet.': 0.13; 'language': 0.14; 'result.': 0.15; "'__main__':": 0.16; 'at.': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'message-id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'handles': 0.18; '>>>': 0.18; 'import': 0.21; 'error.': 0.21; 'exceptions': 0.22; "haven't": 0.23; 'second': 0.24; 'testing': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'guess': 0.27; 'separate': 0.27; 'accuracy': 0.27; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; 'assert': 0.29; 'separated': 0.29; 'handled': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'framework': 0.30; 'from:addr:yahoo.co.uk': 0.32; 'getting': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'false': 0.35; 'so,': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'method': 0.36; 'test': 0.36; 'two': 0.37; 'being': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'unit': 0.38; 'some': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'easy': 0.60; 'skip:u 10': 0.60; 'first': 0.61; 'is.': 0.62; 'information,': 0.63; 'url:email': 0.63; 'other.': 0.64; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'expectations': 0.71; 'sale': 0.76; 'andrea': 0.84; 'received:89': 0.86 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: assertraises behaviour Date: Tue, 17 Jul 2012 19:03:19 +0100 References: <5B80DD153D7D744689F57F4FB69AF4741657AA3F@SCACMX008.exchad.jpmchase.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-89-243-194-149.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: <5B80DD153D7D744689F57F4FB69AF4741657AA3F@SCACMX008.exchad.jpmchase.net> X-Antivirus: avast! (VPS 120717-0, 17/07/2012), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 58 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342548197 news.xs4all.nl 6889 [2001:888:2000:d::a6]:48583 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25527 On 17/07/2012 18:49, Prasad, Ramit wrote: >>> import unittest >>> >>> class TestWithRaises(unittest.TestCase): >>> def test_first(self): >>> assert False >>> >>> def test_second(self): >>> print("also called") >>> assert True >>> >>> if __name__ == '__main__': >>> unittest.main() >>> >>> in this case also the second test is run even if the first fails.. >> >> The reason for that is that the unit testing framework catches and >> handles the error. It calls both test functions in some unspecified >> order and logs the result. Calls to two separate test functions are >> thereby separated from each other. This is intentionally so, but I think >> you can also give the unit testing framework a flag that makes it abort >> after the first error. In no way will the exception escape from the >> unittest.main() call though, it is all caught and handled inside, also >> by intention. >> >> >>> But that's probably easy because we just need to catch exceptions for >>> every method call, so it's not exactly the same thing.. >> >> I don't understand what you want to say here. I also don't understand >> what your problem in general is. I guess there are some expectations >> which are not satisfied, but you haven't explained those explicitly yet. >> > > I think Andrea wants to do the same thing but with nose and not > unittest. > > Ramit > > This email is confidential and subject to important disclaimers and > conditions including on offers for the purchase or sale of > securities, accuracy and completeness of information, viruses, > confidentiality, legal privilege, and legal entity disclaimers, > available at http://www.jpmorgan.com/pages/disclosures/email. > Do what? Like Ulrich Eckhart I simply don't understand what she's getting at. Perhaps it's a problem with Englsh being a second language issue rather than Python itself. Thankfully I'm sure that everything will come out in the wash. -- Cheers. Mark Lawrence.