2 # -*- coding: utf-8 -*-
5 # Author: David Goodger <goodger@python.org>
6 # Copyright: This module has been placed in the public domain.
9 Tests for East Asian text with double-width characters.
12 from __init__
import DocutilsTestSupport
16 east_asian_width
= unicodedata
.east_asian_width
17 except AttributeError:
18 east_asian_width
= None
21 s
= DocutilsTestSupport
.ParserTestSuite()
22 s
.generateTests(totest
)
27 totest
['double-width'] = [
36 <document source="test data">
37 <section ids="id1" names="タイトル1">
40 <section ids="id2" names="タイトル2">
43 <system_message level="2" line="5" source="test data" type="WARNING">
45 Title underline too short.
46 <literal_block xml:space="preserve">
51 +-----------------------+
54 +-----------------------+
57 +-----------------------+
60 <document source="test data">
63 <colspec colwidth="23">
67 <bullet_list bullet="*">
81 Complex spanning pattern (no edge knows all rows/cols):
83 +--------+---------------------+
85 | 西セル +--------------+------+
87 +--------+--------------+ 南東 |
89 +-----------------------+------+
92 <document source="test data">
94 Complex spanning pattern (no edge knows all rows/cols):
97 <colspec colwidth="8">
98 <colspec colwidth="14">
99 <colspec colwidth="6">
133 <document source="test data">
136 <colspec colwidth="9">
137 <colspec colwidth="9">
146 <system_message level="3" line="6" source="test data" type="ERROR">
149 Text in column margin in table line 2.
150 <literal_block xml:space="preserve">
156 Some ambiguous-width characters:
158 = ===================================
161 « left pointing guillemet
162 » right pointing guillemet
165 ‘ single turned comma quotation mark
166 ’ single comma quotation mark
167 ‚ low single comma quotation mark
168 “ double turned comma quotation mark
169 ” double comma quotation mark
170 „ low double comma quotation mark
175 ⇔ left-right double arrow
176 = ===================================
179 <document source="test data">
181 Some ambiguous-width characters:
184 <colspec colwidth="1">
185 <colspec colwidth="35">
207 left pointing guillemet
214 right pointing guillemet
235 single turned comma quotation mark
242 single comma quotation mark
249 low single comma quotation mark
256 double turned comma quotation mark
263 double comma quotation mark
270 low double comma quotation mark
305 left-right double arrow
306 """.decode('raw_unicode_escape')],
316 if __name__
== '__main__':
318 unittest
.main(defaultTest
='suite')