Ejemplo n.º 1
0
 def setUp(self):
     """Setup for ScoreMatrix tests."""
     self.score_matrix = ScoreMatrix('AACGU','ACAGU')
     def fill():
         pass
     def traceback():
         pass
     self.score_matrix.fill = fill
     self.score_matrix.traceback = traceback
     
     self.empty_score_matrix = ScoreMatrix('','')
Ejemplo n.º 2
0
 def test_init(self):
     """Tests for ScoreMatrix __init__ function."""
     #Test empty ScoreMatrix
     self.empty_score_matrix = ScoreMatrix('', '')
     self.assertEqual(self.empty_score_matrix.First, '')
     self.assertEqual(self.empty_score_matrix.Second, '')
     self.assertEqual(self.empty_score_matrix.Cols, 1)
     self.assertEqual(self.empty_score_matrix.Rows, 1)
     self.assertEqual(self.empty_score_matrix.GapScore, -1)
     self.assertEqual(self.empty_score_matrix.GapSymbol, '-')
     self.assertEqual(self.empty_score_matrix.FirstAlign, [])
     self.assertEqual(self.empty_score_matrix.SecondAlign, [])
Ejemplo n.º 3
0
    def setUp(self):
        """Setup for ScoreMatrix tests."""
        self.score_matrix = ScoreMatrix('AACGU', 'ACAGU')

        def fill():
            pass

        def traceback():
            pass

        self.score_matrix.fill = fill
        self.score_matrix.traceback = traceback

        self.empty_score_matrix = ScoreMatrix('', '')
Ejemplo n.º 4
0
class ScoreMatrixTests(TestCase):
    """Tests for ScoreCell class.
    """

    def setUp(self):
        """Setup for ScoreMatrix tests."""
        self.score_matrix = ScoreMatrix("AACGU", "ACAGU")

        def fill():
            pass

        def traceback():
            pass

        self.score_matrix.fill = fill
        self.score_matrix.traceback = traceback

        self.empty_score_matrix = ScoreMatrix("", "")

    def test_init(self):
        """Tests for ScoreMatrix __init__ function."""
        # Test empty ScoreMatrix
        self.empty_score_matrix = ScoreMatrix("", "")
        self.assertEqual(self.empty_score_matrix.First, "")
        self.assertEqual(self.empty_score_matrix.Second, "")
        self.assertEqual(self.empty_score_matrix.Cols, 1)
        self.assertEqual(self.empty_score_matrix.Rows, 1)
        self.assertEqual(self.empty_score_matrix.GapScore, -1)
        self.assertEqual(self.empty_score_matrix.GapSymbol, "-")
        self.assertEqual(self.empty_score_matrix.FirstAlign, [])
        self.assertEqual(self.empty_score_matrix.SecondAlign, [])

    def test_str(self):
        """Tests for ScoreMatrix __str__ function."""
        # Test empty ScoreMatrix
        self.assertEqual(self.empty_score_matrix.__str__(), "Empty Score Matrix")

        # Test full ScoreMatrix
        self.assertEqual(
            self.score_matrix.__str__(),
            """\t\tA\tA\tC\tG\tU\n\t0\t0\t0\t0\t0\t0\nA\t0\t0\t0\t0\t0\t0\nC\t0\t0\t0\t0\t0\t0\nA\t0\t0\t0\t0\t0\t0\nG\t0\t0\t0\t0\t0\t0\nU\t0\t0\t0\t0\t0\t0""",
        )

    def test_alignment(self):
        """Tests for ScoreMatrix alignment function."""
        # Should not align since ScoreMatrix base object does not have fill()
        # or traceback() methods.  For testing purposes fill() and traceback()
        # for self.score_matrix do nothing.
        self.assertEqual(self.score_matrix.alignment(), ("", ""))
Ejemplo n.º 5
0
class ScoreMatrixTests(TestCase):
    """Tests for ScoreCell class.
    """
    def setUp(self):
        """Setup for ScoreMatrix tests."""
        self.score_matrix = ScoreMatrix('AACGU', 'ACAGU')

        def fill():
            pass

        def traceback():
            pass

        self.score_matrix.fill = fill
        self.score_matrix.traceback = traceback

        self.empty_score_matrix = ScoreMatrix('', '')

    def test_init(self):
        """Tests for ScoreMatrix __init__ function."""
        #Test empty ScoreMatrix
        self.empty_score_matrix = ScoreMatrix('', '')
        self.assertEqual(self.empty_score_matrix.First, '')
        self.assertEqual(self.empty_score_matrix.Second, '')
        self.assertEqual(self.empty_score_matrix.Cols, 1)
        self.assertEqual(self.empty_score_matrix.Rows, 1)
        self.assertEqual(self.empty_score_matrix.GapScore, -1)
        self.assertEqual(self.empty_score_matrix.GapSymbol, '-')
        self.assertEqual(self.empty_score_matrix.FirstAlign, [])
        self.assertEqual(self.empty_score_matrix.SecondAlign, [])

    def test_str(self):
        """Tests for ScoreMatrix __str__ function."""
        #Test empty ScoreMatrix
        self.assertEqual(self.empty_score_matrix.__str__(),
                         "Empty Score Matrix")

        #Test full ScoreMatrix
        self.assertEqual(self.score_matrix.__str__(),\
"""\t\tA\tA\tC\tG\tU\n\t0\t0\t0\t0\t0\t0\nA\t0\t0\t0\t0\t0\t0\nC\t0\t0\t0\t0\t0\t0\nA\t0\t0\t0\t0\t0\t0\nG\t0\t0\t0\t0\t0\t0\nU\t0\t0\t0\t0\t0\t0""")

    def test_alignment(self):
        """Tests for ScoreMatrix alignment function."""
        #Should not align since ScoreMatrix base object does not have fill()
        #or traceback() methods.  For testing purposes fill() and traceback()
        #for self.score_matrix do nothing.
        self.assertEqual(self.score_matrix.alignment(), ('', ''))
Ejemplo n.º 6
0
 def test_init(self):
     """Tests for ScoreMatrix __init__ function."""
     # Test empty ScoreMatrix
     self.empty_score_matrix = ScoreMatrix("", "")
     self.assertEqual(self.empty_score_matrix.First, "")
     self.assertEqual(self.empty_score_matrix.Second, "")
     self.assertEqual(self.empty_score_matrix.Cols, 1)
     self.assertEqual(self.empty_score_matrix.Rows, 1)
     self.assertEqual(self.empty_score_matrix.GapScore, -1)
     self.assertEqual(self.empty_score_matrix.GapSymbol, "-")
     self.assertEqual(self.empty_score_matrix.FirstAlign, [])
     self.assertEqual(self.empty_score_matrix.SecondAlign, [])