~ubuntu-branches/ubuntu/saucy/python-docutils/saucy-proposed

« back to all changes in this revision

Viewing changes to test/test_parsers/test_rst/test_directives/test_tables.py

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2013-05-17 16:47:30 UTC
  • mfrom: (20.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20130517164730-5ux7p59z0jdku6pf
Tags: 0.10-3ubuntu1
* Merge with Debian unstable, remaining changes:
  - Use dh_python2 instead of dh_pysupport.
  - Backport patch to support embedded aliases in references
    (support-aliases-in-references.diff).
* disable_py33_failing_tests.diff: dropped, the issue is now
  properly fixed in Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
import os
14
14
import csv
 
15
import sys
15
16
from docutils.parsers.rst.directives import tables
16
17
 
17
18
 
32
33
else:
33
34
    unichr_exception_string = str(unichr_exception)
34
35
 
 
36
csv_unknown_url = "'bogus.csv'"
 
37
if sys.version_info < (3,3,2):
 
38
    csv_unknown_url = "bogus.csv"
 
39
 
35
40
def null_bytes():
36
41
    import csv
37
42
    csv_data = open(utf_16_csv, 'rb').read()
42
47
 
43
48
null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0]
44
49
 
 
50
def unexpected_eod():
 
51
    reader = csv.reader(['"\n'], strict=1)
 
52
    reader.next()
 
53
 
 
54
unexpected_eod_exception = DocutilsTestSupport.exception_data(unexpected_eod)[0]
 
55
 
45
56
totest = {}
46
57
 
47
58
totest['table'] = [
572
583
    <system_message level="4" line="1" source="test data" type="SEVERE">
573
584
        <paragraph>
574
585
            Problems with "csv-table" directive URL "bogus.csv":
575
 
            unknown url type: bogus.csv.
 
586
            unknown url type: %s.
576
587
        <literal_block xml:space="preserve">
577
588
            .. csv-table:: bad URL
578
589
               :url: bogus.csv
579
 
"""],
 
590
""" % csv_unknown_url],
580
591
["""\
581
592
.. csv-table:: column mismatch
582
593
   :widths: 10,20
751
762
               :delim: U+9999999999999
752
763
""" % unichr_exception_string],
753
764
["""\
 
765
.. csv-table:: bad CSV data
 
766
 
 
767
   "bad", \"csv, data
 
768
""",
 
769
"""\
 
770
<document source="test data">
 
771
    <system_message level="3" line="1" source="test data" type="ERROR">
 
772
        <paragraph>
 
773
            Error with CSV data in "csv-table" directive:
 
774
            %s
 
775
        <literal_block xml:space="preserve">
 
776
            .. csv-table:: bad CSV data
 
777
            \n\
 
778
               "bad", \"csv, data
 
779
""" % unexpected_eod_exception],
 
780
["""\
 
781
.. csv-table:: bad CSV header data
 
782
   :header: "bad", \"csv, data
 
783
 
 
784
   good, csv, data
 
785
""",
 
786
"""\
 
787
<document source="test data">
 
788
    <system_message level="3" line="1" source="test data" type="ERROR">
 
789
        <paragraph>
 
790
            Error with CSV data in "csv-table" directive:
 
791
            %s
 
792
        <literal_block xml:space="preserve">
 
793
            .. csv-table:: bad CSV header data
 
794
               :header: "bad", \"csv, data
 
795
            \n\
 
796
               good, csv, data
 
797
""" % unexpected_eod_exception],
 
798
["""\
754
799
.. csv-table:: bad encoding
755
800
   :file: %s
756
801
   :encoding: latin-1