mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line #9424: Replace deprecated assert* methods in the Python test suite. ........
This commit is contained in:
parent
b65b4937e2
commit
19f2aeba67
164 changed files with 2281 additions and 2279 deletions
|
@ -10,43 +10,43 @@ class TestUnicode(TestCase):
|
|||
def test_encoding3(self):
|
||||
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
|
||||
j = json.dumps(u)
|
||||
self.assertEquals(j, '"\\u03b1\\u03a9"')
|
||||
self.assertEqual(j, '"\\u03b1\\u03a9"')
|
||||
|
||||
def test_encoding4(self):
|
||||
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
|
||||
j = json.dumps([u])
|
||||
self.assertEquals(j, '["\\u03b1\\u03a9"]')
|
||||
self.assertEqual(j, '["\\u03b1\\u03a9"]')
|
||||
|
||||
def test_encoding5(self):
|
||||
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
|
||||
j = json.dumps(u, ensure_ascii=False)
|
||||
self.assertEquals(j, '"{0}"'.format(u))
|
||||
self.assertEqual(j, '"{0}"'.format(u))
|
||||
|
||||
def test_encoding6(self):
|
||||
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
|
||||
j = json.dumps([u], ensure_ascii=False)
|
||||
self.assertEquals(j, '["{0}"]'.format(u))
|
||||
self.assertEqual(j, '["{0}"]'.format(u))
|
||||
|
||||
def test_big_unicode_encode(self):
|
||||
u = '\U0001d120'
|
||||
self.assertEquals(json.dumps(u), '"\\ud834\\udd20"')
|
||||
self.assertEquals(json.dumps(u, ensure_ascii=False), '"\U0001d120"')
|
||||
self.assertEqual(json.dumps(u), '"\\ud834\\udd20"')
|
||||
self.assertEqual(json.dumps(u, ensure_ascii=False), '"\U0001d120"')
|
||||
|
||||
def test_big_unicode_decode(self):
|
||||
u = 'z\U0001d120x'
|
||||
self.assertEquals(json.loads('"' + u + '"'), u)
|
||||
self.assertEquals(json.loads('"z\\ud834\\udd20x"'), u)
|
||||
self.assertEqual(json.loads('"' + u + '"'), u)
|
||||
self.assertEqual(json.loads('"z\\ud834\\udd20x"'), u)
|
||||
|
||||
def test_unicode_decode(self):
|
||||
for i in range(0, 0xd7ff):
|
||||
u = chr(i)
|
||||
s = '"\\u{0:04x}"'.format(i)
|
||||
self.assertEquals(json.loads(s), u)
|
||||
self.assertEqual(json.loads(s), u)
|
||||
|
||||
def test_unicode_preservation(self):
|
||||
self.assertEquals(type(json.loads('""')), str)
|
||||
self.assertEquals(type(json.loads('"a"')), str)
|
||||
self.assertEquals(type(json.loads('["a"]')[0]), str)
|
||||
self.assertEqual(type(json.loads('""')), str)
|
||||
self.assertEqual(type(json.loads('"a"')), str)
|
||||
self.assertEqual(type(json.loads('["a"]')[0]), str)
|
||||
|
||||
def test_bytes_encode(self):
|
||||
self.assertRaises(TypeError, json.dumps, b"hi")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue