def test_write_annot_prot_seqs_2rows(self):
        # clear dictionary
        clear_prot_seq_annots()

        # build dictionary
        add_prot_seq_annot('>name1', [3, 13, 34], 'AGEKHAGGQ')
        add_prot_seq_annot('>name2', [4, 14, 35], 'GGLKAALGT')

        '>name1, putative cleavage sites: [3, 13, 34]\nAGEKHAGGQ\n>name2, putative cleavage sites: [4, 14, 35]\nGGLKAALGT'

        # write dictionary
        write_annot_prot_seqs(_outfilename1)

        # check file was created
        self.assertTrue(os.path.exists(_outfilename1))

        # read test output
        tst_fptr = open(_outfilename1, 'r+')
        tst_output0 = tst_fptr.read()
        tst_fptr.close()

        print
        print('Actual output')
        print('!' + tst_output0 + '!')

        print
        print('Expected output')
        print(
            '!' + '>name1, putative cleavage sites: [3, 13, 34]\nAGEKHAGGQ\n>name2, putative cleavage sites: [4, 14, 35]\nGGLKAALGT' + '!')

        self.assertMultiLineEqual(
            '>name1, putative cleavage sites: [3, 13, 34]\nAGEKHAGGQ\n>name2, putative cleavage sites: [4, 14, 35]\nGGLKAALGT',
            tst_output0, 'Incorrect data')
    def test_write_annot_prot_seqs_1key_2prots(self):
        # clear dictionary
        clear_prot_seq_annots()

        # build dictionary
        add_prot_seq_annot('>name1', [], 'AGEKHAGGQ')
        add_prot_seq_annot('>name1', [], 'GGLKAALGT')

        # write dictionary
        write_annot_prot_seqs(_outfilename2)

        # check file was created
        self.assertTrue(os.path.exists(_outfilename2))

        # read test output
        tst_fptr = open(_outfilename2, 'r+')
        tst_output0 = tst_fptr.read()
        tst_fptr.close()

        print
        print('Actual output')
        print('!' + tst_output0 + '!')

        print
        print('Expected output')
        print('!' + '>name1, putative cleavage sites: <NONE>\nAGEKHAGGQ\nGGLKAALGT' + '!')

        self.assertEqual('>name1, putative cleavage sites: <NONE>\nAGEKHAGGQ\nGGLKAALGT', tst_output0, 'Incorrect data')
    def test_add_prot_seq_annot_no_cleavage_sites(self):
        seq_name = '>name0'
        put_clevs = []
        prot_seq = 'KRKRKRKRKLLLLLLL'
        expected_name = '>name0, putative cleavage sites: <NONE>'

        kv_pair = add_prot_seq_annot(seq_name, put_clevs, prot_seq)

        # assure correct type
        self.assertEqual(list, type(kv_pair), 'Incorrect type')

        # assure correct length
        self.assertEqual(2, len(kv_pair), 'Incorrect length')

        # assure correct key
        self.assertEqual(expected_name, kv_pair[0], 'Incorrect key')

        # assure correct value
        self.assertEqual(prot_seq, kv_pair[1], 'Incorrect value')