Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: update imports and make run slow test only on latest Python #14046

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions IPython/core/tests/test_completer.py
Expand Up @@ -6,9 +6,11 @@

import os
import pytest
import itertools
import sys
import textwrap
import unittest
import unicodedata

from contextlib import contextmanager

Expand All @@ -28,6 +30,8 @@
completion_matcher,
SimpleCompletion,
CompletionContext,
_unicode_name_compute,
_UNICODE_RANGES,
)

# -----------------------------------------------------------------------------
Expand All @@ -40,8 +44,6 @@ def recompute_unicode_ranges():

use to recompute the gap in the global _UNICODE_RANGES of completer.py
"""
import itertools
import unicodedata
valid = []
for c in range(0,0x10FFFF + 1):
try:
Expand All @@ -67,13 +69,15 @@ def ranges(i):
return sorted(gap_lens)[-1]



@pytest.mark.skipif(
sys.version_info < (3, 11),
reason="this test is slow, and only need to run once on newer Python",
)
def test_unicode_range():
"""
Test that the ranges we test for unicode names give the same number of
results than testing the full length.
"""
from IPython.core.completer import _unicode_name_compute, _UNICODE_RANGES

expected_list = _unicode_name_compute([(0, 0x110000)])
test = _unicode_name_compute(_UNICODE_RANGES)
Expand Down