<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>t+1 - Latest Comments in Python doctests seem underappreciated</title><link>http://tplus1.disqus.com/</link><description></description><atom:link href="http://tplus1.disqus.com/python_doctests_seem_underappreciated_56/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 16 Jul 2008 08:56:37 -0000</lastBuildDate><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-909126</link><description>&lt;p&gt;"Get yourself a real IDE. Emacs handles doctests without any issue"&lt;/p&gt;

&lt;p&gt;Yes, because it's autocompletion is brain dead in the first place! At least compared to a real IDE like Wing.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Michael Foord</dc:creator><pubDate>Wed, 16 Jul 2008 08:56:37 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-895770</link><description>&lt;p&gt;Yeah, doctests are so simple to write that *anybody* can start writing tests, and I believe that any automated testing, even if it only covers 10% of the code, is still a huge help.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Tue, 15 Jul 2008 08:55:41 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-895753</link><description>&lt;p&gt;Masklinn -- thanks for the regexp  help!  I hoped there was a way to do it.  Code updated.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Tue, 15 Jul 2008 08:52:44 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-894664</link><description>&lt;p&gt;&amp;gt; but typing in docstrings means I lose the support of my IDE&lt;/p&gt;

&lt;p&gt;Get yourself a real IDE. Emacs handles doctests without any issue with doctest-mode 0.5 in mmm-mode.&lt;/p&gt;

&lt;p&gt;&amp;gt; and my real code gets bloated with tests - not are useful documentation.&lt;/p&gt;

&lt;p&gt;Your tests clearly aren't good enough.&lt;/p&gt;

&lt;p&gt;Also Matt, all you boolean fugling could be replaced by `return bool(re.search(r'\bno\b', s, re.I))`&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">masklinn</dc:creator><pubDate>Tue, 15 Jul 2008 03:28:24 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-893762</link><description>&lt;p&gt;P.S. More doctest info here: &lt;a href="http://en.wikipedia.org/wiki/Doctest" rel="nofollow"&gt;http://en.wikipedia.org/wiki/D...&lt;/a&gt;&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Paddy3118</dc:creator><pubDate>Tue, 15 Jul 2008 00:19:49 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-893751</link><description>&lt;p&gt;The fact that other important frameworks such as nosetests and unit tests have hooks into doctests is great. It shows that Python unit testers recognise its importance.&lt;/p&gt;

&lt;p&gt;The big battle is getting people to write any meaningful tests. Doctests can help break down that barrier.&lt;/p&gt;

&lt;p&gt;- Paddy.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Paddy3118</dc:creator><pubDate>Tue, 15 Jul 2008 00:17:50 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-892929</link><description>&lt;p&gt;Hi Terry, Yeah, I do use the doctests plugin for nose.  So when I run my doctests, I do $ nosetests --with-doctest &lt;a href="http://blah.py" rel="nofollow"&gt;blah.py&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well, actually, with-doctest=1 is in my $HOME/.noserc, so I don't need the --with-doctest option.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Mon, 14 Jul 2008 21:58:29 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-892912</link><description>&lt;p&gt;Matt - &lt;/p&gt;

&lt;p&gt;Couldn't you just use nose's doctest plugin?&lt;/p&gt;

&lt;p&gt;&amp;lt;my snip=""&amp;gt;&lt;br&gt;% nosetests --with-doctest &lt;a href="http://has.py" rel="nofollow"&gt;has.py&lt;/a&gt; -v -s&lt;br&gt;Doctest: has.has_no ... ok&lt;/p&gt;

&lt;p&gt;----------------------------------------------------------------------&lt;br&gt;Ran 1 test in 0.007s&lt;/p&gt;

&lt;p&gt;OK&lt;br&gt;&amp;lt;/my&amp;gt;&lt;/p&gt;

&lt;p&gt;I love doctests. I also love the nose doctest plugin.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Terry Peppers</dc:creator><pubDate>Mon, 14 Jul 2008 21:55:34 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-892373</link><description>&lt;p&gt;Hi Olivstor, I don't think you can invoke the Zen since Tim Peters is the guy that wrote both the Zen AND came up with the idea for doctests :)&lt;/p&gt;

&lt;p&gt;But in terms of practicality, I think it would be straightforward to come up with some rules for when to use which test framework; e.g., if you need a big long list of fixtures, please use something besides a doctest.&lt;/p&gt;

&lt;p&gt;So, the "obvious" way to do it would be to look at the testing needs and then let dictate which tool to use.&lt;/p&gt;

&lt;p&gt;The "one obvious way to do it" doesn't mean (by my interpretation, anyway), to use the same tool for everything.&lt;/p&gt;

&lt;p&gt;Python has for-loops, iterators, generator expressions, and map.  They're all appropriate in different contexts.&lt;/p&gt;

&lt;p&gt;Anyhow, thanks for the comment!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Mon, 14 Jul 2008 20:36:47 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-892315</link><description>&lt;p&gt;I agree with Michael, and shall invoke The Zen:&lt;/p&gt;

&lt;p&gt;"There should be one-- and preferably only one --obvious way to do it"&lt;/p&gt;

&lt;p&gt;If you have useful tests in doctests AND in test modules, you've created two ways to write tests, have violated the Zen, and are condemned to burn in hell surrounded by Javangelists for all eternity.&lt;/p&gt;

&lt;p&gt;In practical terms, though, you're probably OK. I think there just has to be a very clear line drawn about what goes where.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Aaron Oliver</dc:creator><pubDate>Mon, 14 Jul 2008 20:28:17 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-891166</link><description>&lt;p&gt;Hi Michael, Thanks for the comment!&lt;/p&gt;

&lt;p&gt;I'm not sure I understand your point about tests in several places. The tests are in two places at most; the docstring, and then whatever external tests I write. It isn't difficult to trace them all down quickly because everything is in predictable locations.&lt;/p&gt;

&lt;p&gt;I think that the *right kind of tests* are useful as documentation. It's sometimes easier to show rather than tell. Sure, a 200-line docstring is goofy. But I don't find myself writing those kinds of doctests.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Mon, 14 Jul 2008 17:58:21 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-891110</link><description>&lt;p&gt;moved this comment to the reply it was meant to be.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Mon, 14 Jul 2008 17:53:18 -0000</pubDate></item><item><title>Re: Python doctests seem underappreciated</title><link>http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/#comment-890727</link><description>&lt;p&gt;But then you end up with your tests for a module in several places.&lt;/p&gt;

&lt;p&gt;Although typing this:&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; has_no('oh nothing')&lt;br&gt;False&lt;/p&gt;

&lt;p&gt;May not take much longer than: &lt;/p&gt;

&lt;p&gt;assert not has_no('oh nothing')&lt;/p&gt;

&lt;p&gt;but typing in docstrings means I lose the support of my IDE and my real code gets bloated with tests - not are useful documentation.&lt;/p&gt;

&lt;p&gt;Personally I think doctest is *great* for testing documentation, but unittest is more suitable for unit testing. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Michael Foord</dc:creator><pubDate>Mon, 14 Jul 2008 17:16:52 -0000</pubDate></item></channel></rss>
