Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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; 'abort': 0.09; 'received:155': 0.09; 'def': 0.10; 'yet.': 0.13; 'result.': 0.15; "'__main__':": 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:169.70.184': 0.16; 'received:169.70.184.72': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:hubcr105.exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'handles': 0.18; 'to:name:python-list@python.org': 0.20; 'import': 0.21; 'error.': 0.21; 'exceptions': 0.22; "haven't": 0.23; 'received:169.254': 0.24; 'second': 0.24; 'testing': 0.24; 'header:In-Reply-To:1': 0.25; 'guess': 0.27; 'separate': 0.27; 'accuracy': 0.27; 'run': 0.28; 'assert': 0.29; 'separated': 0.29; 'handled': 0.29; 'received:169': 0.29; 'probably': 0.29; 'class': 0.29; 'framework': 0.30; 'header:Received:8': 0.30; 'problem': 0.33; 'to:addr:python-list': 0.33; 'false': 0.35; 'so,': 0.35; 'there': 0.35; 'but': 0.36; 'method': 0.36; 'test': 0.36; 'charset :us-ascii': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'unit': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; '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:169.254.8': 0.84 X-DKIM: OpenDKIM Filter v2.1.3 sf3.jpmchase.com q6HHnl8i006456 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1342547387; bh=DKJttU1U2rn0xwJhPO2NFNJ8zkWmzqlR8vLFEG2te3I=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=DrwJJlL6+KVsUrP5DSDwfpS0XPFEPRAymYTWU5iOxZsOTDKM8kRUrnYJZYLuZAyyj fzVsS0cY2pZ9A1liYOEGbs6xMc376nc6IZEpvacDldS3GmrIjPwwSn+VXxwEbiafsZ vAiw7JpGyKqKVHdgXEVMlIKPhddufUIDuaFi4tls= From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: assertraises behaviour Thread-Topic: assertraises behaviour Thread-Index: AQHNZAe+C+9Y20973EmcJPD96WEAOZctwKJQ Date: Tue, 17 Jul 2012 17:49:35 +0000 References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes Content-Type: text/plain; charset="us-ascii" 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342547396 news.xs4all.nl 6888 [2001:888:2000:d::a6]:38703 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25521 > > import unittest=0D=0A> >=0D=0A> > class TestWithRaises(unittest=2ETestC= ase):=0D=0A> > def test_first(self):=0D=0A> > assert False=0D= =0A> >=0D=0A> > def test_second(self):=0D=0A> > print("also c= alled")=0D=0A> > assert True=0D=0A> >=0D=0A> > if __name__ =3D=3D = '__main__':=0D=0A> > unittest=2Emain()=0D=0A> >=0D=0A> > in this case = also the second test is run even if the first fails=2E=2E=0D=0A> =0D=0A> Th= e reason for that is that the unit testing framework catches and=0D=0A> han= dles the error=2E It calls both test functions in some unspecified=0D=0A> o= rder and logs the result=2E Calls to two separate test functions are=0D=0A>= thereby separated from each other=2E This is intentionally so, but I think= =0D=0A> you can also give the unit testing framework a flag that makes it a= bort=0D=0A> after the first error=2E In no way will the exception escape fr= om the=0D=0A> unittest=2Emain() call though, it is all caught and handled i= nside, also=0D=0A> by intention=2E=0D=0A> =0D=0A> =0D=0A> > But that's prob= ably easy because we just need to catch exceptions for=0D=0A> > every metho= d call, so it's not exactly the same thing=2E=2E=0D=0A> =0D=0A> I don't und= erstand what you want to say here=2E I also don't understand=0D=0A> what yo= ur problem in general is=2E I guess there are some expectations=0D=0A> whic= h are not satisfied, but you haven't explained those explicitly yet=2E=0D= =0A>=0D=0A=0D=0AI think Andrea wants to do the same thing but with nose and= not=0D=0Aunittest=2E=0D=0A=0D=0ARamit=0D=0A=0D=0AThis email is confidentia= l and subject to important disclaimers and=0D=0Aconditions including on off= ers for the purchase or sale of=0D=0Asecurities, accuracy and completeness = of information, viruses,=0D=0Aconfidentiality, legal privilege, and legal e= ntity disclaimers,=0D=0Aavailable at http://www=2Ejpmorgan=2Ecom/pages/disc= losures/email=2E