diff options
Diffstat (limited to 'contrib/python/wcwidth/py3/tests')
| -rw-r--r-- | contrib/python/wcwidth/py3/tests/test_core.py | 6 | ||||
| -rw-r--r-- | contrib/python/wcwidth/py3/tests/test_term_overrides.py | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/contrib/python/wcwidth/py3/tests/test_core.py b/contrib/python/wcwidth/py3/tests/test_core.py index 882b2eafc32..9d5007571b1 100644 --- a/contrib/python/wcwidth/py3/tests/test_core.py +++ b/contrib/python/wcwidth/py3/tests/test_core.py @@ -497,6 +497,12 @@ def test_zwj_at_end_of_string(): assert wcwidth.wcswidth('a\u200D') == 1 +def test_wcswidth_n_exceeds_length(): + """Verify wcswidth() with n > len(string) does not raise IndexError.""" + assert wcwidth.wcswidth('hello', n=999) == 5 + assert wcwidth.wcswidth('\u30B3\u30F3', n=999) == 4 + + def test_soft_hyphen(): # Test SOFT HYPHEN, category 'Cf' usually are zero-width, but most # implementations agree to draw it was '1' cell, visually diff --git a/contrib/python/wcwidth/py3/tests/test_term_overrides.py b/contrib/python/wcwidth/py3/tests/test_term_overrides.py index 75f88052ab6..0a7162ef800 100644 --- a/contrib/python/wcwidth/py3/tests/test_term_overrides.py +++ b/contrib/python/wcwidth/py3/tests/test_term_overrides.py @@ -418,6 +418,13 @@ def test_get_term_overrides_narrow_wider_still_empty(): assert overrides.narrow_wider == () [email protected]('func', [wcwidth.wcstwidth, wcwidth.width]) +def test_narrow_wider_width(func): + """Verify width() & wcstwidth() match result of narrow_wider overrides.""" + assert wcwidth.wcswidth('\u261d') == 1 + assert func('\u261d', term_program='kitty') == 2 + + @pytest.mark.parametrize('codepoint', [ '\u00ad', '\u0600', |
