Commit 84e24e5e by Chris Jerdonek

Tests now pass with Python 3.1.

parent 9d1e3aad
......@@ -204,7 +204,7 @@ Author
.. _Mustache: http://mustache.github.com/
.. _Mustache spec: https://github.com/mustache/spec
.. _mustache(5): http://mustache.github.com/mustache.5.html
.. _nose: http://somethingaboutorange.com/mrl/projects/nose/0.11.1/testing.html
.. _nose: http://readthedocs.org/docs/nose/en/latest/
.. _only unicode strings: http://docs.python.org/howto/unicode.html#tips-for-writing-unicode-aware-programs
.. _PyPI: http://pypi.python.org/pypi/pystache
.. _Pystache: https://github.com/defunkt/pystache
......
......@@ -11,6 +11,13 @@ does not otherwise specify a value.
try:
# Python 3.2 deprecates cgi.escape() and adds the html module as a replacement.
import html
try:
# We also need to verify the existence of the escape() method
# due to the following issue:
# http://bugs.python.org/issue14545
html.escape
except AttributeError:
raise ImportError("html.escape does not exist")
except ImportError:
import cgi as html
......
......@@ -63,8 +63,8 @@ class RendererInitTestCase(unittest.TestCase):
self.assertEqual(escape(">"), ">")
self.assertEqual(escape('"'), """)
# Single quotes are escaped in Python 3 but not Python 2.
if sys.version_info < (3, ):
# Single quotes are escaped only in Python 3.2 and later.
if sys.version_info < (3, 2):
expected = "'"
else:
expected = '&#x27;'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment