[pypy-svn] r61284 - in pypy/trunk/pypy/module/_codecs: . test
fijal at codespeak.net
fijal at codespeak.net
Fri Jan 23 21:39:48 CET 2009
Author: fijal
Date: Fri Jan 23 21:39:46 2009
New Revision: 61284
Modified:
pypy/trunk/pypy/module/_codecs/app_codecs.py
pypy/trunk/pypy/module/_codecs/test/test_codecs.py
Log:
*cough*
Modified: pypy/trunk/pypy/module/_codecs/app_codecs.py
==============================================================================
--- pypy/trunk/pypy/module/_codecs/app_codecs.py (original)
+++ pypy/trunk/pypy/module/_codecs/app_codecs.py Fri Jan 23 21:39:46 2009
@@ -564,7 +564,7 @@
pos -= 1
#/* Map 16-bit characters to '\uxxxx' */
- if (ord(ch) >= 256):
+ elif (ord(ch) >= 256):
p += '\\'
p += 'u'
p += '%04x' % ord(ch)
@@ -583,7 +583,7 @@
p += 'r'
#/* Map non-printable US ASCII to '\xhh' */
- elif (ch < ' ' or ch >= 0x7F) :
+ elif (ch < ' ' or ord(ch) >= 0x7F) :
p += '\\'
p += 'x'
p += '%02x' % ord(ch)
Modified: pypy/trunk/pypy/module/_codecs/test/test_codecs.py
==============================================================================
--- pypy/trunk/pypy/module/_codecs/test/test_codecs.py (original)
+++ pypy/trunk/pypy/module/_codecs/test/test_codecs.py Fri Jan 23 21:39:46 2009
@@ -525,6 +525,6 @@
assert charmap_decode('xxx', 'strict', {ord('x'): u'XX'}) == ('XXXXXX', 3)
def test_unicode_escape(self):
- assert unicode_escape_encode(u'abc') == ('\\x61\\x62\\x63', 3)
- assert unicode_escape_decode('abc') == (u'abc', 3)
+ assert unicode_escape_encode(u'abc') == (u'abc'.encode('unicode_escape'), 3)
+ assert unicode_escape_decode('abc') == (u'abc'.decode('unicode_escape'), 3)
assert unicode_escape_decode('\\x61\\x62\\x63') == (u'abc', 12)
More information about the Pypy-commit
mailing list