| OLD | NEW | 
|    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  Loading... | 
|  148  |  148  | 
|  149  |  149  | 
|  150 def test_parse_instruction(): |  150 def test_parse_instruction(): | 
|  151     line = parse_line('%include foo:bar/baz.txt%') |  151     line = parse_line('%include foo:bar/baz.txt%') | 
|  152     assert line.type == 'include' |  152     assert line.type == 'include' | 
|  153     assert line.target == 'foo:bar/baz.txt' |  153     assert line.target == 'foo:bar/baz.txt' | 
|  154  |  154  | 
|  155  |  155  | 
|  156 def test_parse_bad_instruction(): |  156 def test_parse_bad_instruction(): | 
|  157     with pytest.raises(ParseError): |  157     with pytest.raises(ParseError): | 
|  158         parse_line('%foo bar%') |  158         parse_line('%include%') | 
|  159  |  159  | 
|  160  |  160  | 
|  161 def test_parse_start(): |  161 def test_parse_start(): | 
|  162     # Header-line lines are headers. |  162     # Header-line lines are headers. | 
|  163     assert parse_line('[Adblock Plus 1.1]', 'start').type == 'header' |  163     assert parse_line('[Adblock Plus 1.1]', 'start').type == 'header' | 
|  164     # Even if they have extra characters around. |  164     # Even if they have extra characters around. | 
|  165     assert parse_line('foo[Adblock Plus 1.1] bar', 'start').type == 'header' |  165     assert parse_line('foo[Adblock Plus 1.1] bar', 'start').type == 'header' | 
|  166  |  166  | 
|  167     # But the inside of the header needs to be right. |  167     # But the inside of the header needs to be right. | 
|  168     assert parse_line('[Adblock Minus 1.1]', 'start').type == 'filter' |  168     assert parse_line('[Adblock Minus 1.1]', 'start').type == 'filter' | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  209     assert next(result) == Metadata('Homepage', 'http://aaa.com/b') |  209     assert next(result) == Metadata('Homepage', 'http://aaa.com/b') | 
|  210     assert next(result).type == 'filter' |  210     assert next(result).type == 'filter' | 
|  211     assert next(result) == Metadata('Checksum', 'OaopkIiiAl77sSHk/VAWDA') |  211     assert next(result) == Metadata('Checksum', 'OaopkIiiAl77sSHk/VAWDA') | 
|  212     assert next(result).type == 'comment' |  212     assert next(result).type == 'comment' | 
|  213  |  213  | 
|  214     with pytest.raises(StopIteration): |  214     with pytest.raises(StopIteration): | 
|  215         next(result) |  215         next(result) | 
|  216  |  216  | 
|  217  |  217  | 
|  218 def test_exception_timing(): |  218 def test_exception_timing(): | 
|  219     result = parse_filterlist(['! good line', '%bad line%']) |  219     result = parse_filterlist(['! good line', '%includes bad%']) | 
|  220     assert next(result) == Comment('good line') |  220     assert next(result) == Comment('good line') | 
|  221     with pytest.raises(ParseError): |  221     with pytest.raises(ParseError): | 
|  222         next(result) |  222         next(result) | 
|  223  |  223  | 
|  224  |  224  | 
|  225 def test_parse_line_bytes(): |  225 def test_parse_line_bytes(): | 
|  226     line = parse_line(b'! \xc3\xbc') |  226     line = parse_line(b'! \xc3\xbc') | 
|  227     assert line.text == '\xfc' |  227     assert line.text == '\xfc' | 
| OLD | NEW |