Refs #23260 -- Tested nested generator input to unordered_list template filter.

This commit is contained in:
Jonas Haag 2017-10-19 00:08:08 +02:00 committed by Tim Graham
parent 2346636b0c
commit b21b1b10af
1 changed files with 14 additions and 0 deletions

View File

@ -110,6 +110,20 @@ class FunctionTests(SimpleTestCase):
'\t<li>ulitem-a</li>\n\t<li>ulitem-b</li>\n\t<li>ulitem-&lt;a&gt;c&lt;/a&gt;</li>', '\t<li>ulitem-a</li>\n\t<li>ulitem-b</li>\n\t<li>ulitem-&lt;a&gt;c&lt;/a&gt;</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):