class ScoreCellTests(TestCase): """Tests for ScoreCell class. """ def setUp(self): """Setup for ScoreCell tests.""" self.score_cell = ScoreCell() def test_init(self): """Tests for ScoreCell __init__ function.""" #Test for empty score cell self.assertEqual(self.score_cell.Score, 0) self.assertEqual(self.score_cell.Pointer, None) def test_update(self): """Tests for ScoreCell update function.""" #Test tie up wins self.score_cell.update(1, 1, 1) self.assertEqual(self.score_cell.Score, 1) self.assertEqual(self.score_cell.Pointer, "up") #Test tie diag wins self.score_cell.update(3, 1, 3) self.assertEqual(self.score_cell.Score, 3) self.assertEqual(self.score_cell.Pointer, "diag") #Test up self.score_cell.update(1, 1, 1) self.assertEqual(self.score_cell.Score, 1) self.assertEqual(self.score_cell.Pointer, "up") #Test diag self.score_cell.update(3, 1, 2) self.assertEqual(self.score_cell.Score, 3) self.assertEqual(self.score_cell.Pointer, "diag") #Test left self.score_cell.update(1, 2, 3) self.assertEqual(self.score_cell.Score, 3) self.assertEqual(self.score_cell.Pointer, "left")
def setUp(self): """Setup for NeedlemanWunschMatrix tests.""" self.nw_matrix = NeedlemanWunschMatrix('ACGU', 'CAGU') #Since _init_first_row, _init_first_col and _init_first_cell are #automatically called when NeedlemanWunschMatrix is initialized, #need to change all elements in nw_matrix_empty to 0 to test #that each _init works. self.nw_matrix_empty = \ NeedlemanWunschMatrix('ACGU','CAGU') for i in range(len(self.nw_matrix_empty)): for j in range(len(self.nw_matrix_empty[i])): self.nw_matrix_empty[i][j] = ScoreCell(0)
class ScoreCellTests(TestCase): """Tests for ScoreCell class. """ def setUp(self): """Setup for ScoreCell tests.""" self.score_cell = ScoreCell() def test_init(self): """Tests for ScoreCell __init__ function.""" # Test for empty score cell self.assertEqual(self.score_cell.Score, 0) self.assertEqual(self.score_cell.Pointer, None) def test_update(self): """Tests for ScoreCell update function.""" # Test tie up wins self.score_cell.update(1, 1, 1) self.assertEqual(self.score_cell.Score, 1) self.assertEqual(self.score_cell.Pointer, "up") # Test tie diag wins self.score_cell.update(3, 1, 3) self.assertEqual(self.score_cell.Score, 3) self.assertEqual(self.score_cell.Pointer, "diag") # Test up self.score_cell.update(1, 1, 1) self.assertEqual(self.score_cell.Score, 1) self.assertEqual(self.score_cell.Pointer, "up") # Test diag self.score_cell.update(3, 1, 2) self.assertEqual(self.score_cell.Score, 3) self.assertEqual(self.score_cell.Pointer, "diag") # Test left self.score_cell.update(1, 2, 3) self.assertEqual(self.score_cell.Score, 3) self.assertEqual(self.score_cell.Pointer, "left")
def setUp(self): """Setup for ScoreCell tests.""" self.score_cell = ScoreCell()