David W. Lambert <lamber...@corning.com> added the comment: 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? _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4899> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com