def test_match_generator(self): pos_txt = StringIO(''.join(self.pos_text)) vcf_txt = StringIO(''.join(self.vcf_text)) diff = list(grep_vcf.match_generator(pos_txt, vcf_txt)) self.assertListEqual( diff, ["8\tvcf line 2\n", "9\tvcf line 3\n", "11\tvcf line 4\n"])
def test_match_generator_bad_pos3(self): vcf_txt = StringIO(''.join(self.vcf_text)) pos_text = self.pos_text[:] pos_text.insert(4, "8.5\tbad position\n") pos_txt = StringIO(''.join(pos_text)) with self.assertRaises(ValueError): _ = list(grep_vcf.match_generator(pos_txt, vcf_txt))
def test_match_generator_bad_vcf2(self): pos_txt = StringIO(''.join(self.pos_text)) vcf_text = self.vcf_text[:] vcf_text.insert(2, "7.5\tbad vcf\n") vcf_txt = StringIO(''.join(vcf_text)) with self.assertRaises(ValueError): _ = list(grep_vcf.match_generator(pos_txt, vcf_txt))
def test_match_generator_vcf_empty(self): pos_txt = StringIO(''.join(self.pos_text[:])) vcf_txt = StringIO('') diff = list(grep_vcf.match_generator(pos_txt, vcf_txt)) self.assertListEqual(diff, [])