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_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')