A module containing tests for the general_classes module I’m using in general_classes.py. These tests use the standard unittest package and extend the unittest.TestCase class.
module_version: | 1.0 |
---|---|
created_on: | 2013-11-26 |
Test the classes defined in general_classes.py.
Each function is tested with existing and non-existent instances of the variable 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 region setter generic_set_region
Test object | Expectation |
---|---|
no args/first arg not string | raise TypeError |
poorly formatted string | raise ValueError |
second & third args not int | raise TypeError |
just chr id | sets selector key but not start/stop i.e., select whole chromosome |
valid string representation | correct selector setting |
valid triple arg | correct selector setting |
tests the openfile function raises sensible errors/data
Test object | Expectation |
---|---|
filename is not a string | TypeError |
file doesn’t exist | IOError |
correctly reads test files | Correct file-data |
test the region class contructor raises sensible errors
Test object | Expectation |
---|---|
first and second args not string | raise TypeError |
third and fouth args not int | raise TypeError |
strand and desc not string | raise TypeError |
seq not string or Seq | raise TypeError |
seqType not string | raise TypeError |