5
:Contact: goodger@users.sourceforge.net
6
:Revision: $Revision: 1.3 $
7
:Date: $Date: 2002/07/18 01:47:49 $
8
:Copyright: This module has been placed in the public domain.
13
from __init__ import DocutilsTestSupport
16
s = DocutilsTestSupport.ParserTestSuite()
17
s.generateTests(totest)
22
totest['full_tables'] = [
24
+-------------------------------------+
25
| A table with one cell and one line. |
26
+-------------------------------------+
32
<colspec colwidth="37">
37
A table with one cell and one line.
40
+-----------------------+
41
| A table with one cell |
43
+-----------------------+
49
<colspec colwidth="23">
58
+-----------------------+
59
| A malformed table. |
60
+-----------------------+
64
<system_message level="3" type="ERROR">
66
Malformed table at line 1; formatting as a literal block.
68
+-----------------------+
69
| A malformed table. |
70
+-----------------------+
73
+------------------------+
74
| A well-formed | table. |
75
+------------------------+
77
+------------------------+
78
| This +----------+ too! |
79
+------------------------+
85
<colspec colwidth="24">
90
A well-formed | table.
93
<colspec colwidth="24">
98
This +----------+ too!
101
+--------------+--------------+
102
| A table with | two columns. |
103
+--------------+--------------+
109
<colspec colwidth="14">
110
<colspec colwidth="14">
131
<colspec colwidth="14">
143
+--------------+-------------+
144
| A table with | two columns |
145
+--------------+-------------+
147
+--------------+-------------+
153
<colspec colwidth="14">
154
<colspec colwidth="13">
172
+--------------+---------------+
173
| A table with | two columns, |
174
+--------------+---------------+
175
| two rows, and a column span. |
176
+------------------------------+
182
<colspec colwidth="14">
183
<colspec colwidth="15">
195
two rows, and a column span.
198
+--------------------------+
199
| A table with three rows, |
200
+------------+-------------+
201
| and two | columns. |
202
+------------+-------------+
203
| First and last rows |
204
| contains column spans. |
205
+--------------------------+
211
<colspec colwidth="12">
212
<colspec colwidth="13">
217
A table with three rows,
229
contains column spans.
232
+--------------+--------------+
233
| A table with | two columns, |
234
+--------------+ and a row |
235
| two rows, | span. |
236
+--------------+--------------+
242
<colspec colwidth="14">
243
<colspec colwidth="14">
260
+------------+-------------+---------------+
261
| A table | two rows in | and row spans |
262
| with three +-------------+ to left and |
263
| columns, | the middle, | right. |
264
+------------+-------------+---------------+
270
<colspec colwidth="12">
271
<colspec colwidth="13">
272
<colspec colwidth="15">
294
Complex spanning pattern (no edge knows all rows/cols):
296
+-----------+-------------------------+
297
| W/NW cell | N/NE cell |
298
| +-------------+-----------+
299
| | Middle cell | E/SE cell |
300
+-----------+-------------+ |
302
+-------------------------+-----------+
307
Complex spanning pattern (no edge knows all rows/cols):
310
<colspec colwidth="11">
311
<colspec colwidth="13">
312
<colspec colwidth="11">
334
+------------------------+------------+----------+----------+
335
| Header row, column 1 | Header 2 | Header 3 | Header 4 |
336
+========================+============+==========+==========+
337
| body row 1, column 1 | column 2 | column 3 | column 4 |
338
+------------------------+------------+----------+----------+
339
| body row 2 | Cells may span columns. |
340
+------------------------+------------+---------------------+
341
| body row 3 | Cells may | - Table cells |
342
+------------------------+ span rows. | - contain |
343
| body row 4 | | - body elements. |
344
+------------------------+------------+---------------------+
350
<colspec colwidth="24">
351
<colspec colwidth="12">
352
<colspec colwidth="10">
353
<colspec colwidth="10">
388
Cells may span columns.
397
<entry morecols="1" morerows="1">
398
<bullet_list bullet="-">
414
+-----------------+--------+
415
| A simple table | cell 2 |
416
+-----------------+--------+
418
+-----------------+--------+
419
No blank line after table.
425
<colspec colwidth="17">
426
<colspec colwidth="8">
442
<system_message level="2" type="WARNING">
444
Blank line required after table at line 6.
446
No blank line after table.
449
+-----------------+--------+
450
| A simple table | cell 2 |
451
+-----------------+--------+
453
+-----------------+--------+
454
Unexpected indent and no blank line after table.
460
<colspec colwidth="17">
461
<colspec colwidth="8">
477
<system_message level="3" type="ERROR">
479
Unexpected indentation at line 6.
480
<system_message level="2" type="WARNING">
482
Blank line required after table at line 6.
485
Unexpected indent and no blank line after table.
488
+--------------+-------------+
491
| Cells must be rectangles. |
492
+----------------------------+
496
<system_message level="3" type="ERROR">
498
Malformed table at line 1; formatting as a literal block.
499
Malformed table; parse incomplete.
501
+--------------+-------------+
504
| Cells must be rectangles. |
505
+----------------------------+
508
+------------------------------+
509
| This table contains another. |
511
| +-------------------------+ |
512
| | A table within a table. | |
513
| +-------------------------+ |
514
+------------------------------+
520
<colspec colwidth="30">
525
This table contains another.
528
<colspec colwidth="25">
533
A table within a table.
536
+------------------+--------+
538
+------------------+--------+
539
| with empty cells | |
540
+------------------+--------+
546
<colspec colwidth="18">
547
<colspec colwidth="8">
562
totest['simple_tables'] = [
564
============ ============
565
A table with two columns.
566
============ ============
574
<colspec colwidth="12">
575
<colspec colwidth="12">
588
============ ============
589
A table with two columns
591
============ ============
597
<colspec colwidth="12">
598
<colspec colwidth="12">
616
============ ==============
617
A table with two columns,
618
two rows, and a column span.
619
============================
625
<colspec colwidth="12">
626
<colspec colwidth="14">
638
two rows, and a column span.
641
== =========== ===========
642
1 A table with three rows,
644
3 First and last rows
645
contain column spans.
647
This last row is a multi-line row, and overflows to the right.
648
== ========================
654
<colspec colwidth="2">
655
<colspec colwidth="11">
656
<colspec colwidth="49">
664
A table with three rows,
682
contain column spans.
684
This last row is a multi-line row, and overflows to the right.
687
======= ========= ========
688
A table with three columns.
689
================== ========
695
<colspec colwidth="7">
696
<colspec colwidth="9">
697
<colspec colwidth="8">
708
============== ======
714
<system_message level="3" type="ERROR">
716
Malformed table at line 1; formatting as a literal block.
717
No bottom table border found.
719
============== ======
724
============== ======
725
A simple table cell 2
727
============== ======
728
No blank line after table.
732
<system_message level="3" type="ERROR">
734
Malformed table at line 1; formatting as a literal block.
735
No bottom table border found or no blank line after table bottom.
737
============== ======
738
A simple table cell 2
740
============== ======
741
<system_message level="2" type="WARNING">
743
Blank line required after table at line 5.
745
No blank line after table.
748
============== ======
749
A simple table cell 2
750
============== ======
752
============== ======
753
No blank line after table.
759
<colspec colwidth="14">
760
<colspec colwidth="6">
777
<system_message level="2" type="WARNING">
779
Blank line required after table at line 6.
781
No blank line after table.
784
============== ======
785
A simple table cell 2
787
============== ======
788
Unexpected indent and no blank line after table.
792
<system_message level="3" type="ERROR">
794
Malformed table at line 1; formatting as a literal block.
795
No bottom table border found or no blank line after table bottom.
797
============== ======
798
A simple table cell 2
800
============== ======
801
<system_message level="2" type="WARNING">
803
Blank line required after table at line 5.
806
Unexpected indent and no blank line after table.
809
============== ======
812
============ ========
816
<system_message level="3" type="ERROR">
818
Malformed table at line 1; formatting as a literal block.
819
Column span alignment problem at line offset 2.
821
============== ======
824
============ ========
834
<system_message level="3" type="ERROR">
836
Malformed table at line 1; formatting as a literal block.
837
Text in column margin at line offset 1.
845
== ============================
846
1 This table contains another.
847
2 ======= ====== ========
848
A table within a table.
849
======= ====== ========
851
The outer table does have to
852
have at least two columns
854
== ============================
860
<colspec colwidth="2">
861
<colspec colwidth="28">
869
This table contains another.
877
<colspec colwidth="7">
878
<colspec colwidth="6">
879
<colspec colwidth="8">
892
The outer table does have to
893
have at least two columns
897
================ ======
900
================ ======
906
<colspec colwidth="16">
907
<colspec colwidth="6">
921
============== ========
923
============== ========
926
============== ========
932
<colspec colwidth="14">
933
<colspec colwidth="8">
954
if __name__ == '__main__':
956
unittest.main(defaultTest='suite')