def test_parse_loc_str_invalid(self): examples = ['abc', '3-8'] for example in examples: with self.assertRaisesRegex( FileFormatError, r'Could not parse location string: ' '"%s"' % example): _parse_loc_str(example)
def test_parse_loc_str_invalid(self): examples = [ 'abc', '3-8'] for example in examples: with self.assertRaisesRegex(FileFormatError, 'Could not parse location string: ' '"%s"' % example): _parse_loc_str(example)
def test_parse_loc_str(self): examples = [ '9', # a single base in the presented sequence '3..8', '<3..8', '3..>8', 'complement(3..>8)', 'complement(join(3..>5,<7..9))', 'join(J00194.1:1..9,3..8)', 'join(3..8,J00194.1:1..9)', '1.9', '1^2'] expects = [ ([(8, 9)], [(False, False)], {'strand': '+'}), ([(2, 8)], [(False, False)], {'strand': '+'}), ([(2, 8)], [(True, False)], {'strand': '+'}), ([(2, 8)], [(False, True)], {'strand': '+'}), ([(2, 8)], [(False, True)], {'strand': '-'}), ([(2, 5), (6, 9)], [(False, True), (True, False)], {'strand': '-'}), ([(2, 8)], [(False, False)], {'strand': '+'}), ([(2, 8)], [(False, False)], {'strand': '+'}), ([(0, 9)], [(False, False)], {'strand': '+'}), ([(0, 1)], [(False, False)], {'strand': '+'})] for example, expect in zip(examples, expects): parsed = _parse_loc_str(example) self.assertEqual(parsed, expect)