def testDifferentSet(self): """ Testing for acceptance against a read set filter that has seen a set should return C{True} if the new set is totally different. """ rsf = ReadSetFilter(1.0) rsf.accept("title1", self.makeTitleAlignments(0)) self.assertTrue(rsf.accept("title2", self.makeTitleAlignments(1)))
def testRepeatTitle(self): """ Testing for acceptance on a title that has been seen before (in an accepted read set) must raise C{AssertionError}. """ rsf = ReadSetFilter(0.5) rsf.accept("title1", self.makeTitleAlignments(0, 1, 2, 3, 4)) self.assertRaises(AssertionError, rsf.accept, "title1", self.makeTitleAlignments())
def testDifferentSet(self): """ Testing for acceptance against a read set filter that has seen a set should return C{True} if the new set is totally different. """ rsf = ReadSetFilter(1.0) rsf.accept('title1', self.makeTitleAlignments(0)) self.assertTrue(rsf.accept('title2', self.makeTitleAlignments(1)))
def testThresholdRoundsUp(self): """ Testing for acceptance should round up the needed number of new reads. """ rsf = ReadSetFilter(0.5) rsf.accept("title1", self.makeTitleAlignments(0, 1, 2, 3, 4)) # If we pass a read set of size three, two of the reads will need to be # different. self.assertFalse(rsf.accept("title2", self.makeTitleAlignments(0, 1, 6)))
def testInsufficientlyDifferent(self): """ Testing for acceptance against a read set filter that has seen several sets should return C{False} if the new set is insufficiently different. """ rsf = ReadSetFilter(0.5) rsf.accept("title1", self.makeTitleAlignments(0, 1, 2, 3, 4)) rsf.accept("title2", self.makeTitleAlignments(5, 6, 7, 8, 9)) self.assertFalse(rsf.accept("title3", self.makeTitleAlignments(0, 1, 2, 11)))
def testDuplicateSingleReadZeroThreshold(self): """ Testing for acceptance against a read set filter that has already seen the exact set should return C{True} if the C{minNew} threshold is zero. """ rsf = ReadSetFilter(0.0) rsf.accept("title1", self.makeTitleAlignments(0)) self.assertTrue(rsf.accept("title2", self.makeTitleAlignments(0)))
def testRepeatTitle(self): """ Testing for acceptance on a title that has been seen before (in an accepted read set) must raise C{AssertionError}. """ rsf = ReadSetFilter(0.5) rsf.accept('title1', self.makeTitleAlignments(0, 1, 2, 3, 4)) self.assertRaises(AssertionError, rsf.accept, 'title1', self.makeTitleAlignments())
def testDuplicateSingleReadZeroThreshold(self): """ Testing for acceptance against a read set filter that has already seen the exact set should return C{True} if the C{minNew} threshold is zero. """ rsf = ReadSetFilter(0.0) rsf.accept('title1', self.makeTitleAlignments(0)) self.assertTrue(rsf.accept('title2', self.makeTitleAlignments(0)))
def testDuplicateSingleRead(self): """ Testing for acceptance against a read set filter that has already seen the exact set should return C{False} if the C{minNew} threshold is non-zero. """ rsf = ReadSetFilter(0.9) rsf.accept('title1', self.makeTitleAlignments(0)) self.assertFalse(rsf.accept('title2', self.makeTitleAlignments(0)))
def testThresholdRoundsUp(self): """ Testing for acceptance should round up the needed number of new reads. """ rsf = ReadSetFilter(0.5) rsf.accept('title1', self.makeTitleAlignments(0, 1, 2, 3, 4)) # If we pass a read set of size three, two of the reads will need to be # different. self.assertFalse(rsf.accept('title2', self.makeTitleAlignments(0, 1, 6)))
def testInsufficientlyDifferent(self): """ Testing for acceptance against a read set filter that has seen several sets should return C{False} if the new set is insufficiently different. """ rsf = ReadSetFilter(0.5) rsf.accept('title1', self.makeTitleAlignments(0, 1, 2, 3, 4)) rsf.accept('title2', self.makeTitleAlignments(5, 6, 7, 8, 9)) self.assertFalse(rsf.accept('title3', self.makeTitleAlignments(0, 1, 2, 11)))
def testSufficientlyDifferent(self): """ Testing for acceptance against a read set filter that has seen several sets should return C{True} if the new set is sufficiently different. """ rsf = ReadSetFilter(0.5) rsf.accept('title1', self.makeTitleAlignments(0, 1, 2, 3, 4)) rsf.accept('title2', self.makeTitleAlignments(5, 6, 7, 8, 9)) self.assertTrue(rsf.accept('title3', self.makeTitleAlignments(0, 1, 2, 5, 6, 7)))
def testInvalidates(self): """ It must be possible to retrieve the list of titles that were invalidated by an earlier title's read set. """ rsf = ReadSetFilter(0.5) rsf.accept("title1", self.makeTitleAlignments(0)) rsf.accept("title2", self.makeTitleAlignments(0)) rsf.accept("title3", self.makeTitleAlignments(1)) rsf.accept("title4", self.makeTitleAlignments(0)) self.assertEqual(["title2", "title4"], rsf.invalidates("title1"))
def testInvalidates(self): """ It must be possible to retrieve the list of titles that were invalidated by an earlier title's read set. """ rsf = ReadSetFilter(0.5) rsf.accept('title1', self.makeTitleAlignments(0)) rsf.accept('title2', self.makeTitleAlignments(0)) rsf.accept('title3', self.makeTitleAlignments(1)) rsf.accept('title4', self.makeTitleAlignments(0)) self.assertEqual(['title2', 'title4'], rsf.invalidates('title1'))
def testFirstUse(self): """ Testing for acceptance against a read set filter that has not been used should return C{True}. """ titleAlignments = self.makeTitleAlignments() rsf = ReadSetFilter(0.9) self.assertTrue(rsf.accept("title1", titleAlignments))
def testFirstUse(self): """ Testing for acceptance against a read set filter that has not been used should return C{True}. """ titleAlignments = self.makeTitleAlignments() rsf = ReadSetFilter(0.9) self.assertTrue(rsf.accept('title1', titleAlignments))