[Biopython-dev] test for affy.CelFile

Peter Cock p.j.a.cock at googlemail.com
Mon May 19 06:50:47 EDT 2014


On Mon, May 19, 2014 at 3:52 AM, Vincent Davis <vincent at vincentdavis.net> wrote:
> I created a doc test (I have never done Doc tests before) and added a sample
> version3 CEL file in Tests/Affy/. The file is from a project I worked on a
> long time ago. It would be nice to have a smaller sample file. In the mean
> time I compressed the CEL file (5.5MB > 1.1MB) which makes the doc test a
> little messy and uses io.StingIO() (py3 only).

We have a shim for using StringIO on Python 2 and 3 under Bio._py3k
but this isn't really suitable for use in a doctest - it is intended as an
internal API only (leading underscore = private by convention).

Would the bz2.open() method not be simpler? Or gzip.open() should
work if you switch the compression.

I don't know enough about CEL files to answer this, but is there no easy
way to take a subsample of the file? Even zipped this is quite big.

> You can take a look here.
> https://github.com/vincentdavis/biopython/blob/celfile/Bio/Affy/CelFile.py
> https://github.com/vincentdavis/biopython/tree/celfile/Tests/Affy
>
> I guess I am looking for feedback on how to best go about testing
> CelFile.read() I am kinda thinking a "regular" test would be better and keep
> the docs simpler.
>
> Vincent Davis

Yes, the unittest approach would probably be better - we try to
use the doctests primarily as tested-documentation. One of the
regular headaches with doctests is the exact representation of
floating point numbers which varies according to the platform
(Python platform, version, OS) and makes them particular
unsuitable for full testing of numerical code.

Regards,

Peter


More information about the Biopython-dev mailing list