Exemplo n.º 1
0
 def test_scoring_gap(self):
     gap_score = 42
     # big other penalites so algorithm will choose diagonal path
     score_matrix, _ = solve('S', 'S', gap_score, -100, 42)
     self.assertEqual(0, score_matrix[0, 0])
     self.assertEqual(gap_score, score_matrix[1, 0])
     self.assertEqual(gap_score, score_matrix[0, 1])
Exemplo n.º 2
0
 def test_every_node_has_parent(self):
     seq1 = 'SMART'
     seq2 = 'MARS'
     _, nodes_mapping = solve(seq1, seq2, -2, -5, 5)
     for i in range(len(seq1)):
         for j in range(len(seq2)):
             # every node except root
             if (i, j) != (0, 0):
                 self.assertTrue(len(nodes_mapping[(i, j)]) >= 1)
Exemplo n.º 3
0
 def test_laboratory_example(self):
     seq1 = 'SMART'
     seq2 = 'MARS'
     score_matrix, _ = solve(seq1, seq2, -2, -5, 5)
     self.assertEqual(9, score_matrix[-1, -1])
Exemplo n.º 4
0
 def test_scoring_same(self):
     same_score = 42
     # big other penalites so algorithm will choose diagonal path
     score_matrix, _ = solve('S', 'S', -100, -100, same_score)
     self.assertEqual(0, score_matrix[0, 0])
     self.assertEqual(same_score, score_matrix[1, 1])
Exemplo n.º 5
0
 def test_scoring_different(self):
     diff_score = -5
     # big other penalites so algorithm will choose diagonal path
     score_matrix, _ = solve('S', 'M', -100, diff_score, 100)
     self.assertEqual(0, score_matrix[0, 0])
     self.assertEqual(diff_score, score_matrix[1, 1])