diff options
author | wu.zhihui <wu.zhihui1@zte.com.cn> | 2017-02-21 16:35:41 +0800 |
---|---|---|
committer | wu.zhihui <wu.zhihui1@zte.com.cn> | 2017-02-21 16:35:41 +0800 |
commit | 18669642c79370b752914bf4007230411367d9ba (patch) | |
tree | 73d9aec5d373a97fdcfa90a4a871d4dde0f2d8f2 /tests | |
parent | 3e443dff14a2be02b914e66f27b549d0ed4cc600 (diff) |
support multi-line search in grep parser
use finditer with multiline mode
JIRA: QTIP-211
Change-Id: Ib8854f749a0258f6b6775be9b80573f6ac8e47db
Signed-off-by: wu.zhihui <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/collector/grep_test.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/unit/collector/grep_test.py b/tests/unit/collector/grep_test.py index e5d5f8c6..2d4079af 100644 --- a/tests/unit/collector/grep_test.py +++ b/tests/unit/collector/grep_test.py @@ -21,7 +21,9 @@ def logfile(data_root): @pytest.mark.parametrize("regex,expected", [ ('not exist', []), ('Lorem (\S+)', [{'groups': ('ipsum',), 'groupdict': {}}]), - ('nisi ut (?P<name>\S+)', [{'groups': ('aliquip',), 'groupdict': {'name': 'aliquip'}}]) + ('nisi ut (?P<name>\S+)', [{'groups': ('aliquip',), 'groupdict': {'name': 'aliquip'}}]), + ('Lorem\s(\w+)\s.+\nconsectetur\s(\w+)\s.+\n', + [{'groups': ('ipsum', 'adipiscing',), 'groupdict': {}}]) ]) def test_grep_in_file(logfile, regex, expected): matches = grep_in_file(logfile, regex) |