Am 06.07.2010, 12:23 Uhr, schrieb Martijn Faassen <>:

> While I acknowledge its fragility, I do like the way doctests express
> exceptions quite a lot, so I'd prefer something that kept them like
> that. We've used normalization in the past, so if core Python exception
> messages changed I'd imagine more normalization could help again?
> Anyway, since we've only had a few test failures the problems with
> changing message formatting seems to be limited, right?

I think this has come up before especially in reference to Lennart's port  
to Python 3.x. Any test that depends upon exception formatting is likely  
to be a problem. In the specific zope.formlib test we have a doctest  
embedded within another:

     >>> MyForm(None, request)() # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
     There were errors:
     (u'Invalid floating point data',
      <exceptions.ValueError instance at ...>)

I think this is bound to cause problems sooner or later in any environment.

The test here is whether, and not how, the constraint is fulfilled and the  
nature of the exception is irrelevant. The more common

>>> u'Invalid floating point data' in browser.contents

would be a better solution, I think.

Furthermore, while it's great that form.txt actually runs I wasn't aware  
that it contained any additional tests that are not already run and I've  
always treated it as testable documentation not as an integral part of the  
formlib tests. But I'm ready to be believe this is a large misconception  
on my part.

Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to