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

Unified Diff: tests/test_parser.py

Issue 29901579: Issue 6976 - Ignore invalid headers instead of crashing (Closed) Base URL: https://hg.adblockplus.org/python-abp
Patch Set: Created Oct. 4, 2018, 1:34 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « abp/filters/parser.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/test_parser.py
===================================================================
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -159,23 +159,21 @@
def test_parse_start():
# Header-line lines are headers.
assert parse_line('[Adblock Plus 1.1]', 'start').type == 'header'
# Even if they have extra characters around.
assert parse_line('foo[Adblock Plus 1.1] bar', 'start').type == 'header'
- with pytest.raises(ParseError):
- # But the inside of the header needs to be right.
- parse_line('[Adblock Minus 1.1]', 'start').type
-
- with pytest.raises(ParseError):
- # Really right!
- parse_line('[Adblock 1.1]', 'start')
+ # But the inside of the header needs to be right.
+ assert parse_line('[Adblock Minus 1.1]', 'start').type == 'filter'
+ # Really right!
+ assert parse_line('[Adblock 1.1]', 'start').type == 'filter'
+ # Otherwise it's just considered a filter.
# Metadata-like lines are metadata.
assert parse_line('! Foo: bar', 'metadata').type == 'metadata'
def test_parse_metadata():
# Header-like lines are just filters.
assert parse_line('[Adblock 1.1]', 'metadata').type == 'filter'
« 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