Matthew Wilson
2008-12-11 04:04:47 UTC
I wrote some doctests on a validator, then discovered that decorating
with SimpleFormValidator means that those doctests are on the inner
func attribute, not the outer object, so as far as I can tell, I can
run those doctests.
"""
Add a new key 'f' pointing to 99 to value_dict.
"""
value_dict['f'] = 99
...
Here's the problem: the docstring on the decorated f is really the
I'm trying to write some doctests for my validator f, but my test
runner (nose) doesn't run the doctests.
Any ideas about a solution?
Matt
with SimpleFormValidator means that those doctests are on the inner
func attribute, not the outer object, so as far as I can tell, I can
run those doctests.
@SimpleFormValidator.decorate()
def f(value_dict, state, validator):"""
Add a new key 'f' pointing to 99 to value_dict.
"""
value_dict['f'] = 99
...
f().to_python({}, None)
{'f': 99}Here's the problem: the docstring on the decorated f is really the
f.__doc__ == SimpleFormValidator.__doc__
Trueprint f.func.__doc__
Add a new key 'f' pointing to 99 to value_dict.I'm trying to write some doctests for my validator f, but my test
runner (nose) doesn't run the doctests.
Any ideas about a solution?
Matt
--
Matthew Wilson
***@tplus1.com
http://tplus1.com
Matthew Wilson
***@tplus1.com
http://tplus1.com