Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: tests/test_parser.py

Issue 29808596: Issue 6748 - Implement rewrite support in python-abp (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Created June 15, 2018, 10:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « abp/filters/parser.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 '@@bla$script,other,domain=foo.com|~bar.foo.com,csp=c s p': { 83 '@@bla$script,other,domain=foo.com|~bar.foo.com,csp=c s p': {
84 'selector': {'type': ST.URL_PATTERN, 'value': 'bla'}, 84 'selector': {'type': ST.URL_PATTERN, 'value': 'bla'},
85 'action': FA.ALLOW, 85 'action': FA.ALLOW,
86 'options': [ 86 'options': [
87 ('script', True), 87 ('script', True),
88 ('other', True), 88 ('other', True),
89 ('domain', [('foo.com', True), ('bar.foo.com', False)]), 89 ('domain', [('foo.com', True), ('bar.foo.com', False)]),
90 ('csp', 'c s p'), 90 ('csp', 'c s p'),
91 ], 91 ],
92 }, 92 },
93 '||content.server.com/files/*.php$rewrite=$1': {
94 'selector': {'type': ST.URL_PATTERN,
95 'value': '||content.server.com/files/*.php'},
96 'action': FA.BLOCK,
97 'options': [
98 ('rewrite', '$1'),
99 ],
100 },
93 # Element hiding filters and exceptions. 101 # Element hiding filters and exceptions.
94 '##ddd': { 102 '##ddd': {
95 'selector': {'type': ST.CSS, 'value': 'ddd'}, 103 'selector': {'type': ST.CSS, 'value': 'ddd'},
96 'action': FA.HIDE, 104 'action': FA.HIDE,
97 'options': [], 105 'options': [],
98 }, 106 },
99 '#@#body > div:first-child': { 107 '#@#body > div:first-child': {
100 'selector': {'type': ST.CSS, 'value': 'body > div:first-child'}, 108 'selector': {'type': ST.CSS, 'value': 'body > div:first-child'},
101 'action': FA.SHOW, 109 'action': FA.SHOW,
102 'options': [], 110 'options': [],
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 def test_exception_timing(): 189 def test_exception_timing():
182 result = parse_filterlist(['! good line', '%bad line%']) 190 result = parse_filterlist(['! good line', '%bad line%'])
183 assert next(result) == Comment('good line') 191 assert next(result) == Comment('good line')
184 with pytest.raises(ParseError): 192 with pytest.raises(ParseError):
185 next(result) 193 next(result)
186 194
187 195
188 def test_parse_line_bytes(): 196 def test_parse_line_bytes():
189 line = parse_line(b'! \xc3\xbc') 197 line = parse_line(b'! \xc3\xbc')
190 assert line.text == '\xfc' 198 assert line.text == '\xfc'
OLDNEW
« no previous file with comments | « abp/filters/parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld