> try:
> c().foo()
> except TypeError:
> pass
> else:
> assert False, "c.foo() should have thrown TypeError"
In fact, the above code actually expects foo to throw
particular exception, not exactly the same as the original
requirement. More of
expect TypeError:
c().foo()
and s
> I suspect that you wanted either:
>try:
>c().foo()
>fail('Should have raised TypeError')
>except TypeError:
>pass # expected
Right, of course I use something along these lines:
try:
c().foo()
except TypeError:
pass
else:
assert False, "c.foo() shoul
Dmitry Dvoinikov writes:
> The reason for that being self-tests with lots and lots of
> little code snippets like this:
>
> try:
> c().foo()
> except TypeError:
> pass
Paul Du Boise already responded explaining that PEP 343 probably handles
the task you want. I just wanted to mention that