Ejemplo n.º 1
0
 def test_searching_other_buffer_size(self):
     log = LogReader(self.filename, LogReader.BUFFER_SIZE / 2)
     log.searcher.reset()
     positions = [
         log.search(self.NEEDLE)[0] for _ in xrange(len(self.POSITIONS))
     ]
     self.assertEqual(self.POSITIONS, positions)
Ejemplo n.º 2
0
    def create(self, filename, key=None):
        if filename not in self.available:
            raise KeyError("No log with filename '%s' is available" % filename)

        key = (filename, key)
        r = LogReader(filename)
        self.readers[key] = r
        return r
Ejemplo n.º 3
0
 def test_searching_other_buffer_size(self):
     log = LogReader(self.filename, LogReader.BUFFER_SIZE / 2)
     log.searcher.reset()
     positions = [log.search(self.NEEDLE)[0] for _ in xrange(len(self.POSITIONS))]
     self.assertEqual(self.POSITIONS, positions)