[Python-ideas] Fwd: doctest (and.... python3000)

Ethan Furman ethan at stoneleaf.us
Tue Feb 28 01:00:02 CET 2012


Mark Janssen wrote:
> On Mon, Feb 27, 2012 at 3:56 PM, Ethan Furman <ethan at stoneleaf.us 
> <mailto:ethan at stoneleaf.us>> wrote:
> 
>     As probably the easiest example, what is gained by having regression
>     tests as a document?  With unittest you write a test with the
>     expected output and your done.  I would imagine a doctest being
>     something like
> 
>     """This bug introduced in version 2.7.1, fixed in 2.7.2
>      >>> this = quibble('that')
>      >>> this.attr
>     'correct value'
>     """
> 
> 
> Huh?  Perhaps I'm being dumb, but this is generally done outside of 
> unittest and within the code itself, something like:
> 
> if sys.version > 2.4:
>     this= quibbleV4
> else:
>    this = quibbleV3

The choice of python similar version numbers was probably a mistake.

The point is quibbleV3 has a bug in it, and I want to make sure that bug 
doesn't come back in later versions -- so I add a test in my unit tests 
to make sure that it doesn't.

~Ethan~



More information about the Python-ideas mailing list