[pypy-commit] pypy py3k: Adapt compiler test to py3k: coding cookie is only used if source is bytes.
amauryfa
noreply at buildbot.pypy.org
Mon Feb 16 10:41:33 CET 2015
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r75915:cb55f5432429
Date: 2015-02-16 10:16 +0100
http://bitbucket.org/pypy/pypy/changeset/cb55f5432429/
Log: Adapt compiler test to py3k: coding cookie is only used if source is
bytes.
diff --git a/pypy/interpreter/test/test_compiler.py b/pypy/interpreter/test/test_compiler.py
--- a/pypy/interpreter/test/test_compiler.py
+++ b/pypy/interpreter/test/test_compiler.py
@@ -1187,20 +1187,15 @@
def test_encoding(self):
code = b'# -*- coding: badencoding -*-\npass\n'
raises(SyntaxError, compile, code, 'tmp', 'exec')
- code = u"# -*- coding: utf-8 -*-\npass\n"
- raises(SyntaxError, compile, code, 'tmp', 'exec')
code = 'u"\xc2\xa4"\n'
assert eval(code) == u'\xc2\xa4'
code = u'u"\xc2\xa4"\n'
assert eval(code) == u'\xc2\xa4'
- code = '# -*- coding: latin1 -*-\nu"\xc2\xa4"\n'
+ code = b'# -*- coding: latin1 -*-\nu"\xc2\xa4"\n'
assert eval(code) == u'\xc2\xa4'
- code = '# -*- coding: utf-8 -*-\nu"\xc2\xa4"\n'
+ code = b'# -*- coding: utf-8 -*-\nu"\xc2\xa4"\n'
assert eval(code) == u'\xa4'
- code = '# -*- coding: iso8859-15 -*-\nu"\xc2\xa4"\n'
+ code = b'# -*- coding: iso8859-15 -*-\nu"\xc2\xa4"\n'
assert eval(code) == u'\xc2\u20ac'
- import sys
- if sys.version_info < (2, 7, 9):
- skip()
- code = 'u"""\\\n# -*- coding: utf-8 -*-\n\xc2\xa4"""\n'
- assert eval(code) == u'# -*- coding: utf-8 -*-\n\xc2\xa4'
+ code = b'u"""\\\n# -*- coding: ascii -*-\n\xc2\xa4"""\n'
+ assert eval(code) == u'# -*- coding: ascii -*-\n\xa4'
More information about the pypy-commit
mailing list