Author LambertDW
Recipients LambertDW, dalloliogm, rhettinger, tim.peters
Date 2009-01-13.17:44:45
SpamBayes Score 0.00450683
Marked as misclassified No
Message-id <1231868688.21.0.408124646821.issue4899@psf.upfronthosting.co.za>
In-reply-to
Content
My goodness, that's the starting base sequence to gene 38c, chromosome 4
of the Columbian caldera cricket!  But seriously...

1) The relevant part of the doc string is this, and this is how it
should read (your argument being "if doctests provided setUp framework
my doc string would look like this!"):

def TpedIterator(handle):

    '''
        Iterates on an TPed file handler.
        Returns Marker objects.

            Tped_stream = open('cricket.sequence','r')
            ti = TpedIterator(Tped_stream)
            for marker in ti:
                use(marker)
    '''


2) (With the caveat that I am unfamilar with your project.)  You should
choose terminology appropriate for your project.  A computer scientist
would expect "file handle" to be an integer.  What you call "handle" is
clearly a "stream" object and therefore of uncommon name.  Since the
file objects are more likely to be from the computer sciences rather
than the biological realm you should stick with "stream".

3) We agree, "Don't Repeat Yourself".  The last two chunks of your file
enable doctest.  I'll guess that similar lines may be found repeated
throughout your sources.  Instead of internal support, write a single
test script that provides external support.  It would process named
files with unittest, doctest.[, and customtests.]
    $ python -c 'import test' glob
There may be a python library for this.  I can't guide you easily
because I built and use my own framework.  Nor have I bothered to figure
out how python runs its own installation tests.

4) Yes, unittest are quite appropriate for your project.  When you move
your docstring tests to unittests try to isolate the tests.  For
instance, the test you've shown couples the TpedIterator with the string
representation of a Marker object.

5) Is your system really so simple that it's useful to run
interactively?  I may be out of touch but I script most of my codes and
tests because I make so many errors and module changes.  In other words,
is your interactive docstring example a reasonable use case?
History
Date User Action Args
2009-01-13 17:44:48LambertDWsetrecipients: + LambertDW, tim.peters, rhettinger, dalloliogm
2009-01-13 17:44:48LambertDWsetmessageid: <1231868688.21.0.408124646821.issue4899@psf.upfronthosting.co.za>
2009-01-13 17:44:47LambertDWlinkissue4899 messages
2009-01-13 17:44:46LambertDWcreate