summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR. Tyler Ballance <tyler@monkeypox.org>2009-12-16 19:03:00 -0800
committerR. Tyler Ballance <tyler@monkeypox.org>2009-12-16 19:03:00 -0800
commit0f4310ae128a0566d863d47a677b6a0b35d8dc18 (patch)
tree216c55395184276a56b27604dbaeaf1f6d4597d1
parent752cb3af40a9463c81ac6a31b9baec79b8ee36ca (diff)
downloadpython-cheetah-0f4310ae128a0566d863d47a677b6a0b35d8dc18.tar.gz
Refactor the InlineSpanishTest to better clarify a success/failure scenario
-rw-r--r--cheetah/Tests/Unicode.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/cheetah/Tests/Unicode.py b/cheetah/Tests/Unicode.py
index c8b3955..c881d86 100644
--- a/cheetah/Tests/Unicode.py
+++ b/cheetah/Tests/Unicode.py
@@ -195,9 +195,9 @@ class Unicode_in_SearchList_Test(CommandLineTest):
class InlineSpanishTest(unittest.TestCase):
- def runTest(self):
- template = '''
-#encoding utf-8
+ def setUp(self):
+ super(InlineSpanishTest, self).setUp()
+ self.template = '''
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@@ -216,11 +216,22 @@ class InlineSpanishTest(unittest.TestCase):
</body>
</html>
'''
+
+ def test_failure(self):
+ """ Test a template lacking a proper #encoding tag """
+ self.failUnlessRaises(UnicodeDecodeError, Template, self.template, searchList=[{'header' : '',
+ 'nombre' : '', 'numpedidos_bodega' : '',
+ 'numpedidos_noconf' : ''}])
+
+ def test_success(self):
+ """ Test a template with a proper #encoding tag """
+ template = '#encoding utf-8\n%s' % self.template
template = Template(template, searchList=[{'header' : '',
'nombre' : '', 'numpedidos_bodega' : '',
'numpedidos_noconf' : ''}])
- assert unicode(template)
-
+ self.assertTrue(unicode(template))
+
+
if __name__ == '__main__':
unittest.main()