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
20 from docutils
._compat
import b
23 s
= DocutilsTestSupport
.ParserTestSuite()
24 s
.generateTests(totest
)
29 totest
['double-width'] = [
38 <document source="test data">
39 <section ids="id1" names="タイトル1">
42 <section ids="id2" names="タイトル2">
45 <system_message level="2" line="5" source="test data" type="WARNING">
47 Title underline too short.
48 <literal_block xml:space="preserve">
53 +-----------------------+
56 +-----------------------+
59 +-----------------------+
62 <document source="test data">
65 <colspec colwidth="23">
69 <bullet_list bullet="*">
83 Complex spanning pattern (no edge knows all rows/cols):
85 +--------+---------------------+
87 | 西セル +--------------+------+
89 +--------+--------------+ 南東 |
91 +-----------------------+------+
94 <document source="test data">
96 Complex spanning pattern (no edge knows all rows/cols):
99 <colspec colwidth="8">
100 <colspec colwidth="14">
101 <colspec colwidth="6">
135 <document source="test data">
138 <colspec colwidth="9">
139 <colspec colwidth="9">
148 <system_message level="3" line="6" source="test data" type="ERROR">
151 Text in column margin in table line 2.
152 <literal_block xml:space="preserve">
158 Some ambiguous-width characters:
160 = ===================================
163 « left pointing guillemet
164 » right pointing guillemet
167 ‘ single turned comma quotation mark
168 ’ single comma quotation mark
169 ‚ low single comma quotation mark
170 “ double turned comma quotation mark
171 ” double comma quotation mark
172 „ low double comma quotation mark
177 ⇔ left-right double arrow
178 = ===================================
181 <document source="test data">
183 Some ambiguous-width characters:
186 <colspec colwidth="1">
187 <colspec colwidth="35">
209 left pointing guillemet
216 right pointing guillemet
237 single turned comma quotation mark
244 single comma quotation mark
251 low single comma quotation mark
258 double turned comma quotation mark
265 double comma quotation mark
272 low double comma quotation mark
307 left-right double arrow
308 """).decode('raw_unicode_escape')],
318 if __name__
== '__main__':
320 unittest
.main(defaultTest
='suite')