Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
Julius Booth committed Feb 5, 2019
1 parent 652dd80 commit b0a2ff4
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions prince/tests/test_match_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,24 @@ def test_nonsense_record(self):
get_reads_records("dasd")

def test_get_small_reads_records(self):
record1,record2,gzip_handle1,gzip_handle2 = get_reads_records(self.PATH_PREFIX + "small_test")
record1,record2,gzip_handle1,gzip_handle2,filename = get_reads_records(self.PATH_PREFIX + "small_test")
self.assertIsNotNone(record1)
self.assertIsNotNone(record2)
self.assertNotEqual(record1, record2)
self.assertIsNone(gzip_handle1)
self.assertIsNone(gzip_handle2)
self.assertEqual(filename, self.PATH_PREFIX + "small_test")

def test_get_medium_reads_records(self):
record1,record2,gzip_handle1,gzip_handle2 = get_reads_records(self.PATH_PREFIX + "medium_test")
record1,record2,gzip_handle1,gzip_handle2,filename = get_reads_records(self.PATH_PREFIX + "medium_test")
self.assertIsNotNone(record1)
self.assertIsNotNone(record2)
self.assertNotEqual(record1, record2)
self.assertIsNone(gzip_handle1)
self.assertIsNone(gzip_handle2)

def test_get_zip_reads_records(self):
record1,record2,gzip_handle1,gzip_handle2 = get_reads_records(self.PATH_PREFIX + "zip_test")
record1,record2,gzip_handle1,gzip_handle2,filename = get_reads_records(self.PATH_PREFIX + "zip_test")
self.assertIsNotNone(record1)
self.assertIsNotNone(record2)
self.assertNotEqual(record1, record2)
Expand All @@ -44,7 +45,7 @@ def test_get_zip_reads_records(self):
self.assertIsNotNone(gzip_handle2)

def test_get_zip_two_lines_reads_records_tab_split(self):
record1,record2,gzip_handle1,gzip_handle2 = get_reads_records(self.PATH_PREFIX + "zip_test2_1.fastq.gz\t" + self.PATH_PREFIX + "zip_test2_2.fastq.gz")
record1,record2,gzip_handle1,gzip_handle2,filename = get_reads_records(self.PATH_PREFIX + "zip_test2_1.fastq.gz\t" + self.PATH_PREFIX + "zip_test2_2.fastq.gz")
self.assertIsNotNone(record1)
self.assertIsNotNone(record2)
self.assertNotEqual(record1, record2)
Expand All @@ -53,13 +54,14 @@ def test_get_zip_two_lines_reads_records_tab_split(self):
self.assertIsNotNone(gzip_handle2)

def test_get_zip_two_lines_reads_records_space_split(self):
record1,record2,gzip_handle1,gzip_handle2 = get_reads_records(self.PATH_PREFIX + "zip_test2_1.fastq.gz " + self.PATH_PREFIX + "zip_test2_2.fastq.gz")
record1,record2,gzip_handle1,gzip_handle2,filename = get_reads_records(self.PATH_PREFIX + "zip_test2_1.fastq.gz " + self.PATH_PREFIX + "zip_test2_2.fastq.gz")
self.assertIsNotNone(record1)
self.assertIsNotNone(record2)
self.assertNotEqual(record1, record2)
self.assertNotEqual(gzip_handle1, gzip_handle2)
self.assertIsNotNone(gzip_handle1)
self.assertIsNotNone(gzip_handle2)
self.assertEqual(filename, self.PATH_PREFIX + "zip_test2_1.fastq.gz")


class MatchScoreTest(unittest.TestCase):
Expand All @@ -80,14 +82,17 @@ def setUp(self):


def test_compute_match_score(self):
match_score_small = compute_match_score(self.PATH_PREFIX + "small_test", self.template_obj, 25, self.primers)
match_score_medium_1 = compute_match_score(self.PATH_PREFIX + "medium_test", self.template_obj, 25, self.primers)
match_score_small, filename_small = compute_match_score(self.PATH_PREFIX + "small_test", self.template_obj, 25, self.primers)
match_score_medium_1, filename_medium_1 = compute_match_score(self.PATH_PREFIX + "medium_test", self.template_obj, 25, self.primers)

match_score_medium_2 = compute_match_score(self.PATH_PREFIX + "medium_test1.fq " + self.PATH_PREFIX + "medium_test2.fq", self.template_obj, 25, self.primers)
match_score_medium_2, filename_medium_2 = compute_match_score(self.PATH_PREFIX + "medium_test1.fq " + self.PATH_PREFIX + "medium_test2.fq", self.template_obj, 25, self.primers)

self.assertEqual(filename_medium_1, self.PATH_PREFIX + "medium_test")

self.assertEqual(match_score_small, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
self.assertEqual(match_score_medium_1, match_score_medium_2)
self.assertEqual(match_score_medium_1, [1.0, 3.0, 2.0, 1.0, 0.0, 1.0, 2.0, 4.0, 1.0, 3.0, 0.5, 0.0, 0.0, 7.0, 0.25, 0.4444444444444444, 0.0, 4.0, 0.0, 0.0, 0.0, 8.0, 6.0, 0.0])


if __name__ == '__main__':
unittest.main()

0 comments on commit b0a2ff4

Please sign in to comment.