Ejemplo n.º 1
0
 def test_alignment_to_clustal_with_bad_input(self):
     BAD = StringIO('\n'.join(['dshfjsdfhdfsj', 'hfsdjksdfhjsdf']))
     result = _clustal_to_alignment(BAD, strict=False)
     self.assertEqual(dict(result), {})
     # should fail unless we turned strict processing off
     with self.assertRaises(ClustalFormatError):
         BAD.seek(0)
         dict(_clustal_to_alignment(BAD))
Ejemplo n.º 2
0
 def test_alignment_to_clustal_with_bad_input(self):
     BAD = StringIO('\n'.join(['dshfjsdfhdfsj', 'hfsdjksdfhjsdf']))
     result = _clustal_to_alignment(BAD, strict=False)
     self.assertEqual(dict(result), {})
     # should fail unless we turned strict processing off
     with self.assertRaises(ClustalFormatError):
         BAD.seek(0)
         dict(_clustal_to_alignment(BAD))
Ejemplo n.º 3
0
 def test_valid_alignment_to_clustal_and_clustal_to_alignment(self):
     import os
     for valid_out in self.valid_clustal_out:
         fname = "test.aln"
         testfile = open(fname, 'w')
         result_before = _clustal_to_alignment(valid_out)
         _alignment_to_clustal(result_before, testfile)
         testfile.close()
         testfile = open(fname, 'r')
         result_after = _clustal_to_alignment(testfile)
         self.assertEquals(result_before, result_after)
     os.remove(fname)
Ejemplo n.º 4
0
 def test_valid_alignment_to_clustal_and_clustal_to_alignment(self):
     import os
     for valid_out in self.valid_clustal_out:
         fname = "test.aln"
         testfile = open(fname, 'w')
         result_before = _clustal_to_alignment(valid_out)
         _alignment_to_clustal(result_before, testfile)
         testfile.close()
         testfile = open(fname, 'r')
         result_after = _clustal_to_alignment(testfile)
         self.assertEquals(result_before, result_after)
     os.remove(fname)
Ejemplo n.º 5
0
 def test_invalid_alignment_to_clustal_and_clustal_to_alignment(self):
     for invalid_out in self.invalid_clustal_out:
         with self.assertRaises(ClustalFormatError):
             dict(_clustal_to_alignment(invalid_out, strict=True))
Ejemplo n.º 6
0
 def test_alignment_to_clustal_with_empty_input(self):
     result = _clustal_to_alignment(StringIO())
     self.assertEqual(dict(result), {})
Ejemplo n.º 7
0
 def test_invalid_alignment_to_clustal_and_clustal_to_alignment(self):
     for invalid_out in self.invalid_clustal_out:
         with self.assertRaises(ClustalFormatError):
             dict(_clustal_to_alignment(invalid_out, strict=True))
Ejemplo n.º 8
0
 def test_alignment_to_clustal_with_empty_input(self):
     result = _clustal_to_alignment(StringIO())
     self.assertEqual(dict(result), {})