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