Lines 34-39
Link Here
|
34 |
else: |
34 |
else: |
35 |
unichr_exception_string = str(unichr_exception) |
35 |
unichr_exception_string = str(unichr_exception) |
36 |
|
36 |
|
|
|
37 |
null_bytes_code = """ |
38 |
import csv |
39 |
import cStringIO |
40 |
csv_data = open('%s', 'rb').read().decode('latin-1') |
41 |
csv_file = cStringIO.StringIO(csv_data) |
42 |
reader = csv.reader(csv_file) |
43 |
reader.next() |
44 |
""" % utf_16_csv |
45 |
null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes_code)[1][0] |
46 |
|
37 |
totest = {} |
47 |
totest = {} |
38 |
|
48 |
|
39 |
totest['table'] = [ |
49 |
totest['table'] = [ |
Lines 549-555
Link Here
|
549 |
<paragraph> |
559 |
<paragraph> |
550 |
Error in "csv-table" directive: |
560 |
Error in "csv-table" directive: |
551 |
invalid option value: (option: "widths"; value: '10,y,z') |
561 |
invalid option value: (option: "widths"; value: '10,y,z') |
552 |
invalid literal for int(): y. |
562 |
%s. |
553 |
<literal_block xml:space="preserve"> |
563 |
<literal_block xml:space="preserve"> |
554 |
.. csv-table:: bad column widths |
564 |
.. csv-table:: bad column widths |
555 |
:widths: 10,y,z |
565 |
:widths: 10,y,z |
Lines 565-571
Link Here
|
565 |
:widths: 0 0 0 |
575 |
:widths: 0 0 0 |
566 |
\n\ |
576 |
\n\ |
567 |
some, csv, data |
577 |
some, csv, data |
568 |
"""], |
578 |
""" % DocutilsTestSupport.exception_data('int("y")')[1][0]], |
569 |
["""\ |
579 |
["""\ |
570 |
.. csv-table:: good delimiter |
580 |
.. csv-table:: good delimiter |
571 |
:delim: / |
581 |
:delim: / |
Lines 734-747
Link Here
|
734 |
<system_message level="3" line="1" source="test data" type="ERROR"> |
744 |
<system_message level="3" line="1" source="test data" type="ERROR"> |
735 |
<paragraph> |
745 |
<paragraph> |
736 |
Error with CSV data in "csv-table" directive: |
746 |
Error with CSV data in "csv-table" directive: |
737 |
string with NUL bytes |
747 |
%s |
738 |
<literal_block xml:space="preserve"> |
748 |
<literal_block xml:space="preserve"> |
739 |
.. csv-table:: bad encoding |
749 |
.. csv-table:: bad encoding |
740 |
:file: %s |
750 |
:file: %s |
741 |
:encoding: latin-1 |
751 |
:encoding: latin-1 |
742 |
<paragraph> |
752 |
<paragraph> |
743 |
(7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) |
753 |
(7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.) |
744 |
""" % utf_16_csv], |
754 |
""" % (null_bytes_exception, utf_16_csv)], |
745 |
["""\ |
755 |
["""\ |
746 |
.. csv-table:: good encoding |
756 |
.. csv-table:: good encoding |
747 |
:file: %s |
757 |
:file: %s |