Пример #1
0
    def test_search_multiline_string(self):
        settings = self.get_settings()
        searcher = Searcher(settings)
        testfile = self.get_test_file()
        results = []
        try:
            fo = open(testfile, 'r')
            results = searcher.search_line_iterator(fo)
            fo.close()
        except IOError as e:
            print('IOError: {0!s}: {1!s}'.format(e, sf))
        self.assertEqual(len(results), 2)

        firstResult = results[0]
        self.assertEqual(firstResult.linenum, 23)
        self.assertEqual(firstResult.match_start_index, 3)
        self.assertEqual(firstResult.match_end_index, 11)

        secondResult = results[1]
        self.assertEqual(secondResult.linenum, 29)
        self.assertEqual(secondResult.match_start_index, 24)
        self.assertEqual(secondResult.match_end_index, 32)
Пример #2
0
    def test_search_multiline_string(self):
        settings = self.get_settings()
        searcher = Searcher(settings)
        testfile = self.get_test_file()
        results = []
        try:
            fo = open(testfile, 'r')
            results = searcher.search_line_iterator(fo)
            fo.close()
        except IOError as e:
            print('IOError: {0!s}'.format(e))
        self.assertEqual(len(results), 2)

        firstResult = results[0]
        self.assertEqual(firstResult.linenum, 23)
        self.assertEqual(firstResult.match_start_index, 3)
        self.assertEqual(firstResult.match_end_index, 11)

        secondResult = results[1]
        self.assertEqual(secondResult.linenum, 29)
        self.assertEqual(secondResult.match_start_index, 24)
        self.assertEqual(secondResult.match_end_index, 32)