Skip to content

Commit

Permalink
Fix optionaltags filter to not error when filtering nothing.
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnedders committed May 19, 2014
1 parent f5fd711 commit 9a37828
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion html5lib/filters/optionaltags.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def slider(self):
yield previous2, previous1, token
previous2 = previous1
previous1 = token
yield previous2, previous1, None
if previous1 is not None:
yield previous2, previous1, None

def __iter__(self):
for previous, token, next in self.slider():
Expand Down
7 changes: 7 additions & 0 deletions html5lib/tests/test_optionaltags_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from __future__ import absolute_import, division, unicode_literals

from html5lib.filters.optionaltags import Filter


def test_empty():
assert list(Filter([])) == []

0 comments on commit 9a37828

Please sign in to comment.