Skip to content

Commit 4aa79f1

Browse files
committed
Fix optionaltags filter to not error when filtering nothing.
1 parent f6741ea commit 4aa79f1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

html5lib/filters/optionaltags.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def slider(self):
1111
yield previous2, previous1, token
1212
previous2 = previous1
1313
previous1 = token
14-
yield previous2, previous1, None
14+
if previous1 is not None:
15+
yield previous2, previous1, None
1516

1617
def __iter__(self):
1718
for previous, token, next in self.slider():
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from __future__ import absolute_import, division, unicode_literals
2+
3+
from html5lib.filters.optionaltags import Filter
4+
5+
6+
def test_empty():
7+
assert list(Filter([])) == []

0 commit comments

Comments
 (0)