Refs #23260 -- Tested nested generator input to unordered_list template filter.
This commit is contained in:
parent
2346636b0c
commit
b21b1b10af
|
@ -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>',
|
||||
)
|
||||
|
||||
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):
|
||||
class ULItem:
|
||||
def __init__(self, title):
|
||||
|
|
Loading…
Reference in New Issue