[Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

Tres Seaver tseaver at palladion.com
Sun May 19 22:17:26 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/19/2013 12:14 PM, Dan Stromberg wrote:
> On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger < 
> raymond.hettinger at gmail.com> wrote:
> 
>> 
>> On May 14, 2013, at 9:39 AM, Gregory P. Smith <greg at krypto.org>
>> wrote:
>> 
>> Bad: doctests.
>> 
>> 
>> I'm hoping that core developers don't get caught-up in the "doctests
>> are bad meme".
>> 
> 
> Don't doctests intended for CPython not work on Jython, Pypy,
> IronPython...
> 
> I've been avoiding them for this reason.

"Naive" doctests depend a lot on repr, and hence tend to break even
between minor releases of CPython.  Folks who use a lot of them apply a
great deal of elbow grease to working around that problem, e.g. through
"renoormalizing" the output:

 https://github.com/zopefoundation/zope.testing/blob/master/src/zope/testing/renormalizing.txt


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlGZM1YACgkQ+gerLs4ltQ6zRACgx266WAzy1RDX0vOm7fThXzi5
zX4AoNyZFGBOML2XR4ZOecXwzG6XaHW+
=yGon
-----END PGP SIGNATURE-----



More information about the Python-Dev mailing list