Пример #1
0
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'})
Пример #2
0
class GameTestInputTypeInvalidInput2(unittest.TestCase):
    """
    class for testing alignment game
    """

    def setUp(self):
        self.algo = AlignmentGame('ACCC', 'AB-C', 2, -1, "a")

    def tearDown(self):
        del self.algo

    def test_invalid_input_panalty(self):
        """
        Testing for invalid input panalty
        """
        input_validation = self.algo.validate_input()
        self.assertEqual(input_validation, {'error': 'Invalid input sequence'})
Пример #3
0
class GameTestInputTypeNullInput2(unittest.TestCase):
    """
    class for testing alignment game
    """

    def setUp(self):
        self.algo = AlignmentGame('AA-TU', '', 2, -1, -1)

    def tearDown(self):
        del self.algo

    def test_null_input2(self):
        """
        Testing for one null input
        """
        input_validation = self.algo.validate_input()
        self.assertEqual(input_validation, {'error': 'inputs are not entered'})
Пример #4
0
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'])