[BioRuby] doctests for BioRuby
Pjotr Prins
pjotr2008 at thebird.nl
Sun Feb 3 10:05:51 UTC 2008
I have a doctest.rb program that works with BioRuby. Basically you can run
doctest.rb [-v] sourcefilename(s) e.g.
ruby doctest.rb -v Tutorial.rd
Looking for doctests in 1 files
Processing 'Tutorial.rd'Testing 'Testing bioruby'...OK
Total tests: 1; assertions 2; succeeded: 2
Where in this case the Tutorial.rd contains bioruby shell type (you
can check it!):
bioruby> seq = Bio::Sequence::NA.new("atgcatgcaaaa")
==> "atgcatgcaaaa"
bioruby> seq.complement
==> "ttttgcatgcat"
The cool thing is allows writing tests in documentation - doubling as
a unit or regression test and ascertaining the examples in the
documentation are still valid. doctest is big in the Python
community, and I think it is a very good idea. See
http://docs.python.org/lib/module-doctest.html
Question: where should I store this functionality? Should the script
go into:
./bin/
./bin/extra/ (my preference)
./test
or even
./lib/test/doctest/
./lib/testing/doctest/
At this point doctest.rb is not a module - though that may be useful
when people start using doctests in place of unit tests.
Pj.
More information about the BioRuby
mailing list