Skip to content

Commit 9a37828

Browse files
committed
Fix optionaltags filter to not error when filtering nothing.
1 parent f5fd711 commit 9a37828

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

html5lib/filters/optionaltags.py

Lines changed: 2 additions & 1 deletion
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():
Lines changed: 7 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy