LEFT | RIGHT |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 'other,match-case,domain=foo.com': { | 71 'other,match-case,domain=foo.com': { |
72 'selector': {'type': ST.URL_PATTERN, 'value': '||foo.com^'}, | 72 'selector': {'type': ST.URL_PATTERN, 'value': '||foo.com^'}, |
73 'action': FA.BLOCK, | 73 'action': FA.BLOCK, |
74 'options': [ | 74 'options': [ |
75 (OPT.CSP, "script-src 'self' * 'unsafe-inline'"), | 75 (OPT.CSP, "script-src 'self' * 'unsafe-inline'"), |
76 ('script', True), | 76 ('script', True), |
77 ('sitekey', ['foo']), | 77 ('sitekey', ['foo']), |
78 ('other', True), | 78 ('other', True), |
79 ('match-case', True), | 79 ('match-case', True), |
80 ('domain', [('foo.com', True)]), | 80 ('domain', [('foo.com', True)]), |
81 ], | |
82 }, | |
83 'bla$~match-case,~csp=csp,~script,~other,~third-party,domain=~bar.com': { | |
84 'selector': {'type': ST.URL_PATTERN, 'value': 'bla'}, | |
85 'action': FA.BLOCK, | |
86 'options': [ | |
87 ('match-case', False), | |
88 ('csp', False), | |
89 ('script', False), | |
90 ('other', False), | |
91 ('third-party', False), | |
92 ('domain', [('bar.com', False)]), | |
93 ], | 81 ], |
94 }, | 82 }, |
95 '@@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': { |
96 'selector': {'type': ST.URL_PATTERN, 'value': 'bla'}, | 84 'selector': {'type': ST.URL_PATTERN, 'value': 'bla'}, |
97 'action': FA.ALLOW, | 85 'action': FA.ALLOW, |
98 'options': [ | 86 'options': [ |
99 ('script', True), | 87 ('script', True), |
100 ('other', True), | 88 ('other', True), |
101 ('domain', [('foo.com', True), ('bar.foo.com', False)]), | 89 ('domain', [('foo.com', True), ('bar.foo.com', False)]), |
102 ('csp', 'c s p'), | 90 ('csp', 'c s p'), |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 def test_exception_timing(): | 181 def test_exception_timing(): |
194 result = parse_filterlist(['! good line', '%bad line%']) | 182 result = parse_filterlist(['! good line', '%bad line%']) |
195 assert next(result) == Comment('good line') | 183 assert next(result) == Comment('good line') |
196 with pytest.raises(ParseError): | 184 with pytest.raises(ParseError): |
197 next(result) | 185 next(result) |
198 | 186 |
199 | 187 |
200 def test_parse_line_bytes(): | 188 def test_parse_line_bytes(): |
201 line = parse_line(b'! \xc3\xbc') | 189 line = parse_line(b'! \xc3\xbc') |
202 assert line.text == '\xfc' | 190 assert line.text == '\xfc' |
LEFT | RIGHT |