diff options
| author | Bob Ippolito <bob@redivi.com> | 2009-03-17 23:19:00 (GMT) |
|---|---|---|
| committer | Bob Ippolito <bob@redivi.com> | 2009-03-17 23:19:00 (GMT) |
| commit | d914e3f8619df604ca6fa852fd210043b94f16e1 (patch) | |
| tree | 99352cdd395da08a735041039f7f336a92485f8d /Lib/json/tests/test_unicode.py | |
| parent | 277859d5910782cc31bb27f2472893b8382ad391 (diff) | |
| download | cpython-d914e3f8619df604ca6fa852fd210043b94f16e1.zip cpython-d914e3f8619df604ca6fa852fd210043b94f16e1.tar.gz cpython-d914e3f8619df604ca6fa852fd210043b94f16e1.tar.bz2 | |
merge json library with simplejson 2.0.9 (issue 4136)
Diffstat (limited to 'Lib/json/tests/test_unicode.py')
| -rw-r--r-- | Lib/json/tests/test_unicode.py | 13 |
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) |
