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

Side by Side Diff: tests/test_parser.py

Issue 29677724: Noissue - make parse_line and parse_filterlist also support byte strings (Closed)
Patch Set: Created Jan. 23, 2018, 4:30 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 | « abp/filters/parser.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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 def test_parse_filterlist(): 153 def test_parse_filterlist():
154 result = parse_filterlist(['! foo', '! Title: bar']) 154 result = parse_filterlist(['! foo', '! Title: bar'])
155 assert list(result) == [Comment('foo'), Metadata('Title', 'bar')] 155 assert list(result) == [Comment('foo'), Metadata('Title', 'bar')]
156 156
157 157
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
164
165 def test_parse_line_bytes():
166 line = parse_line(b'! \xc3\xbc')
167 assert line.text == '\xfc'
OLDNEW
« no previous file with comments | « abp/filters/parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld