5 # Author: David Goodger <goodger@python.org>
6 # Copyright: This module has been placed in the public domain.
12 from __init__
import DocutilsTestSupport
15 s
= DocutilsTestSupport
.SimpleTableParserTestSuite()
16 s
.generateTests(totest
)
21 totest
['simple_tables'] = [
23 ============ ============
24 A table with two columns.
25 ============ ============
29 [[[0, 0, 1, ['A table with']],
30 [0, 0, 1, ['two columns.']]]])],
32 ============ ===============
33 A tāble w̅ith comb̲ining chars
34 ============ ===============
38 [[[0, 0, 1, [u
'A ta\u0304ble w\u0305ith']],
39 [0, 0, 1, [u
'comb\u0332ining chars']]]])],
41 ============ ============
42 A table with two columns
44 ============ ============
48 [[[0, 0, 1, ['A table with']],
49 [0, 0, 1, ['two columns']]],
51 [0, 0, 2, ['two rows.']]]])],
53 ======================================
54 The last row might stick into the margin
56 ======================================
60 [[[0, 0, 1, ['The last row might stick into the margin']]],
61 [[0, 0, 2, ['second row.']]]])],
63 ========== ===========
64 A table with four rows,
65 -----------------------
69 =======================
73 [[[0, 1, 1, ['A table with four rows,']]],
74 [[0, 0, 3, ['and two']],
75 [0, 0, 3, ['columns.']]],
76 [[0, 0, 4, ['First and']],
77 [0, 0, 4, ['last rows']]],
78 [[0, 1, 5, ['contain column spans.']]]])],
85 'TableMarkupError: Text in column margin at line offset 1.'],
92 'TableMarkupError: Text in column margin at line offset 2.'],
94 =========== ================
95 A table with two header rows,
96 -----------------------------
97 the first with a span.
98 =========== ================
100 the second with a span.
101 =============================
104 [[[0, 1, 1, ['A table with two header rows,']]],
105 [[0, 0, 3, ['the first']],
106 [0, 0, 3, ['with a span.']]]],
107 [[[0, 0, 5, ['Two body']],
108 [0, 0, 5, ['rows,']]],
109 [[0, 1, 6, ['the second with a span.']]]])],
111 ============ =============
112 A table with two head/body
113 ============ =============
115 ============ =============
117 ============ =============
119 'TableMarkupError: Multiple head/body row separators in table '
120 '(at line offset 2 and 4); only one allowed.'],
122 ============ ============
123 ============ ============
130 # ============== ==========
131 # Table with row separators
132 # ============== ==========
134 # -------------- ----------
136 # -------------- ----------
138 # -------------- ----------
140 # ============== ==========
146 if __name__
== '__main__':
148 unittest
.main(defaultTest
='suite')