Example #1
0
 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)))
Example #2
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())
Example #3
0
 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)))
Example #4
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)))
Example #5
0
 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)))
Example #6
0
 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)))
Example #7
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())
Example #8
0
 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)))
Example #9
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)))
Example #10
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)))
Example #11
0
 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)))
Example #12
0
 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)))
Example #13
0
 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"))
Example #14
0
 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'))
Example #15
0
 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))
Example #16
0
 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))