Re: SimpleFormValidator obscures my docstrings (and doctests!)

"Matthew Wilson" <[email protected]> Wed, 10 Dec 2008 23:47:32 -0500
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
On Wed, Dec 10, 2008 at 11:41 PM, Ian Bicking <[email protected]> wrote:
> Thanks for the test.  You were actually using it somewhat differently here,
> not using the decorator.  Anyway, I moved the __doc__ assignment around, and
> now this works.

This uses the SimpleFormValidator.decorate call:

def test_SimpleFormValidator_2():
   """
   Verify SimpleFormValidator.decorate preserves the decorated function's
   docstring.
   """

   BOGUS_DOCSTRING = "blah blah blah"

   @SimpleFormValidator.decorate()
   def f(value_dict, state, validator):
      "blah blah blah"
      value_dict['f'] = 99

   assert f.__doc__ == BOGUS_DOCSTRING, "Docstrings don't match!"

-- 
Matthew Wilson
[email protected]
http://tplus1.com

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/