Re: [Python-Dev] Doctest and Footnotes

2006-07-11 Thread Fred Drake
On Tuesday 11 July 2006 14:37, Alexander Belopolsky wrote: > That's true, but you cannot test an object method without creating the > object first. True. How the object is created can vary; if the creation affects the expected behavior in any way, you'll need be careful about how the constr

Re: [Python-Dev] Doctest and Footnotes

2006-07-11 Thread Alexander Belopolsky
On 7/11/06, Fred Drake <[EMAIL PROTECTED]> wrote: > On Tuesday 11 July 2006 14:12, Alexander Belopolsky wrote: > > Also __new__ and __init__ method docstrings is the natural place to > > put set-up code. > > Maybe, if all the tests required the same setup code. That's often not the > case. That

Re: [Python-Dev] Doctest and Footnotes

2006-07-11 Thread Phillip J. Eby
At 02:12 PM 7/11/2006 -0400, Alexander Belopolsky wrote: >On 7/11/06, Benji York <[EMAIL PROTECTED]> wrote: >[snip] > > I'm not quite sure what you're suggesting. A guess: put the code that > > isn't to be seen in the __test__ dict with a string key being the name > > of the footnote? > >That's ri

Re: [Python-Dev] Doctest and Footnotes

2006-07-11 Thread Fred Drake
On Tuesday 11 July 2006 14:12, Alexander Belopolsky wrote: > Also __new__ and __init__ method docstrings is the natural place to > put set-up code. Maybe, if all the tests required the same setup code. That's often not the case. -Fred -- Fred L. Drake, Jr. Zope Corporation

Re: [Python-Dev] Doctest and Footnotes

2006-07-11 Thread Alexander Belopolsky
On 7/11/06, Benji York <[EMAIL PROTECTED]> wrote: [snip] > I'm not quite sure what you're suggesting. A guess: put the code that > isn't to be seen in the __test__ dict with a string key being the name > of the footnote? That's right. > I don't think a ReST processor would like that much. > It

Re: [Python-Dev] Doctest and Footnotes

2006-07-11 Thread Benji York
Alexander Belopolsky wrote: > Benji York zope.com> writes: >>Here's the idea: when a footnote is referenced in prose, execute the >>code associated with the footnote at that point. For example: >> > > Another natural place for the referenced code is the __test__ dictionary. > Using that has an

Re: [Python-Dev] Doctest and Footnotes

2006-07-11 Thread Alexander Belopolsky
Benji York zope.com> writes: > > Here's the idea: when a footnote is referenced in prose, execute the > code associated with the footnote at that point. For example: > Another natural place for the referenced code is the __test__ dictionary. Using that has an advantage of not clobbering the

Re: [Python-Dev] Doctest and Footnotes

2006-07-11 Thread Benji York
Phillip J. Eby wrote: > It would be nice if tracebacks in the footnote show the invoking context Yep. Someone (Jim Fulton I think) had suggested that to me. I'll look into it. > My other thought would be that having a patch that works against the 2.5 > version of doctest would be good My int

Re: [Python-Dev] Doctest and Footnotes

2006-07-10 Thread Phillip J. Eby
At 11:36 PM 7/10/2006 -0400, Benji York wrote: >The footnote code is executed every time the footnote is referenced, and >is /not/ executed at any other time (i.e. it's not executed at the point >the footnote is defined). A warning is generated if a footnote (that >includes code) is defined but ne

[Python-Dev] Doctest and Footnotes

2006-07-10 Thread Benji York
A coworker of mine (Gary Poster) had a really good idea a couple weeks ago: teach doctest about ReST-style footnotes. I implemented it over the weekend and brought it to Tim Peter's attention today. Tim generally liked the idea and suggested I bring it up here. Here's the idea: when a footnot