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


Groups > comp.lang.python > #25475

Re: assertraises behaviour

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; '__name__': 0.07; 'unittest': 0.07; 'cc:addr:python-list': 0.10; 'def': 0.10; "'__main__':": 0.16; 'oserror.': 0.16; 'to:addr:web.de': 0.16; 'translate': 0.20; 'import': 0.21; 'exceptions': 0.22; 'produces': 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'assert': 0.29; 'behaviour': 0.29; 'url:mailman': 0.29; 'no,': 0.29; 'probably': 0.29; 'class': 0.29; 'maybe': 0.29; 'basic': 0.30; 'code': 0.31; 'url:python': 0.32; 'url:listinfo': 0.32; 'received:google.com': 0.34; 'fail': 0.35; 'false': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'method': 0.36; 'test': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'header:Received:5': 0.40; 'help': 0.40; 'url:mail': 0.40; 'easy': 0.60; 'skip:u 10': 0.60; 'first': 0.61; 'gave': 0.65; 'otten': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iK2Hpv5FfXLFvZvDgOCl7KoX8lW3jswSwi0x/Y95JJo=; b=lyCt6hfhMVjMNP6Cy80YcRf8AQwEEkUlwQfl2Wo8yEXbcNuFYVPy+0WSDwwALIfkn3 S8Dae5w1wtVaSk7pnPlvgg/JePj3Nx4k2dfj7jWNMmBYYiHfF1d3K3DqzNWbdM3/JBZA BpGFUoNVxyiV6sZVU/yHzzLpKrSFZq2wpCrM4e9i2OX099iRLnG0/auGwSIVTPQn9ovq T+Rtbqb5icgWZcqPhdP3gxqqmobPAIC3gSg5zwuvgqjxb9ayDml+DFHpicDqbsTvGzZc sPPF7xpEhzpEeocAYXUSJVb3qL0EzL+OOrLL0X1EpG9+PhMVNsDi2Lf37UCdUy/5rewZ 5OMg==
MIME-Version 1.0
In-Reply-To <ju1iug$mtd$1@dough.gmane.org>
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>
Date Tue, 17 Jul 2012 10:06:36 +0100
Subject Re: assertraises behaviour
From andrea crotti <andrea.crotti.0@gmail.com>
To Peter Otten <__peter__@web.de>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
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.2206.1342515998.4697.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342515998 news.xs4all.nl 6849 [2001:888:2000:d::a6]:47422
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25475

Show key headers only | View raw


2012/7/16 Peter Otten <__peter__@web.de>:
> No, I don't see how the code you gave above can fail with an OSError.
>
> Can you give an example that produces the desired behaviour with nose? Maybe
> we can help you translate it to basic unittest.
>
> --
> http://mail.python.org/mailman/listinfo/python-list


Well this is what I meant:

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..
But that's probably easy because we just need to catch exceptions for
every method call, so it's not exactly the same thing..

Back to comp.lang.python | Previous | NextNext 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