diff options
author | R. Tyler Ballance <tyler@slide.com> | 2009-04-16 22:32:41 -0700 |
---|---|---|
committer | R. Tyler Ballance <tyler@slide.com> | 2009-04-16 22:32:41 -0700 |
commit | 45f570f03abfbe929a14a7c23e2aa2a39ce152c5 (patch) | |
tree | 992e83fd05db4ab0231ec1a2257ba45b744376c5 /src/Tests/Unicode.py | |
parent | 2fc2c598e3ab45631739fe0f582fbfc18573b417 (diff) | |
parent | 1c42c232c419001116a099e4a49032231fff38fe (diff) | |
download | python-cheetah-2.1.1.tar.gz |
Merge branch 'next' of git@github.com:rtyler/cheetahv2.1.1
Diffstat (limited to 'src/Tests/Unicode.py')
-rw-r--r-- | src/Tests/Unicode.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/Tests/Unicode.py b/src/Tests/Unicode.py new file mode 100644 index 0000000..8b50980 --- /dev/null +++ b/src/Tests/Unicode.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# -*- encoding: utf8 -*- + +from Cheetah.Template import Template +import traceback +import unittest_local_copy as unittest # This is stupid + +class JPQ_UTF8_Test1(unittest.TestCase): + def runTest(self): + t = Template.compile(source="""Main file with |$v| + + $other""") + + otherT = Template.compile(source="Other template with |$v|") + other = otherT() + t.other = other + + t.v = u'Unicode String' + t.other.v = u'Unicode String' + + assert t() + +class JPQ_UTF8_Test2(unittest.TestCase): + def runTest(self): + t = Template.compile(source="""Main file with |$v| + + $other""") + + otherT = Template.compile(source="Other template with |$v|") + other = otherT() + t.other = other + + t.v = u'Unicode String with eacute é' + t.other.v = u'Unicode String' + + assert unicode(t()) + assert t().__str__() + + +class JPQ_UTF8_Test3(unittest.TestCase): + def runTest(self): + t = Template.compile(source="""Main file with |$v| + + $other""") + + otherT = Template.compile(source="Other template with |$v|") + other = otherT() + t.other = other + + t.v = u'Unicode String with eacute é' + t.other.v = u'Unicode String and an eacute é' + + assert unicode(t()) + +class JPQ_UTF8_Test4(unittest.TestCase): + def runTest(self): + t = Template.compile(source="""Main file with |$v| and eacute in the template é""") + + t.v = 'Unicode String' + + assert t() + +class JPQ_UTF8_Test5(unittest.TestCase): + def runTest(self): + t = Template.compile(source="""#encoding utf-8 + Main file with |$v| and eacute in the template é""") + + t.v = u'Unicode String' + rc = t().__str__() + assert rc + +if __name__ == '__main__': + unittest.main() |