Back to index

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

List of all members.

Public Member Functions

def setUp
def test_file_record_parser
def test_wrong_file_parser

Public Attributes

 files
 pops_indivs
 num_loci

Detailed Description

Definition at line 76 of file test_PopGen_GenePop_nodepend.py.


Member Function Documentation

Definition at line 77 of file test_PopGen_GenePop_nodepend.py.

00077 
00078     def setUp(self):
00079         self.files = map(lambda x: os.path.join("PopGen", x),
00080              ["c2line.gen", "c3line.gen", "c2space.gen",
00081               "c3space.gen", "haplo3.gen", "haplo2.gen"])
00082         self.pops_indivs = [
00083             (3, [4, 3, 5]),
00084             (3, [4, 3, 5]),
00085             (3, [4, 3, 5]),
00086             (3, [4, 3, 5]),
00087             (3, [4, 3, 5]),
00088             (3, [4, 3, 5])
00089         ]
00090         self.num_loci = [3, 3, 3, 3, 3, 3]

Basic operation of the File Record Parser.

Definition at line 91 of file test_PopGen_GenePop_nodepend.py.

00091 
00092     def test_file_record_parser(self):
00093         """Basic operation of the File Record Parser.
00094         """
00095         for index in range(len(self.files)):
00096             fname = self.files[index]
00097             rec = FileParser.read(fname)
00098             assert isinstance(rec, FileParser.FileRecord)
00099             assert len(rec.loci_list) == self.num_loci[index]
00100             for skip in range(self.pops_indivs[index][0]):
00101                 if rec.skip_population() == False:
00102                     raise Error("Not enough populations")
00103             if rec.skip_population() == True:
00104                     raise Error("Too much populations")
00105             for i in range(self.pops_indivs[index][0]):
00106                 continue
00107                 assert len(rec.populations[i]) == \
00108                            self.pops_indivs[index][1][i]
00109             rec._handle.close() #TODO - Needs a proper fix

Testing the ability to deal with wrongly formatted files

Definition at line 110 of file test_PopGen_GenePop_nodepend.py.

00110 
00111     def test_wrong_file_parser(self):
00112         """Testing the ability to deal with wrongly formatted files
00113         """
00114         f = open(os.path.join("PopGen", "fdist1"))
00115         try:
00116             rec = GenePop.read(f)
00117             raise Error("Should have raised exception")
00118         except ValueError:
00119             pass
00120         f.close()

Here is the call graph for this function:


Member Data Documentation

Definition at line 78 of file test_PopGen_GenePop_nodepend.py.

Definition at line 89 of file test_PopGen_GenePop_nodepend.py.

Definition at line 81 of file test_PopGen_GenePop_nodepend.py.


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