def test_fast_valid(self): for j in range(50): L = random.randint(1, 10) peptide = ''.join([random.choice(self.labels) for _ in range(L)]) self.assertTrue(parser.fast_valid(peptide, labels=self.labels)) self.assertTrue(parser.valid(peptide, labels=self.labels)) self.assertTrue(parser.valid(peptide)) for aa in set(peptide): bad = peptide.replace(aa, 'Z') self.assertFalse(parser.fast_valid(bad, labels=self.labels)) self.assertFalse(parser.valid(bad, labels=self.labels))
def test_valid(self): for j in range(50): L = random.randint(1, 10) peptide = ''.join([random.choice(self.labels) for _ in range(L)]) modseqs = parser.isoforms(peptide, variable_mods=self.potential, fixed_mods=self.constant, labels=self.labels) self.assertFalse(parser.valid('H-' + peptide, labels=self.labels)) for s in modseqs: self.assertTrue(parser.valid(s, labels=self.extlabels)) for aa in set(peptide): bad = s.replace(aa, 'Z') self.assertFalse(parser.fast_valid(bad, labels=self.labels)) self.assertFalse(parser.valid(bad, labels=self.labels))