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

Side by Side Diff: tests/test_parser.py

Issue 29933555: Noissue - fix coding style and adjust linting config (Closed) Base URL: https://hg.adblockplus.org/python-abp
Patch Set: Created Nov. 1, 2018, 11:21 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 }, 60 },
61 '@@http://bla$~script,~other,sitekey=foo|bar': { 61 '@@http://bla$~script,~other,sitekey=foo|bar': {
62 'selector': {'type': ST.URL_PATTERN, 'value': 'http://bla'}, 62 'selector': {'type': ST.URL_PATTERN, 'value': 'http://bla'},
63 'action': FA.ALLOW, 63 'action': FA.ALLOW,
64 'options': [ 64 'options': [
65 (OPT.SCRIPT, False), 65 (OPT.SCRIPT, False),
66 (OPT.OTHER, False), 66 (OPT.OTHER, False),
67 (OPT.SITEKEY, ['foo', 'bar']), 67 (OPT.SITEKEY, ['foo', 'bar']),
68 ], 68 ],
69 }, 69 },
70 "||foo.com^$csp=script-src 'self' * 'unsafe-inline',script,sitekey=foo," + 70 "||foo.com^$csp=script-src 'self' * 'unsafe-inline',script,sitekey=foo,"
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 ], 81 ],
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 def test_exception_timing(): 218 def test_exception_timing():
219 result = parse_filterlist(['! good line', '%bad line%']) 219 result = parse_filterlist(['! good line', '%bad line%'])
220 assert next(result) == Comment('good line') 220 assert next(result) == Comment('good line')
221 with pytest.raises(ParseError): 221 with pytest.raises(ParseError):
222 next(result) 222 next(result)
223 223
224 224
225 def test_parse_line_bytes(): 225 def test_parse_line_bytes():
226 line = parse_line(b'! \xc3\xbc') 226 line = parse_line(b'! \xc3\xbc')
227 assert line.text == '\xfc' 227 assert line.text == '\xfc'
OLDNEW

Powered by Google App Engine
This is Rietveld