On Sun, 16 Apr 2006, Guido van Rossum wrote: > On 4/16/06, Paul Moore <p.f.moore at gmail.com> wrote: >> Personally, my instinct is that having the whole traceback in a >> doctest is at least as ugly. You don't need the whole traceback -- e.g.: """ If a URL is supplied, it must have an authority (host:port) component. According to RFC 3986, having an authority component means the URL must have two slashes after the scheme: >>> _parse_proxy('file:/ftp.example.com/') Traceback (most recent call last): ValueError: proxy URL with no authority: 'file:/ftp.example.com/' """ I think the try: ... except FooException: print 'FooException occurred' style is uglier and less natural than that, but I guess it's not a big deal. > Well, it depends on what you use doctest for. If you use it to write > unit tests, the try/except solution is fine, and perhaps preferable. [...] Preferable because depending less on irrelevant details? I had thought that, apart from the issue with module traceback, IGNORE_EXCEPTION_DETAIL made that a non-issue in most cases, but perhaps I missed something (again). John
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4