1
Description: make the CSV parser stricter
2
Make the CSV parser stricter. Update the tests so that they take into that
3
CSV syntax error message may vary with Python version.
4
Author: Jakub Wilk <jwilk@debian.org>
6
Bug: http://sourceforge.net/p/docutils/bugs/210/
7
Bug-Debian: http://bugs.debian.org/692286
8
Last-Update: 2013-05-16
10
--- a/docutils/parsers/rst/directives/tables.py
11
+++ b/docutils/parsers/rst/directives/tables.py
13
skipinitialspace = True
15
quoting = csv.QUOTE_MINIMAL
18
def __init__(self, options):
19
if 'delim' in options:
21
skipinitialspace = True
23
quoting = csv.QUOTE_MINIMAL
26
def check_requirements(self):
28
--- a/test/test_parsers/test_rst/test_directives/test_tables.py
29
+++ b/test/test_parsers/test_rst/test_directives/test_tables.py
32
null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0]
34
+def unexpected_eod():
35
+ reader = csv.reader(['"\n'], strict=1)
38
+unexpected_eod_exception = DocutilsTestSupport.exception_data(unexpected_eod)[0]
44
<system_message level="3" line="1" source="test data" type="ERROR">
46
Error with CSV data in "csv-table" directive:
47
- newline inside string
49
<literal_block xml:space="preserve">
50
.. csv-table:: bad CSV data
54
+""" % unexpected_eod_exception],
56
.. csv-table:: bad CSV header data
57
:header: "bad", \"csv, data
59
<system_message level="3" line="1" source="test data" type="ERROR">
61
Error with CSV data in "csv-table" directive:
62
- newline inside string
64
<literal_block xml:space="preserve">
65
.. csv-table:: bad CSV header data
66
:header: "bad", \"csv, data
70
+""" % unexpected_eod_exception],
72
.. csv-table:: bad encoding