From: Noah Morrison Date: Sat, 2 Jan 2021 17:34:44 +0000 (-0500) Subject: Merge branch 'fix-py3-namedtuple' of git://github.com/tchebb/chevron into tchebb... X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=a200148dafc246065050f3b838552c2bd14be3d9;p=chevron.git Merge branch 'fix-py3-namedtuple' of git://github.com/tchebb/chevron into tchebb-fix-py3-namedtuple --- a200148dafc246065050f3b838552c2bd14be3d9 diff --cc test_spec.py index 250d9b7,d064ffe..ad19d8b --- a/test_spec.py +++ b/test_spec.py @@@ -435,23 -436,18 +436,36 @@@ class ExpandedCoverage(unittest.TestCas self.assertEqual(result, expected) + def test_iterator_scope_indentation(self): + args = { + 'data': { + 'thing': ['foo', 'bar', 'baz'], + }, + 'template': '{{> count }}', + 'partials_dict': { + 'count': ' {{> iter_scope }}', + 'iter_scope': 'foobar\n{{#thing}}\n {{.}}\n{{/thing}}' + } + } + + result = chevron.render(**args) + expected = ' foobar\n foo\n bar\n baz\n' + + self.assertEqual(result, expected) + ++ # https://github.com/noahmorrison/chevron/pull/73 + def test_namedtuple_data(self): + NT = collections.namedtuple('NT', ['foo', 'bar']) + args = { + 'template': '{{foo}} {{bar}}', + 'data': NT('hello', 'world') + } + + result = chevron.render(**args) + expected = 'hello world' + + self.assertEqual(result, expected) + # Run unit tests from command line if __name__ == "__main__":