Refs -- Tested nested generator input to unordered_list template filter.
@@ -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>',
)
+ 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):
