for test in bad_cigar_string: yield (check_catch_bad_cigar_input, test, bad_cigar_string[test]) @raises(MetageneError) def check_catch_bad_cigar_input(test, (values, expected)): print Read.build_positions(*values) def test_parse_sam_bitwise_flag(): for test in bitwise_flag: yield (check_parse_sam_bitwise_flag, test, bitwise_flag[test]) def check_parse_sam_bitwise_flag(test, (values, expected)): bitwise_result = Read.parse_sam_bitwise_flag(*values) test_description = "\nTest: \t{}\n".format(test) test_description += "Expected:\t{}\n".format(expected) test_description += "Position:\t{}\n".format(bitwise_result) assert bitwise_result == expected, "{}Error: \tDid not parse bitwise flag as expected.".format(test_description) def test_catch_bad_bitwise_input(): for test in bad_bitwise_flag: yield (check_catch_bad_bitwise_input, test, bad_bitwise_flag[test]) @raises(MetageneError) def check_catch_bad_bitwise_input(test, (values, expected)): print Read.parse_sam_bitwise_flag(*values)
for test in bad_cigar_string: yield (check_catch_bad_cigar_input, test, bad_cigar_string[test]) @raises(MetageneError) def check_catch_bad_cigar_input(test, (values, expected)): print Read.build_positions(*values) def test_parse_sam_bitwise_flag(): for test in bitwise_flag: yield (check_parse_sam_bitwise_flag, test, bitwise_flag[test]) def check_parse_sam_bitwise_flag(test, (values, expected)): bitwise_result = Read.parse_sam_bitwise_flag(*values) test_description = "\nTest: \t{}\n".format(test) test_description += "Expected:\t{}\n".format(expected) test_description += "Position:\t{}\n".format(bitwise_result) assert bitwise_result == expected, "{}Error: \tDid not parse bitwise flag as expected.".format( test_description) def test_catch_bad_bitwise_input(): for test in bad_bitwise_flag: yield (check_catch_bad_bitwise_input, test, bad_bitwise_flag[test]) @raises(MetageneError) def check_catch_bad_bitwise_input(test, (values, expected)): print Read.parse_sam_bitwise_flag(*values)