# 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)



class TestConstants(TestCase):
    """
    Test constants in dark.cigar
    """
    def testOperations(self):
        """
        Make sure the CIGAR operation strings have the expected one-letter
        codes.
        """
        self.assertEqual('I', CINS_STR)
        self.assertEqual('D', CDEL_STR)
        self.assertEqual('M', CMATCH_STR)
        self.assertEqual('=', CEQUAL_STR)
        self.assertEqual('X', CDIFF_STR)


class TestDNA2CIGAR(TestCase):
    """
    Test the dna2cigar function.
    """
    def testUnequalStrings(self):
        """
        If two unequal strings are passed, a ValueError must be raised.
        """
        error = r"^Sequences 'hey' and 'there' of unequal length \(3 != 5\)\.$"

# 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)




class TestConstants(TestCase):
    """
    Test constants in dark.cigar
    """
    def testOperations(self):
        """
        Make sure the CIGAR operation strings have the expected one-letter
        codes.
        """
        self.assertEqual('I', CINS_STR)
        self.assertEqual('D', CDEL_STR)
        self.assertEqual('M', CMATCH_STR)
        self.assertEqual('=', CEQUAL_STR)
        self.assertEqual('X', CDIFF_STR)


class TestDNA2CIGAR(TestCase):
    """
    Test the dna2cigar function.
    """
    def testUnequalStrings(self):
        """
        If two unequal strings are passed, a ValueError must be raised.
        """
        error = r"^Sequences 'hey' and 'there' of unequal length \(3 != 5\)\.$"

        self.assertRaisesRegex(ValueError, error, dna2cigar, 'hey', 'there')