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


Groups > comp.lang.python > #25420 > unrolled thread

Re: assertraises behaviour

Started byandrea crotti <andrea.crotti.0@gmail.com>
First post2012-07-16 15:37 +0100
Last post2012-07-16 15:37 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: assertraises behaviour andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-16 15:37 +0100

#25420 — Re: assertraises behaviour

Fromandrea crotti <andrea.crotti.0@gmail.com>
Date2012-07-16 15:37 +0100
SubjectRe: assertraises behaviour
Message-ID<mailman.2176.1342449461.4697.python-list@python.org>
2012/7/16 Christian Heimes <lists@cheimes.de>:
>
> The OSError isn't catched as the code never reaches the line with "raise
> OSError". In other words "raise OSError" is never executed as the
> exception raised by "assert False" stops the context manager.
>
> You should avoid testing more than one line of code in a with
> self.assertRaises() block.
>
> Christian
>
> --
> http://mail.python.org/mailman/listinfo/python-list

Ok now it's more clear, and normally I only test one thing in the block.
But I find this quite counter-intuitive, because in the block I want
to be able to run something that raises the exception I catch (and
which I'm aware of), but if another exception is raised it *should*
show it and fail in my opinion..

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web