Mercurial > piecrust2
comparison tests/test_data_iterators.py @ 729:e35407c60e00
templating: Make blog archives generator expose more templating data.
In addition to pagination data, also expose a non-paginating iterator that
lists all posts in a source by chronological order.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 01 Jun 2016 22:09:21 -0700 |
parents | 4379d8f8f831 |
children |
comparison
equal
deleted
inserted
replaced
728:e7481bbbb29f | 729:e35407c60e00 |
---|---|
70 | 70 |
71 def test_filter(): | 71 def test_filter(): |
72 page = mock.MagicMock(spec=Page) | 72 page = mock.MagicMock(spec=Page) |
73 page.config = PageConfiguration() | 73 page.config = PageConfiguration() |
74 page.config.set('threes', {'is_foo': 3}) | 74 page.config.set('threes', {'is_foo': 3}) |
75 it = PageIterator([TestItem(v) for v in [3, 2, 3, 1, 4, 3]], page) | 75 it = PageIterator([TestItem(v) for v in [3, 2, 3, 1, 4, 3]], |
76 current_page=page) | |
76 it.filter('threes') | 77 it.filter('threes') |
77 assert it.total_count == 3 | 78 assert it.total_count == 3 |
78 assert len(it) == 3 | 79 assert len(it) == 3 |
79 assert list(it) == [TestItem(3), TestItem(3), TestItem(3)] | 80 assert list(it) == [TestItem(3), TestItem(3), TestItem(3)] |
80 | 81 |