class GameTestInputType2(unittest.TestCase): """ class for testing alignment game """ def setUp(self): self.algo = AlignmentGame('C--TA', 'CACTU', 2, -1, -1) def tearDown(self): del self.algo def test_get_score2(self): """ Ensure that game score get correctly for diferent type of inputs 1 """ self.algo.calculate_score() score = self.algo.get_score() self.assertEqual(score, 1) def test_alignment_result(self): """ Ensure that game alignment result get correctly """ self.algo.calculate_score() alignment_result = self.algo.get_align_result() self.assertEqual(alignment_result, ['match', 'gap', 'gap', 'match', 'mismatch']) def test_validation(self): """ Testing for validation """ input_validation = self.algo.validate_input() self.assertEqual(input_validation, {'error': 'None'})
class GameTest(unittest.TestCase): """ class for testing alignment game """ def setUp(self): self.algo = AlignmentGame('AAAC', 'AAC-', 2, -1, -1) def tearDown(self): del self.algo def test_input_sequence(self): """ Ensure that user inputs sequence get correctly """ input_seq = self.algo.get_input_alignments() self.assertEqual(input_seq[0], 'AAAC') self.assertEqual(input_seq[1], 'AAC-') def test_input_panalties(self): """ Ensure that user panalties get correcly """ input_panalties = self.algo.get_input_panalty() self.assertEqual(input_panalties[0], 2) self.assertEqual(input_panalties[1], -1) self.assertEqual(input_panalties[2], -1) def test_calculate_score(self): """ Ensure that game score get correctly """ input_validation = self.algo.validate_input() self.assertEqual(input_validation, {'error': 'None'}) self.algo.calculate_score() score = self.algo.get_score() self.assertEqual(score, 2) def test_alignment_result(self): """ Ensure that game alignment result get correctly """ self.algo.calculate_score() alignment_result = self.algo.get_align_result() self.assertEqual(alignment_result, ['match', 'match', 'mismatch', 'gap'])