Example #1
0
    def testYes(self):
        """ The manager recognizes every line. """
        manager = RecognizerManager([YesRecognizer()])
        reader = NullReader(10)
        scanner = LogScanner(reader, manager, NoneEjector)

        timer = FromTime(datetime.datetime.now(), [], scanner)
        yeses = list(timer.matches())
        self.assertEqual(len(yeses), 10)

        yeses = list(timer.matches())
        self.assertEqual(len(yeses), 10)
Example #2
0
    def testEmpty(self):
        """ The manager does not recognize, so no results. """
        manager = RecognizerManager([])
        reader = NullReader(10)
        scanner = LogScanner(reader, manager, NoneEjector)

        timer = FromTime(datetime.datetime.now(), [], scanner)
        yeses = list(timer.matches())
        self.assertEqual(len(yeses), 0)