aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/wcwidth/py3/tests/test_core.py
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-11-28 10:22:06 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-11-28 11:32:21 +0300
commite47e2d7f764c4433fc3ccb00c5875361175988f7 (patch)
tree7fbd42979a8996707562949ec1a98eab234a090d /contrib/python/wcwidth/py3/tests/test_core.py
parent13de5f3d2da60e60f030c6cde3e389b07a9192d3 (diff)
downloadydb-e47e2d7f764c4433fc3ccb00c5875361175988f7.tar.gz
Update contrib/python/wcwidth/py3 to 0.2.10
Diffstat (limited to 'contrib/python/wcwidth/py3/tests/test_core.py')
-rw-r--r--contrib/python/wcwidth/py3/tests/test_core.py103
1 files changed, 0 insertions, 103 deletions
diff --git a/contrib/python/wcwidth/py3/tests/test_core.py b/contrib/python/wcwidth/py3/tests/test_core.py
index f0396ea968..d2776cd992 100644
--- a/contrib/python/wcwidth/py3/tests/test_core.py
+++ b/contrib/python/wcwidth/py3/tests/test_core.py
@@ -10,23 +10,12 @@ except ImportError:
# local
import wcwidth
-# 3rd party
-import pytest
-
-# some tests cannot be done on some builds of python, where the internal
-# unicode structure is limited to 0x10000 for memory conservation,
-# "ValueError: unichr() arg not in range(0x10000) (narrow Python build)"
try:
# python 2
_ = unichr
except NameError:
# python 3
unichr = chr
-try:
- unichr(0x2fffe)
- NARROW_ONLY = False
-except ValueError:
- NARROW_ONLY = True
def test_package_version():
@@ -254,98 +243,6 @@ def test_kr_jamo_filler():
assert length_phrase == expect_length_phrase
-@pytest.mark.skipif(NARROW_ONLY, reason="Test cannot verify on python 'narrow' builds")
-def emoji_zwj_sequence():
- u"""
- Emoji zwj sequence of four codepoints is just 2 cells.
- """
- phrase = (u"\U0001f469" # Base, Category So, East Asian Width property 'W' -- WOMAN
- u"\U0001f3fb" # Modifier, Category Sk, East Asian Width property 'W' -- EMOJI MODIFIER FITZPATRICK TYPE-1-2
- u"\u200d" # Joiner, Category Cf, East Asian Width property 'N' -- ZERO WIDTH JOINER
- u"\U0001f4bb") # Fused, Category So, East Asian Width peroperty 'W' -- PERSONAL COMPUTER
- # This test adapted from https://www.unicode.org/L2/L2023/23107-terminal-suppt.pdf
- expect_length_each = (2, 0, 0, 2)
- expect_length_phrase = 2
-
- # exercise,
- length_each = tuple(map(wcwidth.wcwidth, phrase))
- length_phrase = wcwidth.wcswidth(phrase)
-
- # verify.
- assert length_each == expect_length_each
- assert length_phrase == expect_length_phrase
-
-
-@pytest.mark.skipif(NARROW_ONLY, reason="Test cannot verify on python 'narrow' builds")
-def test_unfinished_zwj_sequence():
- u"""
- Ensure index-out-of-bounds does not occur for zero-width joiner without any following character
- """
- phrase = (u"\U0001f469" # Base, Category So, East Asian Width property 'W' -- WOMAN
- u"\U0001f3fb" # Modifier, Category Sk, East Asian Width property 'W' -- EMOJI MODIFIER FITZPATRICK TYPE-1-2
- u"\u200d") # Joiner, Category Cf, East Asian Width property 'N' -- ZERO WIDTH JOINER
- expect_length_each = (2, 0, 0)
- expect_length_phrase = 2
-
- # exercise,
- length_each = tuple(map(wcwidth.wcwidth, phrase))
- length_phrase = wcwidth.wcswidth(phrase)
-
- # verify.
- assert length_each == expect_length_each
- assert length_phrase == expect_length_phrase
-
-
-@pytest.mark.skipif(NARROW_ONLY, reason="Test cannot verify on python 'narrow' builds")
-def test_non_recommended_zwj_sequence():
- """
- Verify ZWJ is measured as though successful with characters that cannot be joined, wcwidth does not verify
- """
- phrase = (u"\U0001f469" # Base, Category So, East Asian Width property 'W' -- WOMAN
- u"\U0001f3fb" # Modifier, Category Sk, East Asian Width property 'W' -- EMOJI MODIFIER FITZPATRICK TYPE-1-2
- u"\u200d") # Joiner, Category Cf, East Asian Width property 'N' -- ZERO WIDTH JOINER
- expect_length_each = (2, 0, 0)
- expect_length_phrase = 2
-
- # exercise,
- length_each = tuple(map(wcwidth.wcwidth, phrase))
- length_phrase = wcwidth.wcswidth(phrase)
-
- # verify.
- assert length_each == expect_length_each
- assert length_phrase == expect_length_phrase
-
-
-@pytest.mark.skipif(NARROW_ONLY, reason="Test cannot verify on python 'narrow' builds")
-def test_longer_emoji_zwj_sequence():
- """
- A much longer emoji ZWJ sequence of 10 total codepoints is just 2 cells!
- """
- # 'Category Code', 'East Asian Width property' -- 'description'
- phrase = (u"\U0001F9D1" # 'So', 'W' -- ADULT
- u"\U0001F3FB" # 'Sk', 'W' -- EMOJI MODIFIER FITZPATRICK TYPE-1-2
- u"\u200d" # 'Cf', 'N' -- ZERO WIDTH JOINER
- u"\u2764" # 'So', 'N' -- HEAVY BLACK HEART
- u"\uFE0F" # 'Mn', 'A' -- VARIATION SELECTOR-16
- u"\u200d" # 'Cf', 'N' -- ZERO WIDTH JOINER
- u"\U0001F48B" # 'So', 'W' -- KISS MARK
- u"\u200d" # 'Cf', 'N' -- ZERO WIDTH JOINER
- u"\U0001F9D1" # 'So', 'W' -- ADULT
- u"\U0001F3FD") # 'Sk', 'W' -- EMOJI MODIFIER FITZPATRICK TYPE-4
-
- # This test adapted from https://www.unicode.org/L2/L2023/23107-terminal-suppt.pdf
- expect_length_each = (2, 0, 0, 1, 0, 0, 2, 0, 2, 0)
- expect_length_phrase = 2
-
- # exercise,
- length_each = tuple(map(wcwidth.wcwidth, phrase))
- length_phrase = wcwidth.wcswidth(phrase)
-
- # verify.
- assert length_each == expect_length_each
- assert length_phrase == expect_length_phrase
-
-
def test_devanagari_script():
"""
Attempt to test the measurement width of Devanagari script.