Spelling fixes
[docutils.git] / test / test_parsers / test_rst / test_tables.py
blob1df34053b6c095cfe16347b34e34aea84e4d082c
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 with
793 no bottom border
794 """,
795 """\
796 <document source="test data">
797 <system_message level="3" line="1" source="test data" type="ERROR">
798 <paragraph>
799 Malformed table.
800 No bottom table border found.
801 <literal_block xml:space="preserve">
802 ============== ======
803 A simple table with
804 no bottom border
805 """],
806 ["""\
807 ============== ======
808 A simple table cell 2
809 cell 3 cell 4
810 ============== ======
811 No blank line after table.
812 """,
813 """\
814 <document source="test data">
815 <system_message level="3" line="1" source="test data" type="ERROR">
816 <paragraph>
817 Malformed table.
818 No bottom table border found or no blank line after table bottom.
819 <literal_block xml:space="preserve">
820 ============== ======
821 A simple table cell 2
822 cell 3 cell 4
823 ============== ======
824 <system_message level="2" line="5" source="test data" type="WARNING">
825 <paragraph>
826 Blank line required after table.
827 <paragraph>
828 No blank line after table.
829 """],
830 ["""\
831 ============== ======
832 A simple table cell 2
833 ============== ======
834 cell 3 cell 4
835 ============== ======
836 No blank line after table.
837 """,
838 """\
839 <document source="test data">
840 <table>
841 <tgroup cols="2">
842 <colspec colwidth="14">
843 <colspec colwidth="6">
844 <thead>
845 <row>
846 <entry>
847 <paragraph>
848 A simple table
849 <entry>
850 <paragraph>
851 cell 2
852 <tbody>
853 <row>
854 <entry>
855 <paragraph>
856 cell 3
857 <entry>
858 <paragraph>
859 cell 4
860 <system_message level="2" line="6" source="test data" type="WARNING">
861 <paragraph>
862 Blank line required after table.
863 <paragraph>
864 No blank line after table.
865 """],
866 ["""\
867 ============== ======
868 A simple table cell 2
869 cell 3 cell 4
870 ============== ======
871 Unexpected indent and no blank line after table.
872 """,
873 """\
874 <document source="test data">
875 <system_message level="3" line="1" source="test data" type="ERROR">
876 <paragraph>
877 Malformed table.
878 No bottom table border found or no blank line after table bottom.
879 <literal_block xml:space="preserve">
880 ============== ======
881 A simple table cell 2
882 cell 3 cell 4
883 ============== ======
884 <system_message level="2" line="5" source="test data" type="WARNING">
885 <paragraph>
886 Blank line required after table.
887 <block_quote>
888 <paragraph>
889 Unexpected indent and no blank line after table.
890 """],
891 ["""\
892 ============== ======
893 A bad table cell 2
894 cell 3 cell 4
895 ============ ========
896 """,
897 """\
898 <document source="test data">
899 <system_message level="3" line="4" source="test data" type="ERROR">
900 <paragraph>
901 Malformed table.
902 Column span alignment problem in table line 4.
903 <literal_block xml:space="preserve">
904 ============== ======
905 A bad table cell 2
906 cell 3 cell 4
907 ============ ========
908 """],
909 ["""\
910 ======== =========
911 A bad table cell 2
912 cell 3 cell 4
913 ======== =========
914 """,
915 """\
916 <document source="test data">
917 <system_message level="3" line="2" source="test data" type="ERROR">
918 <paragraph>
919 Malformed table.
920 Text in column margin in table line 2.
921 <literal_block xml:space="preserve">
922 ======== =========
923 A bad table cell 2
924 cell 3 cell 4
925 ======== =========
926 """],
927 ["""\
928 == ============================
929 1 This table contains another.
930 2 ======= ====== ========
931 A table within a table.
932 ======= ====== ========
934 The outer table does have to
935 have at least two columns
936 though.
937 == ============================
938 """,
939 """\
940 <document source="test data">
941 <table>
942 <tgroup cols="2">
943 <colspec colwidth="2">
944 <colspec colwidth="28">
945 <tbody>
946 <row>
947 <entry>
948 <paragraph>
950 <entry>
951 <paragraph>
952 This table contains another.
953 <row>
954 <entry>
955 <paragraph>
957 <entry>
958 <table>
959 <tgroup cols="3">
960 <colspec colwidth="7">
961 <colspec colwidth="6">
962 <colspec colwidth="8">
963 <tbody>
964 <row>
965 <entry>
966 <paragraph>
967 A table
968 <entry>
969 <paragraph>
970 within
971 <entry>
972 <paragraph>
973 a table.
974 <paragraph>
975 The outer table does have to
976 have at least two columns
977 though.
978 """],
979 ["""\
980 ================ ======
981 A simple table
982 with empty cells
983 ================ ======
984 """,
985 """\
986 <document source="test data">
987 <table>
988 <tgroup cols="2">
989 <colspec colwidth="16">
990 <colspec colwidth="6">
991 <tbody>
992 <row>
993 <entry>
994 <paragraph>
995 A simple table
996 <entry>
997 <row>
998 <entry>
999 <paragraph>
1000 with empty cells
1001 <entry>
1002 """],
1003 ["""\
1004 ============== ========
1005 A table with
1006 ============== ========
1007 centered cells.
1009 ============== ========
1010 """,
1011 """\
1012 <document source="test data">
1013 <table>
1014 <tgroup cols="2">
1015 <colspec colwidth="14">
1016 <colspec colwidth="8">
1017 <thead>
1018 <row>
1019 <entry>
1020 <paragraph>
1021 A table
1022 <entry>
1023 <paragraph>
1024 with
1025 <tbody>
1026 <row>
1027 <entry>
1028 <paragraph>
1029 centered
1030 <entry>
1031 <paragraph>
1032 cells.
1033 """],
1034 ["""\
1035 ============== ======
1036 A simple table this text extends to the right
1037 cell 3 the bottom border below is too long
1038 ============== ========
1039 """,
1040 """\
1041 <document source="test data">
1042 <system_message level="3" line="1" source="test data" type="ERROR">
1043 <paragraph>
1044 Malformed table.
1045 Bottom/header table border does not match top border.
1046 <literal_block xml:space="preserve">
1047 ============== ======
1048 A simple table this text extends to the right
1049 cell 3 the bottom border below is too long
1050 ============== ========
1051 """],
1052 ["""\
1053 ============ =================
1054 A table with row separators.
1055 ------------ -----------------
1057 Blank line before.
1058 ------------ -----------------
1060 Blank lines before and after.
1062 ------------ -----------------
1063 Blank line after.
1065 ============ =================
1066 """,
1067 """\
1068 <document source="test data">
1069 <table>
1070 <tgroup cols="2">
1071 <colspec colwidth="12">
1072 <colspec colwidth="17">
1073 <tbody>
1074 <row>
1075 <entry>
1076 <paragraph>
1077 A table with
1078 <entry>
1079 <paragraph>
1080 row separators.
1081 <row>
1082 <entry>
1083 <paragraph>
1084 Blank line
1085 <entry>
1086 <paragraph>
1087 before.
1088 <row>
1089 <entry>
1090 <paragraph>
1091 Blank lines
1092 <entry>
1093 <paragraph>
1094 before and after.
1095 <row>
1096 <entry>
1097 <paragraph>
1098 Blank line
1099 <entry>
1100 <paragraph>
1101 after.
1102 """],
1103 ["""\
1104 ============ ====================
1105 A table with many row separators.
1106 ------------ --------------------
1107 ------------ --------------------
1109 ------------ --------------------
1110 ============ ====================
1111 """,
1112 """\
1113 <document source="test data">
1114 <table>
1115 <tgroup cols="2">
1116 <colspec colwidth="12">
1117 <colspec colwidth="20">
1118 <tbody>
1119 <row>
1120 <entry>
1121 <paragraph>
1122 A table with
1123 <entry>
1124 <paragraph>
1125 many row separators.
1126 <row>
1127 <entry>
1128 <entry>
1129 <row>
1130 <entry>
1131 <entry>
1132 <row>
1133 <entry>
1134 <entry>
1135 """],
1136 ["""\
1137 == =========== ===========
1138 1 Span columns 2 & 3
1139 -- ------------------------
1140 2 Span columns 2 & 3
1141 ------------------------
1143 == =========== ===========
1145 == =========== ===========
1146 1 Span cols 1&2 but not 3
1147 --------------- -----------
1148 2 Span cols 1&2 but not 3
1149 ---------------
1150 3 no spans here
1151 == =========== ===========
1153 == =========== ===========
1154 1 Not a span Not a span
1155 ----------- -----------
1157 == =========== ===========
1158 """,
1159 """\
1160 <document source="test data">
1161 <system_message level="3" line="4" source="test data" type="ERROR">
1162 <paragraph>
1163 Malformed table.
1164 Text in column margin in table line 4.
1165 <literal_block xml:space="preserve">
1166 == =========== ===========
1167 1 Span columns 2 & 3
1168 -- ------------------------
1169 2 Span columns 2 & 3
1170 ------------------------
1172 == =========== ===========
1173 <system_message level="3" line="13" source="test data" type="ERROR">
1174 <paragraph>
1175 Malformed table.
1176 Column span incomplete in table line 5.
1177 <literal_block xml:space="preserve">
1178 == =========== ===========
1179 1 Span cols 1&2 but not 3
1180 --------------- -----------
1181 2 Span cols 1&2 but not 3
1182 ---------------
1183 3 no spans here
1184 == =========== ===========
1185 <table>
1186 <tgroup cols="3">
1187 <colspec colwidth="2">
1188 <colspec colwidth="11">
1189 <colspec colwidth="11">
1190 <tbody>
1191 <row>
1192 <entry>
1193 <paragraph>
1195 <entry>
1196 <system_message level="4" line="19" source="test data" type="SEVERE">
1197 <paragraph>
1198 Unexpected section title.
1199 <literal_block xml:space="preserve">
1200 Not a span
1201 -----------
1202 <entry>
1203 <system_message level="4" line="19" source="test data" type="SEVERE">
1204 <paragraph>
1205 Unexpected section title.
1206 <literal_block xml:space="preserve">
1207 Not a span
1208 -----------
1209 <row>
1210 <entry>
1211 <paragraph>
1213 <entry>
1214 <entry>
1215 """],
1216 ["""\
1217 ========= =====================================================================
1218 Inclusion .. include::
1220 Note The first row of this table may expand
1221 to accommodate long filesystem paths.
1222 ========= =====================================================================
1223 """ % ('\n'.join([' %-65s' % include2[part * 65 : (part + 1) * 65]
1224 for part in range(len(include2) // 65 + 1)])),
1225 """\
1226 <document source="test data">
1227 <table>
1228 <tgroup cols="2">
1229 <colspec colwidth="9">
1230 <colspec colwidth="69">
1231 <tbody>
1232 <row>
1233 <entry>
1234 <paragraph>
1235 Inclusion
1236 <entry>
1237 <paragraph>
1238 Here are some paragraphs
1239 that can appear at any level.
1240 <paragraph>
1241 This file (include2.txt) is used by
1242 <literal>
1243 test_include.py
1245 <row>
1246 <entry>
1247 <paragraph>
1248 Note
1249 <entry>
1250 <paragraph>
1251 The first row of this table may expand
1252 to accommodate long filesystem paths.
1253 """],
1257 if __name__ == '__main__':
1258 import unittest
1259 unittest.main(defaultTest='suite')