Skip to content

Commit

Permalink
More tests for escape.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpnova committed Aug 4, 2014
1 parent 5c1fa2e commit bf4c9b6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ python:
- "3.2"
- "3.3"
- "3.4"
- "pypy"

install:
- pip install -r cyclone/tests/test_requirements.txt
Expand Down
22 changes: 18 additions & 4 deletions cyclone/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from cyclone.escape import xhtml_escape, xhtml_unescape
from cyclone.escape import json_encode, json_decode
from cyclone.escape import squeeze, url_escape, url_unescape
from cyclone.escape import utf8, to_unicode

from cyclone.escape import utf8, to_unicode, to_basestring
from cyclone.escape import recursive_unicode

class EscapeTest(unittest.TestCase):
def test_xhtml_escape(self):
Expand Down Expand Up @@ -57,5 +57,19 @@ def test_utf8(self):
self.assertEqual(utf8(u"rawr"), "rawr")

def test_to_unicode(self):
self.assertEqual(to_unicode("rawr"), "rawr")
self.assertEqual(to_unicode(u"rawr"), "rawr")
self.assertEqual(to_unicode("rawr"), u"rawr")
self.assertEqual(to_unicode(u"rawr"), u"rawr")

def test_to_basestring(self):
"""
Not sure this is 100% testable in python 2.
"""
self.assertEqual(to_basestring("rawr"), "rawr")
self.assertEqual(to_basestring(u"rawr"), "rawr")

def test_recursive_unicode(self):
self.assertEqual(recursive_unicode("rawr"), u"rawr")
self.assertEqual(
recursive_unicode({"rawr": "rawr"}), {"rawr": u"rawr"})
self.assertEqual(
recursive_unicode(["rawr", "rawr"]), [u"rawr", u"rawr"])

0 comments on commit bf4c9b6

Please sign in to comment.