]> Devi Nivas Git - chevron.git/commitdiff
Merge branch 'fix-py3-namedtuple' of git://github.com/tchebb/chevron into tchebb...
authorNoah Morrison <noah@morrison.ph>
Sat, 2 Jan 2021 17:34:44 +0000 (12:34 -0500)
committerNoah Morrison <noah@morrison.ph>
Sat, 2 Jan 2021 17:34:44 +0000 (12:34 -0500)
1  2 
chevron/renderer.py
test_spec.py

Simple merge
diff --cc test_spec.py
index 250d9b7db53422e30122f5c431e7ac654ea078ad,d064ffe367552c581b88982d4b857b1a5cc117f0..ad19d8b278f16a8eb0686bd02f7778904dedcfa3
@@@ -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__":