def test_lessthan_comparison(self, v1, v2, expected): variant1 = _create_nonvariant(*v1, ref_base='A') variant2 = _create_nonvariant(*v2, ref_base='C') lessthan = postprocess_variants._get_contig_based_lessthan(_CONTIGS) self.assertEqual(lessthan(variant1, variant2), expected) self.assertEqual(lessthan(variant1, None), True) self.assertEqual(lessthan(None, variant1), False)
def test_lessthan_comparison(self, v1, v2, expected): variant1 = _create_nonvariant(*v1, ref_base='A') variant2 = _create_nonvariant(*v2, ref_base='C') lessthan = postprocess_variants._get_contig_based_lessthan(_CONTIGS) self.assertEqual(lessthan(variant1, variant2), expected) self.assertEqual(lessthan(variant1, None), True) self.assertEqual(lessthan(None, variant1), False)
def test_merge_variants_and_nonvariants(self, variants, nonvariants, expected): viter = (_simple_variant(*v) for v in variants) nonviter = (_create_nonvariant(*nv) for nv in nonvariants) lessthan = postprocess_variants._get_contig_based_lessthan(_CONTIGS) actual = postprocess_variants.merge_variants_and_nonvariants( viter, nonviter, lessthan) self.assertEqual(list(actual), expected)
def test_merge_variants_and_nonvariants(self, variants, nonvariants, expected): viter = (_simple_variant(*v) for v in variants) nonviter = (_create_nonvariant(*nv) for nv in nonvariants) lessthan = postprocess_variants._get_contig_based_lessthan(_CONTIGS) reader = dummy_reference_reader() actual = postprocess_variants.merge_variants_and_nonvariants( viter, nonviter, lessthan, reader) self.assertEqual(list(actual), expected)
def test_merge_variants_and_nonvariants(self, variants, nonvariants, expected): viter = (_simple_variant(*v) for v in variants) nonviter = (_create_nonvariant(*nv) for nv in nonvariants) lessthan = postprocess_variants._get_contig_based_lessthan(_CONTIGS) reader = dummy_reference_reader() mock_vcf_writer = MockVcfWriter() mock_gvcf_writer = MockVcfWriter() postprocess_variants.merge_and_write_variants_and_nonvariants( viter, nonviter, lessthan, reader, mock_vcf_writer, mock_gvcf_writer) vcf_expected = [_simple_variant(*v) for v in variants] self.assertEqual(mock_vcf_writer.variants_written, vcf_expected) self.assertEqual(mock_gvcf_writer.variants_written, expected)