Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25521

RE: assertraises behaviour

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 <ramit.prasad@jpmorgan.com>
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" <ramit.prasad@jpmorgan.com>
To "python-list@python.org" <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 <CAF_E5JYANst57yOud+Ot0AbKkePruoCGPUNC5BbyBoMbgaw2_Q@mail.gmail.com> <ju16g6$8o2$1@dough.gmane.org> <CAF_E5JZNrusmb2SziNBOah67ioZG0yf_w5RNJxVVrU8B5Tqzuw@mail.gmail.com> <ju1att$hc4$1@dough.gmane.org> <CAF_E5Ja4kzHGa9vEr5CML5wV7ampCULRRGt=9JtRoqn4Xxummw@mail.gmail.com> <ju1iug$mtd$1@dough.gmane.org> <mailman.2206.1342515998.4697.python-list@python.org> <lmrfd9-he3.ln1@satorlaser.homedns.org>
In-Reply-To <lmrfd9-he3.ln1@satorlaser.homedns.org>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2234.1342547396.4697.python-list@python.org> (permalink)
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

Show key headers only | View raw


> > 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.  

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: assertraises behaviour andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-17 10:06 +0100
  Re: assertraises behaviour Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-07-17 12:34 +0200
    RE: assertraises behaviour "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-17 17:49 +0000
    Re: assertraises behaviour Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-07-17 19:03 +0100
    RE: assertraises behaviour "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-17 21:04 +0000

csiph-web