1
1
#! /usr/bin/env python
3
# $Id: test_raw.py 5033 2007-03-21 19:51:22Z wiemann $
3
# $Id: test_raw.py 5889 2009-04-01 20:00:21Z gbrandl $
4
4
# Author: David Goodger <goodger@python.org>
5
5
# Copyright: This module has been placed in the public domain.
100
100
"Crunchy Frog", 1.49, "If we took the b\xf6nes out, it wouldn\\u2019t be
101
101
crunchy, now would it?"
102
102
"Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?"
103
""" % utf_16_file_rel],
103
""" % utf_16_file_rel).decode('raw_unicode_escape')],
105
105
Raw input file is UTF-16-encoded, and is not valid ASCII.
153
153
<system_message level="4" line="1" source="test data" type="SEVERE">
155
155
Problems with "raw" directive path:
156
[Errno 2] No such file or directory: 'non-existent.file'.
156
[Errno 2] No such file or directory: %s'non-existent.file'.
157
157
<literal_block xml:space="preserve">
159
159
:file: non-existent.file
161
# note that this output is rewritten below for certain python versions
163
# Skip tests whose output contains "UnicodeDecodeError" if we are not
164
# using Python 2.3 or higher.
165
if sys.version_info < (2, 3):
166
for i in range(len(totest['raw'])):
167
if totest['raw'][i][1].find('UnicodeDecodeError') != -1:
169
print ("Test totest['raw'][%s] skipped; "
170
"Python 2.3+ required for expected output." % i)
171
# Assume we have only one of these tests.
164
# Rewrite tests that depend on the output of IOError as it is
165
# platform-dependent before python 2.4 for a unicode path.
166
if sys.version_info < (2, 4):
167
# remove the unicode repr u except for py2.3 on windows:
168
if not sys.platform.startswith('win') or sys.version_info < (2, 3):
169
for i in range(len(totest['raw'])):
170
if totest['raw'][i][1].find("u'non-existent.file'") != -1:
171
totest['raw'][i][1] = totest['raw'][i][1].replace(
172
"u'non-existent.file'", "'non-existent.file'")
175
175
if __name__ == '__main__':