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

Delta Between Two Patch Sets: tests/test_parser.py

Issue 29756669: Noissue - Adapt best practices for trailing commas (python-abp) (Closed)
Left Patch Set: Created April 19, 2018, 12:55 p.m.
Right Patch Set: Re-run script on Python 2, added flake8-commas extension Created April 19, 2018, 2:44 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « setup.py ('k') | tox.ini » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 }, 83 },
84 # Element hiding emulation filters (extended CSS). 84 # Element hiding emulation filters (extended CSS).
85 'foo,~bar#?#:-abp-properties(abc)': { 85 'foo,~bar#?#:-abp-properties(abc)': {
86 'selector': {'type': ST.XCSS, 'value': ':-abp-properties(abc)'}, 86 'selector': {'type': ST.XCSS, 'value': ':-abp-properties(abc)'},
87 'action': FA.HIDE, 87 'action': FA.HIDE,
88 'options': [(OPT.DOMAIN, [('foo', True), ('bar', False)])], 88 'options': [(OPT.DOMAIN, [('foo', True), ('bar', False)])],
89 }, 89 },
90 'foo.com#?#aaa :-abp-properties(abc) bbb': { 90 'foo.com#?#aaa :-abp-properties(abc) bbb': {
91 'selector': { 91 'selector': {
92 'type': ST.XCSS, 92 'type': ST.XCSS,
93 'value': 'aaa :-abp-properties(abc) bbb' 93 'value': 'aaa :-abp-properties(abc) bbb',
94 }, 94 },
95 }, 95 },
96 '#?#:-abp-properties(|background-image: url(data:*))': { 96 '#?#:-abp-properties(|background-image: url(data:*))': {
97 'selector': { 97 'selector': {
98 'type': ST.XCSS, 98 'type': ST.XCSS,
99 'value': ':-abp-properties(|background-image: url(data:*))' 99 'value': ':-abp-properties(|background-image: url(data:*))',
100 }, 100 },
101 'options': [], 101 'options': [],
102 }, 102 },
103 }.items()) 103 }.items())
104 def test_parse_filters(filter_text, expected): 104 def test_parse_filters(filter_text, expected):
105 """Parametric test for filter parsing.""" 105 """Parametric test for filter parsing."""
106 parsed = parse_line(filter_text) 106 parsed = parse_line(filter_text)
107 assert parsed.type == 'filter' 107 assert parsed.type == 'filter'
108 assert parsed.text == filter_text 108 assert parsed.text == filter_text
109 for attribute, expected_value in expected.items(): 109 for attribute, expected_value in expected.items():
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 def test_exception_timing(): 158 def test_exception_timing():
159 result = parse_filterlist(['! good line', '%bad line%']) 159 result = parse_filterlist(['! good line', '%bad line%'])
160 assert next(result) == Comment('good line') 160 assert next(result) == Comment('good line')
161 with pytest.raises(ParseError): 161 with pytest.raises(ParseError):
162 next(result) 162 next(result)
163 163
164 164
165 def test_parse_line_bytes(): 165 def test_parse_line_bytes():
166 line = parse_line(b'! \xc3\xbc') 166 line = parse_line(b'! \xc3\xbc')
167 assert line.text == '\xfc' 167 assert line.text == '\xfc'
LEFTRIGHT

Powered by Google App Engine
This is Rietveld