[2.0.x] Refs #23260 -- Tested nested generator input to unordered_list template filter.
Backport of b21b1b10af
from master
This commit is contained in:
parent
aed7fdc03b
commit
673427d3fc
|
@ -110,6 +110,20 @@ class FunctionTests(SimpleTestCase):
|
||||||
'\t<li>ulitem-a</li>\n\t<li>ulitem-b</li>\n\t<li>ulitem-<a>c</a></li>',
|
'\t<li>ulitem-a</li>\n\t<li>ulitem-b</li>\n\t<li>ulitem-<a>c</a></li>',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_nested_generators(self):
|
||||||
|
def inner_generator():
|
||||||
|
yield from ('B', 'C')
|
||||||
|
|
||||||
|
def item_generator():
|
||||||
|
yield 'A'
|
||||||
|
yield inner_generator()
|
||||||
|
yield 'D'
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
unordered_list(item_generator()),
|
||||||
|
'\t<li>A\n\t<ul>\n\t\t<li>B</li>\n\t\t<li>C</li>\n\t</ul>\n\t</li>\n\t<li>D</li>',
|
||||||
|
)
|
||||||
|
|
||||||
def test_ulitem_autoescape_off(self):
|
def test_ulitem_autoescape_off(self):
|
||||||
class ULItem:
|
class ULItem:
|
||||||
def __init__(self, title):
|
def __init__(self, title):
|
||||||
|
|
Loading…
Reference in New Issue