Drop 2.4 and 2.5 compatibility code, part 2.
[docutils.git] / docutils / test / test_parsers / test_rst / test_tables.py
blobd6c6789cb38e6eab382877869b5484ba9c176f2a
1 #! /usr/bin/env python
3 # $Id$
4 # Author: David Goodger <goodger@python.org>
5 # Copyright: This module has been placed in the public domain.
7 """
8 Tests for states.py.
9 """
11 import os
12 from __init__ import DocutilsTestSupport
14 def suite():
15 s = DocutilsTestSupport.ParserTestSuite()
16 s.generateTests(totest)
17 return s
19 mydir = 'test_parsers/test_rst/'
20 include2 = os.path.join(mydir, 'test_directives/include2.txt')
22 totest = {}
24 totest['grid_tables'] = [
25 ["""\
26 +-------------------------------------+
27 | A table with one cell and one line. |
28 +-------------------------------------+
29 """,
30 """\
31 <document source="test data">
32 <table>
33 <tgroup cols="1">
34 <colspec colwidth="37">
35 <tbody>
36 <row>
37 <entry>
38 <paragraph>
39 A table with one cell and one line.
40 """],
41 ["""\
42 +-----------------------+
43 | A table with one cell |
44 | and two lines. |
45 +-----------------------+
46 """,
47 """\
48 <document source="test data">
49 <table>
50 <tgroup cols="1">
51 <colspec colwidth="23">
52 <tbody>
53 <row>
54 <entry>
55 <paragraph>
56 A table with one cell
57 and two lines.
58 """],
59 ["""\
60 +-----------------------+
61 | A malformed table. |
62 +-----------------------+
63 """,
64 """\
65 <document source="test data">
66 <system_message level="3" line="1" source="test data" type="ERROR">
67 <paragraph>
68 Malformed table.
69 <literal_block xml:space="preserve">
70 +-----------------------+
71 | A malformed table. |
72 +-----------------------+
73 """],
74 ["""\
75 +------------------------+
76 | A well-formed | table. |
77 +------------------------+
79 +------------------------+
80 | This +----------+ too! |
81 +------------------------+
82 """,
83 """\
84 <document source="test data">
85 <table>
86 <tgroup cols="1">
87 <colspec colwidth="24">
88 <tbody>
89 <row>
90 <entry>
91 <paragraph>
92 A well-formed | table.
93 <table>
94 <tgroup cols="1">
95 <colspec colwidth="24">
96 <tbody>
97 <row>
98 <entry>
99 <paragraph>
100 This +----------+ too!
101 """],
102 ["""\
103 +--------------+--------------+
104 | A table with | two columns. |
105 +--------------+--------------+
106 """,
107 """\
108 <document source="test data">
109 <table>
110 <tgroup cols="2">
111 <colspec colwidth="14">
112 <colspec colwidth="14">
113 <tbody>
114 <row>
115 <entry>
116 <paragraph>
117 A table with
118 <entry>
119 <paragraph>
120 two columns.
121 """],
122 ["""\
123 +--------------+
124 | A table with |
125 +--------------+
126 | two rows. |
127 +--------------+
128 """,
129 """\
130 <document source="test data">
131 <table>
132 <tgroup cols="1">
133 <colspec colwidth="14">
134 <tbody>
135 <row>
136 <entry>
137 <paragraph>
138 A table with
139 <row>
140 <entry>
141 <paragraph>
142 two rows.
143 """],
144 ["""\
145 +--------------+-------------+
146 | A table with | two columns |
147 +--------------+-------------+
148 | and | two rows. |
149 +--------------+-------------+
150 """,
151 """\
152 <document source="test data">
153 <table>
154 <tgroup cols="2">
155 <colspec colwidth="14">
156 <colspec colwidth="13">
157 <tbody>
158 <row>
159 <entry>
160 <paragraph>
161 A table with
162 <entry>
163 <paragraph>
164 two columns
165 <row>
166 <entry>
167 <paragraph>
169 <entry>
170 <paragraph>
171 two rows.
172 """],
173 ["""\
174 +--------------+---------------+
175 | A table with | two columns, |
176 +--------------+---------------+
177 | two rows, and a column span. |
178 +------------------------------+
179 """,
180 """\
181 <document source="test data">
182 <table>
183 <tgroup cols="2">
184 <colspec colwidth="14">
185 <colspec colwidth="15">
186 <tbody>
187 <row>
188 <entry>
189 <paragraph>
190 A table with
191 <entry>
192 <paragraph>
193 two columns,
194 <row>
195 <entry morecols="1">
196 <paragraph>
197 two rows, and a column span.
198 """],
199 ["""\
200 +--------------------------+
201 | A table with three rows, |
202 +------------+-------------+
203 | and two | columns. |
204 +------------+-------------+
205 | First and last rows |
206 | contains column spans. |
207 +--------------------------+
208 """,
209 """\
210 <document source="test data">
211 <table>
212 <tgroup cols="2">
213 <colspec colwidth="12">
214 <colspec colwidth="13">
215 <tbody>
216 <row>
217 <entry morecols="1">
218 <paragraph>
219 A table with three rows,
220 <row>
221 <entry>
222 <paragraph>
223 and two
224 <entry>
225 <paragraph>
226 columns.
227 <row>
228 <entry morecols="1">
229 <paragraph>
230 First and last rows
231 contains column spans.
232 """],
233 ["""\
234 +--------------+--------------+
235 | A table with | two columns, |
236 +--------------+ and a row |
237 | two rows, | span. |
238 +--------------+--------------+
239 """,
240 """\
241 <document source="test data">
242 <table>
243 <tgroup cols="2">
244 <colspec colwidth="14">
245 <colspec colwidth="14">
246 <tbody>
247 <row>
248 <entry>
249 <paragraph>
250 A table with
251 <entry morerows="1">
252 <paragraph>
253 two columns,
254 and a row
255 span.
256 <row>
257 <entry>
258 <paragraph>
259 two rows,
260 """],
261 ["""\
262 +------------+-------------+---------------+
263 | A table | two rows in | and row spans |
264 | with three +-------------+ to left and |
265 | columns, | the middle, | right. |
266 +------------+-------------+---------------+
267 """,
268 """\
269 <document source="test data">
270 <table>
271 <tgroup cols="3">
272 <colspec colwidth="12">
273 <colspec colwidth="13">
274 <colspec colwidth="15">
275 <tbody>
276 <row>
277 <entry morerows="1">
278 <paragraph>
279 A table
280 with three
281 columns,
282 <entry>
283 <paragraph>
284 two rows in
285 <entry morerows="1">
286 <paragraph>
287 and row spans
288 to left and
289 right.
290 <row>
291 <entry>
292 <paragraph>
293 the middle,
294 """],
295 ["""\
296 Complex spanning pattern (no edge knows all rows/cols):
298 +-----------+-------------------------+
299 | W/NW cell | N/NE cell |
300 | +-------------+-----------+
301 | | Middle cell | E/SE cell |
302 +-----------+-------------+ |
303 | S/SE cell | |
304 +-------------------------+-----------+
305 """,
306 """\
307 <document source="test data">
308 <paragraph>
309 Complex spanning pattern (no edge knows all rows/cols):
310 <table>
311 <tgroup cols="3">
312 <colspec colwidth="11">
313 <colspec colwidth="13">
314 <colspec colwidth="11">
315 <tbody>
316 <row>
317 <entry morerows="1">
318 <paragraph>
319 W/NW cell
320 <entry morecols="1">
321 <paragraph>
322 N/NE cell
323 <row>
324 <entry>
325 <paragraph>
326 Middle cell
327 <entry morerows="1">
328 <paragraph>
329 E/SE cell
330 <row>
331 <entry morecols="1">
332 <paragraph>
333 S/SE cell
334 """],
335 ["""\
336 +------------------------+------------+----------+----------+
337 | Header row, column 1 | Header 2 | Header 3 | Header 4 |
338 +========================+============+==========+==========+
339 | body row 1, column 1 | column 2 | column 3 | column 4 |
340 +------------------------+------------+----------+----------+
341 | body row 2 | Cells may span columns. |
342 +------------------------+------------+---------------------+
343 | body row 3 | Cells may | - Table cells |
344 +------------------------+ span rows. | - contain |
345 | body row 4 | | - body elements. |
346 +------------------------+------------+---------------------+
347 """,
348 """\
349 <document source="test data">
350 <table>
351 <tgroup cols="4">
352 <colspec colwidth="24">
353 <colspec colwidth="12">
354 <colspec colwidth="10">
355 <colspec colwidth="10">
356 <thead>
357 <row>
358 <entry>
359 <paragraph>
360 Header row, column 1
361 <entry>
362 <paragraph>
363 Header 2
364 <entry>
365 <paragraph>
366 Header 3
367 <entry>
368 <paragraph>
369 Header 4
370 <tbody>
371 <row>
372 <entry>
373 <paragraph>
374 body row 1, column 1
375 <entry>
376 <paragraph>
377 column 2
378 <entry>
379 <paragraph>
380 column 3
381 <entry>
382 <paragraph>
383 column 4
384 <row>
385 <entry>
386 <paragraph>
387 body row 2
388 <entry morecols="2">
389 <paragraph>
390 Cells may span columns.
391 <row>
392 <entry>
393 <paragraph>
394 body row 3
395 <entry morerows="1">
396 <paragraph>
397 Cells may
398 span rows.
399 <entry morecols="1" morerows="1">
400 <bullet_list bullet="-">
401 <list_item>
402 <paragraph>
403 Table cells
404 <list_item>
405 <paragraph>
406 contain
407 <list_item>
408 <paragraph>
409 body elements.
410 <row>
411 <entry>
412 <paragraph>
413 body row 4
414 """],
415 ["""\
416 +-----------------+--------+
417 | A simple table | cell 2 |
418 +-----------------+--------+
419 | cell 3 | cell 4 |
420 +-----------------+--------+
421 No blank line after table.
422 """,
423 """\
424 <document source="test data">
425 <table>
426 <tgroup cols="2">
427 <colspec colwidth="17">
428 <colspec colwidth="8">
429 <tbody>
430 <row>
431 <entry>
432 <paragraph>
433 A simple table
434 <entry>
435 <paragraph>
436 cell 2
437 <row>
438 <entry>
439 <paragraph>
440 cell 3
441 <entry>
442 <paragraph>
443 cell 4
444 <system_message level="2" line="6" source="test data" type="WARNING">
445 <paragraph>
446 Blank line required after table.
447 <paragraph>
448 No blank line after table.
449 """],
450 ["""\
451 +-----------------+--------+
452 | A simple table | cell 2 |
453 +-----------------+--------+
454 | cell 3 | cell 4 |
455 +-----------------+--------+
456 Unexpected indent and no blank line after table.
457 """,
458 """\
459 <document source="test data">
460 <table>
461 <tgroup cols="2">
462 <colspec colwidth="17">
463 <colspec colwidth="8">
464 <tbody>
465 <row>
466 <entry>
467 <paragraph>
468 A simple table
469 <entry>
470 <paragraph>
471 cell 2
472 <row>
473 <entry>
474 <paragraph>
475 cell 3
476 <entry>
477 <paragraph>
478 cell 4
479 <system_message level="3" line="6" source="test data" type="ERROR">
480 <paragraph>
481 Unexpected indentation.
482 <system_message level="2" line="6" source="test data" type="WARNING">
483 <paragraph>
484 Blank line required after table.
485 <block_quote>
486 <paragraph>
487 Unexpected indent and no blank line after table.
488 """],
489 ["""\
490 +--------------+-------------+
491 | A bad table. | |
492 +--------------+ |
493 | Cells must be rectangles. |
494 +----------------------------+
495 """,
496 """\
497 <document source="test data">
498 <system_message level="3" line="1" source="test data" type="ERROR">
499 <paragraph>
500 Malformed table.
501 Malformed table; parse incomplete.
502 <literal_block xml:space="preserve">
503 +--------------+-------------+
504 | A bad table. | |
505 +--------------+ |
506 | Cells must be rectangles. |
507 +----------------------------+
508 """],
509 ["""\
510 +------------------------------+
511 | This table contains another. |
513 | +-------------------------+ |
514 | | A table within a table. | |
515 | +-------------------------+ |
516 +------------------------------+
517 """,
518 """\
519 <document source="test data">
520 <table>
521 <tgroup cols="1">
522 <colspec colwidth="30">
523 <tbody>
524 <row>
525 <entry>
526 <paragraph>
527 This table contains another.
528 <table>
529 <tgroup cols="1">
530 <colspec colwidth="25">
531 <tbody>
532 <row>
533 <entry>
534 <paragraph>
535 A table within a table.
536 """],
537 ["""\
538 +------------------+--------+
539 | A simple table | |
540 +------------------+--------+
541 | with empty cells | |
542 +------------------+--------+
543 """,
544 """\
545 <document source="test data">
546 <table>
547 <tgroup cols="2">
548 <colspec colwidth="18">
549 <colspec colwidth="8">
550 <tbody>
551 <row>
552 <entry>
553 <paragraph>
554 A simple table
555 <entry>
556 <row>
557 <entry>
558 <paragraph>
559 with empty cells
560 <entry>
561 """],
562 [("""\
563 +------------------------------------------------------------------------------+
564 | .. include:: |
566 +------------------------------------------------------------------------------+
567 | (The first cell of this table may expand |
568 | to accommodate long filesystem paths.) |
569 +------------------------------------------------------------------------------+
570 """) % ('\n'.join(['| %-70s |' % include2[part * 70 : (part + 1) * 70]
571 for part in range(len(include2) // 70 + 1)])),
572 """\
573 <document source="test data">
574 <table>
575 <tgroup cols="1">
576 <colspec colwidth="78">
577 <tbody>
578 <row>
579 <entry>
580 <paragraph>
581 Here are some paragraphs
582 that can appear at any level.
583 <paragraph>
584 This file (include2.txt) is used by
585 <literal>
586 test_include.py
588 <row>
589 <entry>
590 <paragraph>
591 (The first cell of this table may expand
592 to accommodate long filesystem paths.)
593 """],
594 [("""\
595 Something before.
597 +------------------------------------------------------------------------------+
598 | .. include:: |
600 +------------------------------------------------------------------------------+
602 Something afterwards.
604 And more.
605 """) % ('\n'.join(['| %-70s |' % include2[part * 70 : (part + 1) * 70]
606 for part in range(len(include2) // 70 + 1)])),
607 """\
608 <document source="test data">
609 <paragraph>
610 Something before.
611 <table>
612 <tgroup cols="1">
613 <colspec colwidth="78">
614 <tbody>
615 <row>
616 <entry>
617 <paragraph>
618 Here are some paragraphs
619 that can appear at any level.
620 <paragraph>
621 This file (include2.txt) is used by
622 <literal>
623 test_include.py
625 <paragraph>
626 Something afterwards.
627 <paragraph>
628 And more.
629 """],
632 totest['simple_tables'] = [
633 ["""\
634 ============ ============
635 A table with two columns.
636 ============ ============
638 Paragraph.
639 """,
640 """\
641 <document source="test data">
642 <table>
643 <tgroup cols="2">
644 <colspec colwidth="12">
645 <colspec colwidth="12">
646 <tbody>
647 <row>
648 <entry>
649 <paragraph>
650 A table with
651 <entry>
652 <paragraph>
653 two columns.
654 <paragraph>
655 Paragraph.
656 """],
657 ["""\
658 ============ ============
659 A table with two columns
660 and two rows.
661 ============ ============
662 """,
663 """\
664 <document source="test data">
665 <table>
666 <tgroup cols="2">
667 <colspec colwidth="12">
668 <colspec colwidth="12">
669 <tbody>
670 <row>
671 <entry>
672 <paragraph>
673 A table with
674 <entry>
675 <paragraph>
676 two columns
677 <row>
678 <entry>
679 <paragraph>
681 <entry>
682 <paragraph>
683 two rows.
684 """],
685 ["""\
686 ============ ==============
687 A table with two columns,
688 two rows, and a column span.
689 ============================
690 """,
691 """\
692 <document source="test data">
693 <table>
694 <tgroup cols="2">
695 <colspec colwidth="12">
696 <colspec colwidth="14">
697 <tbody>
698 <row>
699 <entry>
700 <paragraph>
701 A table with
702 <entry>
703 <paragraph>
704 two columns,
705 <row>
706 <entry morecols="1">
707 <paragraph>
708 two rows, and a column span.
709 """],
710 ["""\
711 == =========== ===========
712 1 A table with three rows,
713 -- ------------------------
714 2 and three columns.
715 3 First and third rows
716 contain column spans.
718 This row is a multi-line row, and overflows to the right.
719 -- ------------------------
720 4 One last row.
721 == =========== ===========
722 """,
723 """\
724 <document source="test data">
725 <table>
726 <tgroup cols="3">
727 <colspec colwidth="2">
728 <colspec colwidth="11">
729 <colspec colwidth="44">
730 <tbody>
731 <row>
732 <entry>
733 <paragraph>
735 <entry morecols="1">
736 <paragraph>
737 A table with three rows,
738 <row>
739 <entry>
740 <paragraph>
742 <entry>
743 <paragraph>
744 and three
745 <entry>
746 <paragraph>
747 columns.
748 <row>
749 <entry>
750 <paragraph>
752 <entry morecols="1">
753 <paragraph>
754 First and third rows
755 contain column spans.
756 <paragraph>
757 This row is a multi-line row, and overflows to the right.
758 <row>
759 <entry>
760 <paragraph>
762 <entry>
763 <paragraph>
764 One last
765 <entry>
766 <paragraph>
767 row.
768 """],
769 ["""\
770 ======= ========= ========
771 A table with three columns.
772 ================== ========
773 """,
774 """\
775 <document source="test data">
776 <table>
777 <tgroup cols="3">
778 <colspec colwidth="7">
779 <colspec colwidth="9">
780 <colspec colwidth="8">
781 <tbody>
782 <row>
783 <entry morecols="1">
784 <paragraph>
785 A table with three
786 <entry>
787 <paragraph>
788 columns.
789 """],
790 ["""\
791 ============== ======
792 A simple table this text extends to the right
793 cell 3 as does this text
794 ============== ======
795 """,
796 """\
797 <document source="test data">
798 <table>
799 <tgroup cols="2">
800 <colspec colwidth="14">
801 <colspec colwidth="30">
802 <tbody>
803 <row>
804 <entry>
805 <paragraph>
806 A simple table
807 <entry>
808 <paragraph>
809 this text extends to the right
810 <row>
811 <entry>
812 <paragraph>
813 cell 3
814 <entry>
815 <paragraph>
816 as does this text
817 """],
818 ["""\
819 ============== ======
820 A simple table this text extends to the right
821 continuation of cell 2
822 ============== ======
823 """,
824 """\
825 <document source="test data">
826 <table>
827 <tgroup cols="2">
828 <colspec colwidth="14">
829 <colspec colwidth="30">
830 <tbody>
831 <row>
832 <entry>
833 <paragraph>
834 A simple table
835 <entry>
836 <paragraph>
837 this text extends to the right
838 continuation of cell 2
839 """],
840 ["""\
841 ============== ======
842 A simple table with
843 no bottom border
844 """,
845 """\
846 <document source="test data">
847 <system_message level="3" line="1" source="test data" type="ERROR">
848 <paragraph>
849 Malformed table.
850 No bottom table border found.
851 <literal_block xml:space="preserve">
852 ============== ======
853 A simple table with
854 no bottom border
855 """],
856 ["""\
857 ============== ======
858 A simple table cell 2
859 cell 3 cell 4
860 ============== ======
861 No blank line after table.
862 """,
863 """\
864 <document source="test data">
865 <system_message level="3" line="1" source="test data" type="ERROR">
866 <paragraph>
867 Malformed table.
868 No bottom table border found or no blank line after table bottom.
869 <literal_block xml:space="preserve">
870 ============== ======
871 A simple table cell 2
872 cell 3 cell 4
873 ============== ======
874 <system_message level="2" line="5" source="test data" type="WARNING">
875 <paragraph>
876 Blank line required after table.
877 <paragraph>
878 No blank line after table.
879 """],
880 ["""\
881 ============== ======
882 A simple table cell 2
883 ============== ======
884 cell 3 cell 4
885 ============== ======
886 No blank line after table.
887 """,
888 """\
889 <document source="test data">
890 <table>
891 <tgroup cols="2">
892 <colspec colwidth="14">
893 <colspec colwidth="6">
894 <thead>
895 <row>
896 <entry>
897 <paragraph>
898 A simple table
899 <entry>
900 <paragraph>
901 cell 2
902 <tbody>
903 <row>
904 <entry>
905 <paragraph>
906 cell 3
907 <entry>
908 <paragraph>
909 cell 4
910 <system_message level="2" line="6" source="test data" type="WARNING">
911 <paragraph>
912 Blank line required after table.
913 <paragraph>
914 No blank line after table.
915 """],
916 ["""\
917 ============== ======
918 A simple table cell 2
919 cell 3 cell 4
920 ============== ======
921 Unexpected indent and no blank line after table.
922 """,
923 """\
924 <document source="test data">
925 <system_message level="3" line="1" source="test data" type="ERROR">
926 <paragraph>
927 Malformed table.
928 No bottom table border found or no blank line after table bottom.
929 <literal_block xml:space="preserve">
930 ============== ======
931 A simple table cell 2
932 cell 3 cell 4
933 ============== ======
934 <system_message level="2" line="5" source="test data" type="WARNING">
935 <paragraph>
936 Blank line required after table.
937 <block_quote>
938 <paragraph>
939 Unexpected indent and no blank line after table.
940 """],
941 ["""\
942 ============== ======
943 A bad table cell 2
944 cell 3 cell 4
945 ============ ========
946 """,
947 """\
948 <document source="test data">
949 <system_message level="3" line="4" source="test data" type="ERROR">
950 <paragraph>
951 Malformed table.
952 Column span alignment problem in table line 4.
953 <literal_block xml:space="preserve">
954 ============== ======
955 A bad table cell 2
956 cell 3 cell 4
957 ============ ========
958 """],
959 ["""\
960 ======== =========
961 A bad table cell 2
962 cell 3 cell 4
963 ======== =========
964 """,
965 """\
966 <document source="test data">
967 <system_message level="3" line="2" source="test data" type="ERROR">
968 <paragraph>
969 Malformed table.
970 Text in column margin in table line 2.
971 <literal_block xml:space="preserve">
972 ======== =========
973 A bad table cell 2
974 cell 3 cell 4
975 ======== =========
976 """],
977 ["""\
978 == ============================
979 1 This table contains another.
980 2 ======= ====== ========
981 A table within a table.
982 ======= ====== ========
984 The outer table does have to
985 have at least two columns
986 though.
987 == ============================
988 """,
989 """\
990 <document source="test data">
991 <table>
992 <tgroup cols="2">
993 <colspec colwidth="2">
994 <colspec colwidth="28">
995 <tbody>
996 <row>
997 <entry>
998 <paragraph>
1000 <entry>
1001 <paragraph>
1002 This table contains another.
1003 <row>
1004 <entry>
1005 <paragraph>
1007 <entry>
1008 <table>
1009 <tgroup cols="3">
1010 <colspec colwidth="7">
1011 <colspec colwidth="6">
1012 <colspec colwidth="8">
1013 <tbody>
1014 <row>
1015 <entry>
1016 <paragraph>
1017 A table
1018 <entry>
1019 <paragraph>
1020 within
1021 <entry>
1022 <paragraph>
1023 a table.
1024 <paragraph>
1025 The outer table does have to
1026 have at least two columns
1027 though.
1028 """],
1029 ["""\
1030 ================ ======
1031 A simple table
1032 with empty cells
1033 ================ ======
1034 """,
1035 """\
1036 <document source="test data">
1037 <table>
1038 <tgroup cols="2">
1039 <colspec colwidth="16">
1040 <colspec colwidth="6">
1041 <tbody>
1042 <row>
1043 <entry>
1044 <paragraph>
1045 A simple table
1046 <entry>
1047 <row>
1048 <entry>
1049 <paragraph>
1050 with empty cells
1051 <entry>
1052 """],
1053 ["""\
1054 ============== ========
1055 A table with
1056 ============== ========
1057 centered cells.
1059 ============== ========
1060 """,
1061 """\
1062 <document source="test data">
1063 <table>
1064 <tgroup cols="2">
1065 <colspec colwidth="14">
1066 <colspec colwidth="8">
1067 <thead>
1068 <row>
1069 <entry>
1070 <paragraph>
1071 A table
1072 <entry>
1073 <paragraph>
1074 with
1075 <tbody>
1076 <row>
1077 <entry>
1078 <paragraph>
1079 centered
1080 <entry>
1081 <paragraph>
1082 cells.
1083 """],
1084 ["""\
1085 ============== ======
1086 A simple table this text extends to the right
1087 cell 3 the bottom border below is too long
1088 ============== ========
1089 """,
1090 """\
1091 <document source="test data">
1092 <system_message level="3" line="1" source="test data" type="ERROR">
1093 <paragraph>
1094 Malformed table.
1095 Bottom/header table border does not match top border.
1096 <literal_block xml:space="preserve">
1097 ============== ======
1098 A simple table this text extends to the right
1099 cell 3 the bottom border below is too long
1100 ============== ========
1101 """],
1102 ["""\
1103 ============ =================
1104 A table with row separators.
1105 ------------ -----------------
1107 Blank line before.
1108 ------------ -----------------
1110 Blank lines before and after.
1112 ------------ -----------------
1113 Blank line after.
1115 ============ =================
1116 """,
1117 """\
1118 <document source="test data">
1119 <table>
1120 <tgroup cols="2">
1121 <colspec colwidth="12">
1122 <colspec colwidth="17">
1123 <tbody>
1124 <row>
1125 <entry>
1126 <paragraph>
1127 A table with
1128 <entry>
1129 <paragraph>
1130 row separators.
1131 <row>
1132 <entry>
1133 <paragraph>
1134 Blank line
1135 <entry>
1136 <paragraph>
1137 before.
1138 <row>
1139 <entry>
1140 <paragraph>
1141 Blank lines
1142 <entry>
1143 <paragraph>
1144 before and after.
1145 <row>
1146 <entry>
1147 <paragraph>
1148 Blank line
1149 <entry>
1150 <paragraph>
1151 after.
1152 """],
1153 ["""\
1154 ============ ====================
1155 A table with many row separators.
1156 ------------ --------------------
1157 ------------ --------------------
1159 ------------ --------------------
1160 ============ ====================
1161 """,
1162 """\
1163 <document source="test data">
1164 <table>
1165 <tgroup cols="2">
1166 <colspec colwidth="12">
1167 <colspec colwidth="20">
1168 <tbody>
1169 <row>
1170 <entry>
1171 <paragraph>
1172 A table with
1173 <entry>
1174 <paragraph>
1175 many row separators.
1176 <row>
1177 <entry>
1178 <entry>
1179 <row>
1180 <entry>
1181 <entry>
1182 <row>
1183 <entry>
1184 <entry>
1185 """],
1186 ["""\
1187 == =========== ===========
1188 1 Span columns 2 & 3
1189 -- ------------------------
1190 2 Span columns 2 & 3
1191 ------------------------
1193 == =========== ===========
1195 == =========== ===========
1196 1 Span cols 1&2 but not 3
1197 --------------- -----------
1198 2 Span cols 1&2 but not 3
1199 ---------------
1200 3 no spans here
1201 == =========== ===========
1203 == =========== ===========
1204 1 Not a span Not a span
1205 ----------- -----------
1207 == =========== ===========
1208 """,
1209 """\
1210 <document source="test data">
1211 <system_message level="3" line="4" source="test data" type="ERROR">
1212 <paragraph>
1213 Malformed table.
1214 Text in column margin in table line 4.
1215 <literal_block xml:space="preserve">
1216 == =========== ===========
1217 1 Span columns 2 & 3
1218 -- ------------------------
1219 2 Span columns 2 & 3
1220 ------------------------
1222 == =========== ===========
1223 <system_message level="3" line="13" source="test data" type="ERROR">
1224 <paragraph>
1225 Malformed table.
1226 Column span incomplete in table line 5.
1227 <literal_block xml:space="preserve">
1228 == =========== ===========
1229 1 Span cols 1&2 but not 3
1230 --------------- -----------
1231 2 Span cols 1&2 but not 3
1232 ---------------
1233 3 no spans here
1234 == =========== ===========
1235 <table>
1236 <tgroup cols="3">
1237 <colspec colwidth="2">
1238 <colspec colwidth="11">
1239 <colspec colwidth="11">
1240 <tbody>
1241 <row>
1242 <entry>
1243 <paragraph>
1245 <entry>
1246 <system_message level="4" line="19" source="test data" type="SEVERE">
1247 <paragraph>
1248 Unexpected section title.
1249 <literal_block xml:space="preserve">
1250 Not a span
1251 -----------
1252 <entry>
1253 <system_message level="4" line="19" source="test data" type="SEVERE">
1254 <paragraph>
1255 Unexpected section title.
1256 <literal_block xml:space="preserve">
1257 Not a span
1258 -----------
1259 <row>
1260 <entry>
1261 <paragraph>
1263 <entry>
1264 <entry>
1265 """],
1266 ["""\
1267 ========= =====================================================================
1268 Inclusion .. include::
1270 Note The first row of this table may expand
1271 to accommodate long filesystem paths.
1272 ========= =====================================================================
1273 """ % ('\n'.join([' %-65s' % include2[part * 65 : (part + 1) * 65]
1274 for part in range(len(include2) // 65 + 1)])),
1275 """\
1276 <document source="test data">
1277 <table>
1278 <tgroup cols="2">
1279 <colspec colwidth="9">
1280 <colspec colwidth="69">
1281 <tbody>
1282 <row>
1283 <entry>
1284 <paragraph>
1285 Inclusion
1286 <entry>
1287 <paragraph>
1288 Here are some paragraphs
1289 that can appear at any level.
1290 <paragraph>
1291 This file (include2.txt) is used by
1292 <literal>
1293 test_include.py
1295 <row>
1296 <entry>
1297 <paragraph>
1298 Note
1299 <entry>
1300 <paragraph>
1301 The first row of this table may expand
1302 to accommodate long filesystem paths.
1303 """],
1307 if __name__ == '__main__':
1308 import unittest
1309 unittest.main(defaultTest='suite')