Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_PopGen_GenePop_nodepend.ParserTest Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_record_parser
def test_wrong_file_parser

Public Attributes

 handles
 pops_indivs
 num_loci
 marker_len
 pop_names

Detailed Description

Definition at line 25 of file test_PopGen_GenePop_nodepend.py.


Member Function Documentation

Definition at line 26 of file test_PopGen_GenePop_nodepend.py.

00026 
00027     def setUp(self):
00028         files = ["c2line.gen", "c3line.gen", "c2space.gen", "c3space.gen",
00029                  "haplo3.gen", "haplo2.gen"]
00030         self.handles = []
00031         for filename in files:
00032             self.handles.append(open(os.path.join("PopGen", filename)))
00033 
00034         self.pops_indivs = [
00035             (3, [4, 3, 5]),
00036             (3, [4, 3, 5]),
00037             (3, [4, 3, 5]),
00038             (3, [4, 3, 5]),
00039             (3, [4, 3, 5]),
00040             (3, [4, 3, 5])
00041         ]
00042         self.num_loci = [3, 3, 3, 3, 3, 3]
00043         self.marker_len = [2, 3, 2, 3, 3, 2]
00044         self.pop_names = ["4", "b3", "5"]

Definition at line 45 of file test_PopGen_GenePop_nodepend.py.

00045 
00046     def tearDown(self):
00047         for handle in self.handles:
00048             handle.close()

Basic operation of the Record Parser.

Definition at line 49 of file test_PopGen_GenePop_nodepend.py.

00049 
00050     def test_record_parser(self):
00051         """Basic operation of the Record Parser.
00052         """
00053         for index in range(len(self.handles)):
00054             handle = self.handles[index]
00055             rec = GenePop.read(handle)
00056             assert isinstance(rec, GenePop.Record)
00057             assert len(rec.loci_list) == self.num_loci[index]
00058             assert rec.marker_len == self.marker_len[index]
00059             assert len(rec.populations) == self.pops_indivs[index][0]
00060             assert rec.pop_list == self.pop_names
00061             for i in range(self.pops_indivs[index][0]):
00062                 assert len(rec.populations[i]) == \
00063                            self.pops_indivs[index][1][i]

Testing the ability to deal with wrongly formatted files

Definition at line 64 of file test_PopGen_GenePop_nodepend.py.

00064 
00065     def test_wrong_file_parser(self):
00066         """Testing the ability to deal with wrongly formatted files
00067         """
00068         f = open(os.path.join("PopGen", "fdist1"))
00069         try:
00070             rec = GenePop.read(f)
00071             raise Error("Should have raised exception")
00072         except ValueError:
00073             pass
00074         f.close()
00075 

Here is the call graph for this function:


Member Data Documentation

Definition at line 29 of file test_PopGen_GenePop_nodepend.py.

Definition at line 42 of file test_PopGen_GenePop_nodepend.py.

Definition at line 41 of file test_PopGen_GenePop_nodepend.py.

Definition at line 43 of file test_PopGen_GenePop_nodepend.py.

Definition at line 33 of file test_PopGen_GenePop_nodepend.py.


The documentation for this class was generated from the following file: