# Path: seal/lib/aligner/mapping.py
# class SimpleMapping(Mapping):
#     def __init__(self):
#         super(SimpleMapping, self).__init__()
#         self.__name = ""
#         self.__base_qualities = array.array('B')
#         self.__cigar = []
#         self.__tags = []
#         self.__seq = ""
# 
#     def set_name(self, name):
#         self.__name = name
# 
#     def set_base_qualities(self, bq):
#         if bq is not None and not isinstance(bq, array.array):
#             raise TypeError("Invalid type for base qualities (%s)" % str(type(bq)))
#         self.__base_qualities = bq
# 
#     def set_cigar(self, cig):
#         if cig is not None and not isinstance(cig, list):
#             raise TypeError("Invalid type for cigar (%s)" % str(type(cig)))
#         self.__cigar = cig
# 
#     def add_tag(self, tag):
#         self.__tags.append(tag)
# 
#     def set_seq_5(self, s):
#         self.__seq = s
# 
#     def get_name(self):
#         return self.__name
# 
#     def get_base_qualities(self):
#         return self.__base_qualities
# 
#     def get_cigar(self):
#         return self.__cigar
# 
#     def each_tag(self):
#         for t in self.__tags:
#             yield t
# 
#     def get_seq_5(self):
#         return self.__seq
# 
#     def get_seq_len(self):
#         return len(self.__seq)


import unittest
import array
import tseal.test_utils as tu
from seal.lib.io.sam_formatter import SamFormatter
from seal.lib.aligner.mapping import SimpleMapping
#
# You should have received a copy of the GNU General Public License
# along with Seal.  If not, see <http://www.gnu.org/licenses/>.





class TestSamFormatter(unittest.TestCase):

    def setUp(self):
        self.mapping = SimpleMapping()
        self.f = SamFormatter()

    def test_default(self):
        self.assertEqual("\t".join( map(str, ['', 0, "*", 0, 0, "*", "*", 0, 0, "", "" ])), self.__do_format())

    def test_name(self):
        self.mapping.set_name("my name")
        self.assertEqual("\t".join( map(str, ["my name", 0, "*", 0, 0, "*", "*", 0, 0, "", "" ])), self.__do_format())

    def test_flag(self):
        self.mapping.flag = 163
        self.assertEqual("\t".join( map(str, ['', 163, "*", 0, 0, "*", "*", 0, 0, "", "" ])), self.__do_format())

    def test_reference(self):
        self.mapping.tid = "chr21"
        self.assertEqual("\t".join( map(str, ['', 0, "chr21", 0, 0, "*", "*", 0, 0, "", "" ])), self.__do_format())

    def test_mate_reference(self):

# Path: seal/lib/aligner/mapping.py
# class SimpleMapping(Mapping):
#     def __init__(self):
#         super(SimpleMapping, self).__init__()
#         self.__name = ""
#         self.__base_qualities = array.array('B')
#         self.__cigar = []
#         self.__tags = []
#         self.__seq = ""
# 
#     def set_name(self, name):
#         self.__name = name
# 
#     def set_base_qualities(self, bq):
#         if bq is not None and not isinstance(bq, array.array):
#             raise TypeError("Invalid type for base qualities (%s)" % str(type(bq)))
#         self.__base_qualities = bq
# 
#     def set_cigar(self, cig):
#         if cig is not None and not isinstance(cig, list):
#             raise TypeError("Invalid type for cigar (%s)" % str(type(cig)))
#         self.__cigar = cig
# 
#     def add_tag(self, tag):
#         self.__tags.append(tag)
# 
#     def set_seq_5(self, s):
#         self.__seq = s
# 
#     def get_name(self):
#         return self.__name
# 
#     def get_base_qualities(self):
#         return self.__base_qualities
# 
#     def get_cigar(self):
#         return self.__cigar
# 
#     def each_tag(self):
#         for t in self.__tags:
#             yield t
# 
#     def get_seq_5(self):
#         return self.__seq
# 
#     def get_seq_len(self):
#         return len(self.__seq)


# Path: tests/tseal/lib/io/test_sam_formatter.py
import unittest
import array
import tseal.test_utils as tu
from seal.lib.io.sam_formatter import SamFormatter
from seal.lib.aligner.mapping import SimpleMapping

#
# You should have received a copy of the GNU General Public License
# along with Seal.  If not, see <http://www.gnu.org/licenses/>.





class TestSamFormatter(unittest.TestCase):

    def setUp(self):
        self.mapping = SimpleMapping()
        self.f = SamFormatter()

    def test_default(self):
        self.assertEqual("\t".join( map(str, ['', 0, "*", 0, 0, "*", "*", 0, 0, "", "" ])), self.__do_format())

    def test_name(self):
        self.mapping.set_name("my name")
        self.assertEqual("\t".join( map(str, ["my name", 0, "*", 0, 0, "*", "*", 0, 0, "", "" ])), self.__do_format())

    def test_flag(self):
        self.mapping.flag = 163
        self.assertEqual("\t".join( map(str, ['', 163, "*", 0, 0, "*", "*", 0, 0, "", "" ])), self.__do_format())

    def test_reference(self):
        self.mapping.tid = "chr21"
        self.assertEqual("\t".join( map(str, ['', 0, "chr21", 0, 0, "*", "*", 0, 0, "", "" ])), self.__do_format())

    def test_mate_reference(self):

        self.mapping.mtid = "chr21"