# Path: gffutils/merge_criteria.py
# def seqid(acc, cur, components):
# def strand(acc, cur, components):
# def feature_type(acc, cur, components):
# def exact_coordinates_only(acc, cur, components):
# def overlap_end_inclusive(acc, cur, components):
# def overlap_start_inclusive(acc, cur, components):
# def overlap_any_inclusive(acc, cur, components):
# def overlap_end_threshold(threshold):
#     def partial(acc, cur, components):
# def overlap_start_threshold(threshold):
#     def partial(acc, cur, components):
# def overlap_any_threshold(threshold):
#     def partial(acc, cur, components):
# 
# Path: gffutils/test/synth_test_base.py
# class TestWithSynthDB(TestCase):
#     def setUp(self):
#     def _dump_db(self):


from copy import deepcopy
from gffutils import merge_criteria as mc
from gffutils.test.synth_test_base import TestWithSynthDB, num_synthetic_features, num_synthetic_overlap
        merged_count = 0
        for f in merged:
            if f.children:
                self.assertEqual(num_synthetic_overlap, len(f.children), dump)
                merged_count += 1

        self.assertEqual(1, merged_count)

    def test_none(self):
        merged = list(self.db.merge([]))
        dump = self._dump_db()
        self.assertEqual(num_synthetic_features, self.db.count_features_of_type(), dump)
        self.assertEqual(0, len(merged))

    def test_one(self):
        self._merge_and_compare(['basic1'], [[]])

    def test_no_overlap(self):
        self._merge_and_compare(['basic1', 'no_overlap1'], [[],[]])

    def test_perfect_overlap(self):
        self._merge_and_compare(['basic1', 'perfect_overlap1'], [['basic1', 'perfect_overlap1']])

    def test_overlap(self):
        self._merge_and_compare(['basic1', 'adjacent1'], [['basic1', 'adjacent1']])

    def test_any_overlap(self):
        self._merge_and_compare(['basic1', 'overlap_start1'], [['basic1', 'overlap_start1']], merge_criteria=(mc.seqid, mc.overlap_any_inclusive, mc.strand, mc.feature_type))
        self._merge_and_compare(['overlap_start1', 'basic1'], [['basic1', 'overlap_start1']])
        self._merge_and_compare(['adjacent1', 'basic1'], [['basic1', 'adjacent1']], merge_criteria=(mc.seqid, mc.overlap_any_inclusive, mc.strand, mc.feature_type))

# Path: gffutils/merge_criteria.py
# def seqid(acc, cur, components):
# def strand(acc, cur, components):
# def feature_type(acc, cur, components):
# def exact_coordinates_only(acc, cur, components):
# def overlap_end_inclusive(acc, cur, components):
# def overlap_start_inclusive(acc, cur, components):
# def overlap_any_inclusive(acc, cur, components):
# def overlap_end_threshold(threshold):
#     def partial(acc, cur, components):
# def overlap_start_threshold(threshold):
#     def partial(acc, cur, components):
# def overlap_any_threshold(threshold):
#     def partial(acc, cur, components):
# 
# Path: gffutils/test/synth_test_base.py
# class TestWithSynthDB(TestCase):
#     def setUp(self):
#     def _dump_db(self):


# Path: gffutils/test/test_merge.py
from copy import deepcopy
from gffutils import merge_criteria as mc
from gffutils.test.synth_test_base import TestWithSynthDB, num_synthetic_features, num_synthetic_overlap

        merged_count = 0
        for f in merged:
            if f.children:
                self.assertEqual(num_synthetic_overlap, len(f.children), dump)
                merged_count += 1

        self.assertEqual(1, merged_count)

    def test_none(self):
        merged = list(self.db.merge([]))
        dump = self._dump_db()
        self.assertEqual(num_synthetic_features, self.db.count_features_of_type(), dump)
        self.assertEqual(0, len(merged))

    def test_one(self):
        self._merge_and_compare(['basic1'], [[]])

    def test_no_overlap(self):
        self._merge_and_compare(['basic1', 'no_overlap1'], [[],[]])

    def test_perfect_overlap(self):
        self._merge_and_compare(['basic1', 'perfect_overlap1'], [['basic1', 'perfect_overlap1']])

    def test_overlap(self):
        self._merge_and_compare(['basic1', 'adjacent1'], [['basic1', 'adjacent1']])

    def test_any_overlap(self):
        self._merge_and_compare(['basic1', 'overlap_start1'], [['basic1', 'overlap_start1']], merge_criteria=(mc.seqid, mc.overlap_any_inclusive, mc.strand, mc.feature_type))
        self._merge_and_compare(['overlap_start1', 'basic1'], [['basic1', 'overlap_start1']])
        self._merge_and_compare(['adjacent1', 'basic1'], [['basic1', 'adjacent1']], merge_criteria=(mc.seqid, mc.overlap_any_inclusive, mc.strand, mc.feature_type))

        self._merge_and_compare(['adjacent4', 'basic1'], [['basic1', 'adjacent4']], merge_criteria=(mc.seqid, mc.overlap_any_inclusive, mc.strand, mc.feature_type))