summaryrefslogtreecommitdiffstats
path: root/Lib/json/tests/test_unicode.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/json/tests/test_unicode.py')
-rw-r--r--Lib/json/tests/test_unicode.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/json/tests/test_unicode.py b/Lib/json/tests/test_unicode.py
index 3ac4541..0b47cbb 100644
--- a/Lib/json/tests/test_unicode.py
+++ b/Lib/json/tests/test_unicode.py
@@ -51,5 +51,14 @@ class TestUnicode(TestCase):
def test_unicode_decode(self):
for i in range(0, 0xd7ff):
u = unichr(i)
- js = '"\\u{0:04x}"'.format(i)
- self.assertEquals(json.loads(js), u)
+ s = '"\\u{0:04x}"'.format(i)
+ self.assertEquals(json.loads(s), u)
+
+ def test_default_encoding(self):
+ self.assertEquals(json.loads(u'{"a": "\xe9"}'.encode('utf-8')),
+ {'a': u'\xe9'})
+
+ def test_unicode_preservation(self):
+ self.assertEquals(type(json.loads(u'""')), unicode)
+ self.assertEquals(type(json.loads(u'"a"')), unicode)
+ self.assertEquals(type(json.loads(u'["a"]')[0]), unicode)