]> Devi Nivas Git - chevron.git/commitdiff
Added unicode unittests
authornoah morrison <noah@morrison.ph>
Mon, 17 Nov 2014 23:57:01 +0000 (18:57 -0500)
committernoah morrison <noah@morrison.ph>
Mon, 17 Nov 2014 23:57:01 +0000 (18:57 -0500)
test_spec.py

index 507ae1ba65dbb32f9ebe9d6acc7ce874cc4cdfeb..61423d2ff091794b8ba7acb7effbdc00d0c972fd 100755 (executable)
@@ -1,4 +1,6 @@
 #!/usr/bin/python
+# -*- coding: utf-8 -*-
+
 import unittest
 import os
 import json
@@ -61,6 +63,38 @@ class ExpandedCoverage(unittest.TestCase):
         self.assertRaises(entei.UnclosedSection, entei.render, **test1)
         self.assertRaises(entei.UnclosedSection, entei.render, **test2)
 
+    def test_unicode_basic(self):
+        args = {
+            'template': '(╯°□°)╯︵ ┻━┻'
+        }
+
+        result = entei.render(**args)
+        expected = '(╯°□°)╯︵ ┻━┻'
+
+        self.assertEqual(result, expected)
+
+    def test_unicode_variable(self):
+        args = {
+            'template': '{{ table_flip }}',
+            'data': {'table_flip': '(╯°□°)╯︵ ┻━┻'}
+        }
+
+        result = entei.render(**args)
+        expected = '(╯°□°)╯︵ ┻━┻'
+
+        self.assertEqual(result, expected)
+
+    def test_unicode_partial(self):
+        args = {
+            'template': '{{> table_flip }}',
+            'partials_dict': {'table_flip': '(╯°□°)╯︵ ┻━┻'}
+        }
+
+        result = entei.render(**args)
+        expected = '(╯°□°)╯︵ ┻━┻'
+
+        self.assertEqual(result, expected)
+
     def test_main(self):
         result = entei.main('tests/data.json', 'tests/test.mustache',
                             partials_path='tests')