[pypy-svn] r16150 - in pypy/dist/pypy/module/_codecs: . test
ale at codespeak.net
ale at codespeak.net
Thu Aug 18 19:33:48 CEST 2005
Author: ale
Date: Thu Aug 18 19:33:47 2005
New Revision: 16150
Modified:
pypy/dist/pypy/module/_codecs/app_codecs.py
pypy/dist/pypy/module/_codecs/test/test_codecs.py
Log:
changed as per Armins suggestions (Thanks Armin)
Enabled the tests
Modified: pypy/dist/pypy/module/_codecs/app_codecs.py
==============================================================================
--- pypy/dist/pypy/module/_codecs/app_codecs.py (original)
+++ pypy/dist/pypy/module/_codecs/app_codecs.py Thu Aug 18 19:33:47 2005
@@ -293,40 +293,32 @@
i += 1
if data[i] == '\\':
res += '\\'
- if data[i] == 'n':
+ elif data[i] == 'n':
res += '\n'
- if data[i] == 't':
+ elif data[i] == 't':
res += '\t'
- if data[i] == 'r':
+ elif data[i] == 'r':
res += '\r'
- if data[i] == 'b':
+ elif data[i] == 'b':
res += '\b'
- if data[i] == '\'':
+ elif data[i] == '\'':
res += '\''
- if data[i] == '\"':
+ elif data[i] == '\"':
res += '\"'
- if data[i] == 'f':
+ elif data[i] == 'f':
res += '\f'
- if data[i] == 'a':
+ elif data[i] == 'a':
res += '\a'
- if data[i] == 'v':
+ elif data[i] == 'v':
res += '\v'
- if data[i] == '0':
- octal = data[i+1:i+3]
+ elif data[i] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
+ octal = data[i:i+3]
res += chr(int(octal,8))
i += 2
- if data[i] == 'x':
+ elif data[i] == 'x':
hexa = data[i+1:i+3]
res += chr(int(hexa,16))
i += 2
- if data[i] == 'u':
- res += data[i-1:i+5]
- i += 4
- if data[i] == 'U':
- res += data[i-1:i+9]
- i += 8
- if data[i] == 'N':
- raise NotImplementedError
else:
res += data[i]
i += 1
Modified: pypy/dist/pypy/module/_codecs/test/test_codecs.py
==============================================================================
--- pypy/dist/pypy/module/_codecs/test/test_codecs.py (original)
+++ pypy/dist/pypy/module/_codecs/test/test_codecs.py Thu Aug 18 19:33:47 2005
@@ -41,12 +41,7 @@
assert u"\u0663".encode("raw-unicode-escape") == "\u0663"
def test_escape_decode(self):
- skip("XXX fix the string_escape codecs (see comments in the tset)")
- # XXX comments:
- # - string_escape does not support \u and \U at all
- # - this sequence of 'if' statements should be 'elif', otherwise
- # two cases can mix with each other
- # - see more tests below
+
test = 'a\n\\b\x00c\td\u2045'.encode('string_escape')
assert test.decode('string_escape') =='a\n\\b\x00c\td\u2045'
assert '\\077'.decode('string_escape') == '?'
More information about the Pypy-commit
mailing list