class ContigsWrapperTestCase(unittest.TestCase):

    def setUp(self):
        self.case = ContigsWrapper("ANVW00000000", "ANVW01000000")

    def tearDown(self):
        del self.case

    def test_add_contigs(self):
        contigs = [('ANVW01000001', 'ACTGATGGCTGATCGTACGGATTGGCATCGTACTATCGATCAGCTGAGCTACG'),
                   ('ANVW01000002', 'TTTCGAGCTGGACTGATGGCATCGGCAGGACGAGCTTCAGCTACGATCGAAA'),
                   ('ANVW01000003', 'CCTAAGCTGGGATCGATTGAGCTAGCATTGACACACCACACCCATTTTTGT'),
                   ('ANVW01000004', 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAATTTTTTCCATTTTTACTACTAGC')]
        self.case.add_contigs(contigs)
        self.assertEqual(self.case.contigs, contigs)
        self.assertEqual(self.case.numcontigs, 4)
        self.assertEqual(self.case.basepairs, 208)
        self.assertIsNotNone(self.case.checksum)

    def test_generate_checksum(self):
        self.case.contigs = [("a", "atcg"), ("b", "t"), ("c", "actgatgtg")]
        self.case.generate_checksum()
        result = "517e0a5acb941ce868da1e285a8c1372"
        self.assertEqual(self.case.checksum,result)

    def test_generate_kwargs(self):
        with self.assertRaises(TypeError):
            self.case.generate_kwargs()

        sequences = [("a", "atcg"), ("b", "t"), ("c", "actgatgtg")]
        self.case.add_contigs(sequences)
        self.case.dict["is_from"] = "CORE"
        results = {"name":"ANVW01000001",
                   "genome":"ANVW00000000",
                   "sequence":"actactactact",
                   "is_from":"CORE"}
        self.assertEqual(self.case.generate_kwargs("ANVW01000001", "actactactact"), results)
 def setUp(self):
     self.case = ContigsWrapper("ANVW00000000", "ANVW01000000")