Test module: wig_tools.py

tests.wig_tools.py

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

wig tool tests

class tests.wig_tools.TestWigTools(methodName='runTest')[source]

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.

setUp()[source]

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_wigData_BigWig()[source]

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_wigData_and_wigTrack_set_region()[source]

test region setter raises sensible errors in wigTrack & wigData

Test object Expectation
whole chromosome selection correctly set region
test_wigData_multi_chromosome()[source]

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_wigTrack_fixedStep()[source]

Test the behaviour of wigTrack with fixedStep wig files

test_wigTrack_region_functions()[source]

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
test_wigTrack_variableStep()[source]

Test the behaviour of wigTrack with variableStep wig files

Test object Expectation
simple wigfile correct wigTrack object
complex wigfile correct wigTrack object

Table Of Contents

Previous topic

Test module: gff_gtf_tools.py

Next topic

Test module: general_classes_and_functions.py

This Page