| LEFT | RIGHT | 
|---|
| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 158         parse_line('%foo bar%') | 158         parse_line('%foo bar%') | 
| 159 | 159 | 
| 160 | 160 | 
| 161 def test_parse_bad_header(): | 161 def test_parse_bad_header(): | 
| 162     with pytest.raises(ParseError): | 162     with pytest.raises(ParseError): | 
| 163         parse_line('[Adblock 1.1]') | 163         parse_line('[Adblock 1.1]') | 
| 164 | 164 | 
| 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                                '! Homepage  :  http://aaa.com/b', | 169                                '! Homepage  :  http://aaa.com/b', | 
| 169                                '||example.com^', | 170                                '||example.com^', | 
| 170                                '! Checksum: OaopkIiiAl77sSHk/VAWDA', | 171                                '! Checksum: OaopkIiiAl77sSHk/VAWDA', | 
| 171                                '! Note: bla bla']) | 172                                '! Note: bla bla']) | 
| 172 | 173 | 
| 173     assert next(result) == Header('Adblock Plus 1.1') | 174     assert next(result) == Header('Adblock Plus 1.1') | 
|  | 175     assert next(result).type == 'comment' | 
| 174     assert next(result) == Metadata('Homepage', 'http://aaa.com/b') | 176     assert next(result) == Metadata('Homepage', 'http://aaa.com/b') | 
| 175     assert next(result).type == 'filter' | 177     assert next(result).type == 'filter' | 
| 176     assert next(result) == Metadata('Checksum', 'OaopkIiiAl77sSHk/VAWDA') | 178     assert next(result) == Metadata('Checksum', 'OaopkIiiAl77sSHk/VAWDA') | 
| 177     assert next(result).type == 'comment' | 179     assert next(result).type == 'comment' | 
| 178 | 180 | 
| 179     with pytest.raises(StopIteration): | 181     with pytest.raises(StopIteration): | 
| 180         next(result) | 182         next(result) | 
| 181 | 183 | 
| 182 | 184 | 
| 183 def test_exception_timing(): | 185 def test_exception_timing(): | 
| 184     result = parse_filterlist(['! good line', '%bad line%']) | 186     result = parse_filterlist(['! good line', '%bad line%']) | 
| 185     assert next(result) == Comment('good line') | 187     assert next(result) == Comment('good line') | 
| 186     with pytest.raises(ParseError): | 188     with pytest.raises(ParseError): | 
| 187         next(result) | 189         next(result) | 
| 188 | 190 | 
| 189 | 191 | 
| 190 def test_parse_line_bytes(): | 192 def test_parse_line_bytes(): | 
| 191     line = parse_line(b'! \xc3\xbc') | 193     line = parse_line(b'! \xc3\xbc') | 
| 192     assert line.text == '\xfc' | 194     assert line.text == '\xfc' | 
| LEFT | RIGHT | 
|---|