# Path: dark/cigar.py
# (CINS_STR, CDEL_STR, CMATCH_STR, CEQUAL_STR, CDIFF_STR,
#  CHARD_CLIP_STR) = 'IDM=XH'
# def dna2cigar(s1, s2, concise=False):
# def makeCigar(reference, query, noEdgeInsertions=True):
# def cigarTuplesToOperations(tuples, includeHardClip=True):
# def softClippedOffset(offset, pairs, cigarOperations):
# def insertionOffset(offset, pairs, cigarOperations):


from unittest import TestCase
from pysam import CSOFT_CLIP, CHARD_CLIP, CMATCH, CINS
from dark.cigar import (
    CINS_STR, CDEL_STR, CMATCH_STR, CEQUAL_STR, CDIFF_STR,
    dna2cigar, makeCigar, cigarTuplesToOperations, softClippedOffset,
    insertionOffset)
        self.assertEqual('2M', dna2cigar('GA', 'TA', concise=True))

    def testMixedMatch(self):
        """
        If two strings with matching and non-matching regions must result
        in the expected CIGAR string.
        """
        self.assertEqual('3=4X5=2X',
                         dna2cigar('ACGTTTTCCCTTGG',
                                   'ACGAAAACCCTTTT'))

    def testMixedMatchConcise(self):
        """
        If two strings with matching and non-matching regions must result
        in the expected CIGAR string when the concise argument is True.
        """
        self.assertEqual('14M',
                         dna2cigar('ACGTTTTCCCTTGG',
                                   'ACGAAAACCCTTTT', concise=True))


class TestMakeCigar(TestCase):
    """
    Test making CIGAR strings.
    """
    def testEmptyReference(self):
        """
        If the reference is empty, a ValueError must be raised.
        """
        error = r"^Empty reference$"

# Path: dark/cigar.py
# (CINS_STR, CDEL_STR, CMATCH_STR, CEQUAL_STR, CDIFF_STR,
#  CHARD_CLIP_STR) = 'IDM=XH'
# def dna2cigar(s1, s2, concise=False):
# def makeCigar(reference, query, noEdgeInsertions=True):
# def cigarTuplesToOperations(tuples, includeHardClip=True):
# def softClippedOffset(offset, pairs, cigarOperations):
# def insertionOffset(offset, pairs, cigarOperations):


# Path: test/test_cigar.py
from unittest import TestCase
from pysam import CSOFT_CLIP, CHARD_CLIP, CMATCH, CINS
from dark.cigar import (
    CINS_STR, CDEL_STR, CMATCH_STR, CEQUAL_STR, CDIFF_STR,
    dna2cigar, makeCigar, cigarTuplesToOperations, softClippedOffset,
    insertionOffset)

        self.assertEqual('2M', dna2cigar('GA', 'TA', concise=True))

    def testMixedMatch(self):
        """
        If two strings with matching and non-matching regions must result
        in the expected CIGAR string.
        """
        self.assertEqual('3=4X5=2X',
                         dna2cigar('ACGTTTTCCCTTGG',
                                   'ACGAAAACCCTTTT'))

    def testMixedMatchConcise(self):
        """
        If two strings with matching and non-matching regions must result
        in the expected CIGAR string when the concise argument is True.
        """
        self.assertEqual('14M',
                         dna2cigar('ACGTTTTCCCTTGG',
                                   'ACGAAAACCCTTTT', concise=True))


class TestMakeCigar(TestCase):
    """
    Test making CIGAR strings.
    """
    def testEmptyReference(self):
        """
        If the reference is empty, a ValueError must be raised.
        """
        error = r"^Empty reference$"

        self.assertRaisesRegex(ValueError, error, makeCigar, '', 'ACGT')