A module containing tests for the wig_tools module I’m using in wig_tools.py. These tests use the standard unittest package and extend the unittest.TestCase class.
module_version: | 1.0 |
---|---|
created_on: | 2013-11-22 |
Test the class and functions defined in wig_tools.py.
Each function is tested with existing and non-existent instances of the file or path type that it is designed for. We also test that providing non- string basic python objects produces string representations and doesn’t case a failure.
Initialize the framework for testing.
Define and create a new system temporary directory with the tempfile package for use as an existing directory. A range of wig files with different parameters are created in this directory to test the routines with.
test that the wigData class correctly reads BigWig files
Test object | Expectation |
---|---|
filename not a String | TypeError |
file doesn’t exist | IOError |
bigWigToWig binary doesn’t exist | IOError |
correct args | correct wigData object |
test region setter raises sensible errors in wigTrack & wigData
Test object | Expectation |
---|---|
whole chromosome selection | correctly set region |
test the behaviour of wigData with a file with multiple chromosomes
Test object | Expectation |
---|---|
multi_chr complex wigfile | correct wigData object with correct wigTrack objects |
test that the region related class functions work correctly
Test object | Expectation |
---|---|
no region set | raise ValueError |
len chr1:10000-50000 | 40 kb |
npoints chr1:10000-50000 | 11 |
data chr1:10000-50000 | tuple, 0:positions 1:data |
max chr1:10000-50000 | 3 |
min chr1:10000-50000 | 1 |
mean datapoint | 1.4692307692307693 |
mean basesignal | 0.0050043231063484159 |