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

Side by Side Diff: tests/test_parser.py

Issue 29845767: Issue 6685 - Offer incremental filter list downloads (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Remove metadata_keys, yield deletions first Created Aug. 27, 2018, 10:04 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
« abp/filters/renderer.py ('K') | « tests/test_differ.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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 149
150 def test_parse_meta(): 150 def test_parse_meta():
151 line = parse_line('! Homepage : http://aaa.com/b') 151 line = parse_line('! Homepage : http://aaa.com/b')
152 assert line.type == 'metadata' 152 assert line.type == 'metadata'
153 assert line.key == 'Homepage' 153 assert line.key == 'Homepage'
154 assert line.value == 'http://aaa.com/b' 154 assert line.value == 'http://aaa.com/b'
155 155
156 156
157 def test_parse_nonmeta(): 157 def test_parse_nonmeta():
158 line = parse_line('! WrongHeader: something') 158 line = parse_line('! WrongHeader; something')
Sebastian Noack 2018/08/28 19:52:18 To me it seems, this test specifically existed to
rhowell 2018/08/29 21:43:35 Done.
159 assert line.type == 'comment' 159 assert line.type == 'comment'
160 160
161 161
162 def test_parse_instruction(): 162 def test_parse_instruction():
163 line = parse_line('%include foo:bar/baz.txt%') 163 line = parse_line('%include foo:bar/baz.txt%')
164 assert line.type == 'include' 164 assert line.type == 'include'
165 assert line.target == 'foo:bar/baz.txt' 165 assert line.target == 'foo:bar/baz.txt'
166 166
167 167
168 def test_parse_bad_instruction(): 168 def test_parse_bad_instruction():
(...skipping 20 matching lines...) Expand all
189 def test_exception_timing(): 189 def test_exception_timing():
190 result = parse_filterlist(['! good line', '%bad line%']) 190 result = parse_filterlist(['! good line', '%bad line%'])
191 assert next(result) == Comment('good line') 191 assert next(result) == Comment('good line')
192 with pytest.raises(ParseError): 192 with pytest.raises(ParseError):
193 next(result) 193 next(result)
194 194
195 195
196 def test_parse_line_bytes(): 196 def test_parse_line_bytes():
197 line = parse_line(b'! \xc3\xbc') 197 line = parse_line(b'! \xc3\xbc')
198 assert line.text == '\xfc' 198 assert line.text == '\xfc'
OLDNEW
« abp/filters/renderer.py ('K') | « tests/test_differ.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld