def test_bad(self): """Should reject bad data if strict""" result = parse_clustal(BAD, strict=False) self.assertEqual(dict(result), {}) # should fail unless we turned strict processing off with self.assertRaises(RecordError): dict(parse_clustal(BAD))
def test_real(self): """Should handle real Clustal output""" data = parse_clustal(REAL) self.assertEqual(dict(data), { 'abc': 'GCAUGCAUGCAUGAUCGUACGUCAGCAUGCUAGACUGCAUACGUACGUACGCAUGCAUCA' 'GUCGAUACGUACGUCAGUCAGUACGUCAGCAUGCAUACGUACGUCGUACGUACGU-CGAC' 'UGACUAGUCAGCUAGCAUCGAUCAGU', 'def': '------------------------------------------------------------' '-----------------------------------------CGCGAUGCAUGCAU-CGAU' 'CGAUCAGUCAGUCGAU----------', 'xyz': '------------------------------------------------------------' '-------------------------------------CAUGCAUCGUACGUACGCAUGAC' 'UGCUGCAUCA----------------' })
def test_real(self): """Should handle real Clustal output""" data = parse_clustal(REAL) self.assertEqual( dict(data), { 'abc': 'GCAUGCAUGCAUGAUCGUACGUCAGCAUGCUAGACUGCAUACGUACGUACGCAUGCAUCA' 'GUCGAUACGUACGUCAGUCAGUACGUCAGCAUGCAUACGUACGUCGUACGUACGU-CGAC' 'UGACUAGUCAGCUAGCAUCGAUCAGU', 'def': '------------------------------------------------------------' '-----------------------------------------CGCGAUGCAUGCAU-CGAU' 'CGAUCAGUCAGUCGAU----------', 'xyz': '------------------------------------------------------------' '-------------------------------------CAUGCAUCGUACGUACGCAUGAC' 'UGCUGCAUCA----------------' })
def test_space_labels(self): """Should tolerate spaces in labels""" result = parse_clustal(SPACE_LABELS) self.assertEqual(dict(result), {'abc': 'uca', 'def ggg': 'ccc'})
def test_two(self): """Should handle two-sequence input correctly""" result = parse_clustal(TWO) self.assertEqual(dict(result), {'abc': 'uuuaaa', 'def': 'cccggg'})
def test_minimal(self): """Should handle single-line input correctly""" result = parse_clustal([MINIMAL]) # expects seq of lines self.assertEqual(dict(result), {'abc': 'ucag'})
def test_null(self): """Should return empty dict and list on null input""" result = parse_clustal([]) self.assertEqual(dict(result), {})