Skip to content

Commit dee5535

Browse files
committed
Python: condense tests
This also avoids potential licensing issues.
1 parent 6be78d4 commit dee5535

File tree

1 file changed

+7
-50
lines changed
  • python/ql/test/library-tests/regexparser

1 file changed

+7
-50
lines changed

python/ql/test/library-tests/regexparser/test.py

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,10 @@
33
# minimal example constructed by @erik-krogh
44
baz = re.compile(r'\+0')
55

6-
# examples from LGTM.com
7-
re.compile(r'.*\+0x(?P<offset>[0-9a-f]+)$')
8-
re.compile(r"^\<.*\+0x.*\>$")
9-
re.search(r'^(https?://.*/).+\-0+\.ts$', res, re.MULTILINE)
10-
re.compile('\s+\+0x[0-9a-f]+\s*(.*)')
11-
re.compile("(.*)\+0x([a-f0-9]*)")
12-
LOG_PATTERN = {
13-
'vumi': re.compile(
14-
r'(?P<date>[\d\-\:\s]+)\+0000 .* '
15-
r'Inbound: <Message payload="(?P<message>.*)">'),
16-
'smpp_inbound': re.compile(
17-
r'(?P<date>[\d\-\:\s]+)\+0000 .* '
18-
r'PUBLISHING INBOUND: (?P<message>.*)'),
19-
'smpp_outbound': re.compile(
20-
r'(?P<date>[\d\-\:\s]+)\+0000 .* '
21-
r'Consumed outgoing message <Message payload="(?P<message>.*)">'),
22-
'dispatcher_inbound_message': re.compile(
23-
r'(?P<date>[\d\-\:\s]+)\+0000 Processed inbound message for [a-zA-Z0-9_]+: (?P<message>.*)'),
24-
'dispatcher_outbound_message': re.compile(
25-
r'(?P<date>[\d\-\:\s]+)\+0000 Processed outbound message for [a-zA-Z0-9_]+: (?P<message>.*)'),
26-
'dispatcher_event': re.compile(
27-
r'(?P<date>[\d\-\:\s]+)\+0000 Processed event message for [a-zA-Z0-9_]+: (?P<message>.*)'),
28-
}
29-
re.compile(
30-
'(.*)(?P<frame>\#[0-9]+ 0x[0-9a-f]{8,16}) '
31-
'(?P<lib>[^+]+)\+0x(?P<address>[0-9a-f]{8,16})'
32-
'(?P<symbol_present>)(?P<symbol_name>)')
33-
RE_LINE = re.compile(
34-
r'(?P<vhost>[^ ]+) '
35-
r'(?P<ipaddr>[^ ]+) '
36-
r'(?P<ident>[^ ]+) '
37-
r'(?P<userid>[^ ]+) '
38-
r'\[(?P<datetime>[^\]]+) \+0000\] '
39-
r'"(?P<verb>[^ ]+) /(?P<tool>[^ /?]+)(?P<path>[^ ]*) HTTP/[^"]+" '
40-
r'(?P<status>\d+) '
41-
r'(?P<bytes>\d+) '
42-
r'"(?P<referer>[^"]*)" '
43-
r'"(?P<ua>[^"]*)"'
44-
r'(?P<extra>.*)'
45-
)
46-
re.compile('(?P<frame>\#[0-9]+ 0x[0-9a-f]{8,8}) '
47-
'(?P<lib>[^+]+)\+0x(?P<addr>[0-9a-f]{8,8})')
48-
re.compile(
49-
'(.*)(?P<frame>\#[0-9]+ 0x[0-9a-f]{8,16}) '
50-
'(?P<lib>[^+]+)\+0x(?P<address>[0-9a-f]{8,16})'
51-
'(?P<symbol_present>)(?P<symbol_name>)')
52-
re.match(r'^@@ -1.* \+0,0 @@', self.hdr)
53-
re.compile('(.*)(?P<frame>\#[0-9]+ 0x[0-9a-f]{8,16}) '
54-
'(?P<lib>[^+]+)\+0x(?P<address>[0-9a-f]{8,16})'
55-
'(?P<symbol_present>)(?P<symbol_name>)')
6+
# exerpts from LGTM.com
7+
re.compile(r'\+0x')
8+
re.compile(r'\+0x.*')
9+
re.compile(r'+\-0+\.')
10+
re.compile('\s+\+0x[0-9]+')
11+
re.compile(r'\+0000 .*')
12+
re.compile('\#[0-9]+ 0x[0-9]')

0 commit comments

Comments
 (0)