3
3
# Author: David Goodger
4
4
# Contact: goodger@users.sourceforge.net
5
# Revision: $Revision: 1.2 $
6
# Date: $Date: 2002/10/18 04:55:21 $
5
# Revision: $Revision: 4213 $
6
# Date: $Date: 2005-12-14 15:51:59 +0100 (Wed, 14 Dec 2005) $
7
7
# Copyright: This module has been placed in the public domain.
19
20
s.generateTests(totest)
22
mydir = os.path.dirname(suite.func_code.co_filename)
23
mydir = 'test_parsers/test_rst/test_directives/'
23
24
raw1 = os.path.join(mydir, 'raw1.txt')
25
utf_16_file = os.path.join(mydir, 'utf-16.csv')
26
utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file)
77
80
<p>Can't have both content and file attribute.</p>
85
\[ \sum_{n=1}^\infty \frac{1}{n} \text{ etc.} \]
88
<document source="test data">
89
<raw format="latex html" xml:space="preserve">
90
\\[ \\sum_{n=1}^\\infty \\frac{1}{n} \\text{ etc.} \\]
96
""" % utf_16_file_rel,
98
<document source="test data">
99
<raw format="html" source="%s" xml:space="preserve">
100
"Treat", "Quantity", "Description"
101
"Albatr\xb0\xdf", 2.99, "\xa1On a \\u03c3\\u03c4\\u03b9\\u03ba!"
102
"Crunchy Frog", 1.49, "If we took the b\xf6nes out, it wouldn\\u2019t be
103
crunchy, now would it?"
104
"Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?"
105
""" % utf_16_file_rel],
107
Raw input file is UTF-16-encoded, and is not valid ASCII.
112
""" % utf_16_file_rel,
114
<document source="test data">
116
Raw input file is UTF-16-encoded, and is not valid ASCII.
117
<system_message level="4" line="3" source="test data" type="SEVERE">
119
Problem with "raw" directive:
120
UnicodeError: Unable to decode input data. Tried the following encodings: \'ascii\'.
121
(UnicodeDecodeError: 'ascii' codec can't decode byte 0xfe in position 0: ordinal not in range(128))
122
<literal_block xml:space="preserve">
126
""" % utf_16_file_rel],
131
Should the parser complain becau\xdfe there is no :file:? BUG?
134
<document source="test data">
135
<raw format="html" xml:space="preserve">
136
Should the parser complain becau\xdfe there is no :file:? BUG?
140
# Skip tests whose output contains "UnicodeDecodeError" if we are not
141
# using Python 2.3 or higher.
142
if sys.version_info < (2, 3):
143
for i in range(len(totest['raw'])):
144
if totest['raw'][i][1].find('UnicodeDecodeError') != -1:
146
print ("Test totest['raw'][%s] skipped; "
147
"Python 2.3+ required for expected output." % i)
148
# Assume we have only one of these tests.
82
152
if __name__ == '__main__':