2
# -*- coding: utf-8 -*-
4
# Author: David Goodger
5
# Contact: goodger@python.org
6
# Revision: $Revision: 4152 $
7
# Date: $Date: 2005-12-08 00:46:30 +0100 (Thu, 08 Dec 2005) $
8
# Copyright: This module has been placed in the public domain.
11
Tests for East Asian text with double-width characters.
14
from __init__ import DocutilsTestSupport
18
east_asian_width = unicodedata.east_asian_width
19
except AttributeError:
20
east_asian_width = None
23
s = DocutilsTestSupport.ParserTestSuite()
24
s.generateTests(totest)
29
if not east_asian_width:
30
print ('test_east_asian_text.py tests skipped; '
31
'Python 2.4 or higher required.')
33
totest['double-width'] = [
42
<document source="test data">
43
<section ids="id1" names="タイトル1">
46
<section ids="id2" names="タイトル2">
49
<system_message level="2" line="5" source="test data" type="WARNING">
51
Title underline too short.
52
<literal_block xml:space="preserve">
57
+-----------------------+
60
+-----------------------+
63
+-----------------------+
66
<document source="test data">
69
<colspec colwidth="23">
73
<bullet_list bullet="*">
87
Complex spanning pattern (no edge knows all rows/cols):
89
+--------+---------------------+
91
| 西セル +--------------+------+
93
+--------+--------------+ 南東 |
95
+-----------------------+------+
98
<document source="test data">
100
Complex spanning pattern (no edge knows all rows/cols):
103
<colspec colwidth="8">
104
<colspec colwidth="14">
105
<colspec colwidth="6">
139
<document source="test data">
142
<colspec colwidth="9">
143
<colspec colwidth="9">
152
<system_message level="3" line="5" source="test data" type="ERROR">
155
Text in column margin at line offset 1.
156
<literal_block xml:space="preserve">
162
Some ambiguous-width characters:
164
= ===================================
167
« left pointing guillemet
168
» right pointing guillemet
171
‘ single turned comma quotation mark
172
’ single comma quotation mark
173
‚ low single comma quotation mark
174
“ double turned comma quotation mark
175
” double comma quotation mark
176
„ low double comma quotation mark
181
⇔ left-right double arrow
182
= ===================================
185
<document source="test data">
187
Some ambiguous-width characters:
190
<colspec colwidth="1">
191
<colspec colwidth="35">
213
left pointing guillemet
220
right pointing guillemet
241
single turned comma quotation mark
248
single comma quotation mark
255
low single comma quotation mark
262
double turned comma quotation mark
269
double comma quotation mark
276
low double comma quotation mark
311
left-right double arrow
322
if __name__ == '__main__':
324
unittest.main(defaultTest='suite')