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

Side by Side Diff: tests/test_parser.py

Issue 29879650: Issue 6950 - Don't include headers and metadata from includes into output (Closed)
Patch Set: Test for "Last modified" Created Sept. 14, 2018, 3:32 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 | « 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 def test_parse_filterlist(): 166 def test_parse_filterlist():
167 result = parse_filterlist(['[Adblock Plus 1.1]', 167 result = parse_filterlist(['[Adblock Plus 1.1]',
168 '! Last modified: 26 Jul 2018 02:10 UTC', 168 '! Last modified: 26 Jul 2018 02:10 UTC',
169 '! Homepage : http://aaa.com/b', 169 '! Homepage : http://aaa.com/b',
170 '||example.com^', 170 '||example.com^',
171 '! Checksum: OaopkIiiAl77sSHk/VAWDA', 171 '! Checksum: OaopkIiiAl77sSHk/VAWDA',
172 '! Note: bla bla']) 172 '! Note: bla bla'])
173 173
174 assert next(result) == Header('Adblock Plus 1.1') 174 assert next(result) == Header('Adblock Plus 1.1')
175 assert next(result).type == 'comment' 175 assert next(result) == Metadata('Last modified', '26 Jul 2018 02:10 UTC')
176 assert next(result) == Metadata('Homepage', 'http://aaa.com/b') 176 assert next(result) == Metadata('Homepage', 'http://aaa.com/b')
177 assert next(result).type == 'filter' 177 assert next(result).type == 'filter'
178 assert next(result) == Metadata('Checksum', 'OaopkIiiAl77sSHk/VAWDA') 178 assert next(result) == Metadata('Checksum', 'OaopkIiiAl77sSHk/VAWDA')
179 assert next(result).type == 'comment' 179 assert next(result).type == 'comment'
180 180
181 with pytest.raises(StopIteration): 181 with pytest.raises(StopIteration):
182 next(result) 182 next(result)
183 183
184 184
185 def test_exception_timing(): 185 def test_exception_timing():
186 result = parse_filterlist(['! good line', '%bad line%']) 186 result = parse_filterlist(['! good line', '%bad line%'])
187 assert next(result) == Comment('good line') 187 assert next(result) == Comment('good line')
188 with pytest.raises(ParseError): 188 with pytest.raises(ParseError):
189 next(result) 189 next(result)
190 190
191 191
192 def test_parse_line_bytes(): 192 def test_parse_line_bytes():
193 line = parse_line(b'! \xc3\xbc') 193 line = parse_line(b'! \xc3\xbc')
194 assert line.text == '\xfc' 194 assert line.text == '\xfc'
OLDNEW
« no previous file with comments | « tests/test_differ.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld