Add a test for unicode regional indicator widths

This commit is contained in:
Kovid Goyal 2018-08-04 10:56:35 +05:30
parent 000c1cf306
commit 5fa5bf8142
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -338,6 +338,9 @@ class TestDataTypes(BaseTest):
self.ae(tuple(map(w, 'a1\0コニチ ✔')), (1, 1, 0, 2, 2, 2, 1, 1))
self.ae(wcswidth('\u2716\u2716\ufe0f\U0001f337'), 5)
self.ae(wcswidth('\033a\033[2mb'), 2)
# Regional indicator symbols (unicode flags) are defined as having
# Emoji_Presentation so must have width 2
self.ae(tuple(map(w, '\U0001f1ee\U0001f1f3')), (2, 2))
tpl = truncate_point_for_length
self.ae(tpl('abc', 4), 3)
self.ae(tpl('abc', 2), 2)