diff options
| author | goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-06-22 19:05:20 +0000 |
|---|---|---|
| committer | goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-06-22 19:05:20 +0000 |
| commit | 283ce005a874a62c9ccb45f7dcbf37e0b7f591cb (patch) | |
| tree | d25ae2fc57c93a686d826123d153a1776233640c /test | |
| parent | 3c20db99ad8a39059b006abb64313769058974c3 (diff) | |
| download | docutils-283ce005a874a62c9ccb45f7dcbf37e0b7f591cb.tar.gz | |
Python 2.5 compatibility: dynamic exception matching
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4631 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test')
3 files changed, 18 insertions, 8 deletions
diff --git a/test/test_parsers/test_rst/test_directives/test_contents.py b/test/test_parsers/test_rst/test_directives/test_contents.py index 3398b9ee2..d684b0af2 100755 --- a/test/test_parsers/test_rst/test_directives/test_contents.py +++ b/test/test_parsers/test_rst/test_directives/test_contents.py @@ -151,11 +151,11 @@ totest['contents'] = [ <paragraph> Error in "contents" directive: invalid option value: (option: "depth"; value: 'two') - invalid literal for int(): two. + %s. <literal_block xml:space="preserve"> .. contents:: :depth: two -"""], +""" % DocutilsTestSupport.exception_data('int("two")')[1][0]], ["""\ .. contents:: :width: 2 diff --git a/test/test_parsers/test_rst/test_directives/test_images.py b/test/test_parsers/test_rst/test_directives/test_images.py index d8752c16e..1ce24d4a4 100755 --- a/test/test_parsers/test_rst/test_directives/test_images.py +++ b/test/test_parsers/test_rst/test_directives/test_images.py @@ -245,11 +245,11 @@ totest['images'] = [ <paragraph> Error in "image" directive: invalid option value: (option: "scale"; value: 'fifty') - invalid literal for int(): fifty. + %s. <literal_block xml:space="preserve"> .. image:: picture.png :scale: fifty -"""], +""" % DocutilsTestSupport.exception_data('int("fifty")')[1][0]], ["""\ .. image:: picture.png :scale: 50 diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index 0fac40ecb..49f379711 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -34,6 +34,16 @@ if isinstance(unichr_exception, OverflowError): else: unichr_exception_string = str(unichr_exception) +null_bytes_code = """ +import csv +import cStringIO +csv_data = open('%s', 'rb').read().decode('latin-1') +csv_file = cStringIO.StringIO(csv_data) +reader = csv.reader(csv_file) +reader.next() +""" % utf_16_csv +null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes_code)[1][0] + totest = {} totest['table'] = [ @@ -549,7 +559,7 @@ u"""\ <paragraph> Error in "csv-table" directive: invalid option value: (option: "widths"; value: '10,y,z') - invalid literal for int(): y. + %s. <literal_block xml:space="preserve"> .. csv-table:: bad column widths :widths: 10,y,z @@ -565,7 +575,7 @@ u"""\ :widths: 0 0 0 \n\ some, csv, data -"""], +""" % DocutilsTestSupport.exception_data('int("y")')[1][0]], ["""\ .. csv-table:: good delimiter :delim: / @@ -734,14 +744,14 @@ u"""\ <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error with CSV data in "csv-table" directive: - string with NUL bytes + %s <literal_block xml:space="preserve"> .. csv-table:: bad encoding :file: %s :encoding: latin-1 <paragraph> (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) -""" % utf_16_csv], +""" % (null_bytes_exception, utf_16_csv)], ["""\ .. csv-table:: good encoding :file: %s |
