← Back
Editing: test_completer.cpython-311.pyc
� �@�c� � �0 � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZ ddlm Z ddlmZmZ ddlmZ dd lmZ dd lmZmZmZmZ d� Zd� Zed � � � Zd� Zd� Zd� Z G d� d� � Z! G d� d� � Z" G d� dej# � � Z$dS )z/Tests for the IPython tab-completion machinery.� N)�contextmanager)�Config)�get_ipython)� completer)�TemporaryDirectory�TemporaryWorkingDirectory)�complete_object)� decorators)� Completion�provisionalcompleter�match_dict_keys�_deduplicate_completionsc �, �� ddl �ddl} g }t dd� � D ]K} | � t |� � � � n# t $ r Y �2w xY w|� |� � �L�fd�}t ||� � � � }g }g }d\ }}|D ]p\ } } |� | | z � � |� | |z t |� � t | � � t | |z dz dz � � � d�f� � | | }}�qt |� � d S ) z� utility to recompute the largest unicode range without any characters use to recompute the gap in the global _UNICODE_RANGES of completer.py r N� c 3 � �K � �� t | � � d� � � D ]2\ }}t |� � }|d d |d d fV � �3d S )Nc �$ � | d | d z S )N� r � )�pairs �C/usr/lib/python3/dist-packages/IPython/core/tests/test_completer.py�<lambda>z:recompute_unicode_ranges.<locals>.ranges.<locals>.<lambda>2 s � ��a��4�PQ�7�AR� � r r ���)�groupby� enumerate�list)�i�a�b� itertoolss �r �rangesz(recompute_unicode_ranges.<locals>.ranges1 sm �� � � ��%�%�i��l�l�4R�4R�S�S� $� $�D�A�q��Q���A��A�$�q�'�1�R�5��8�#�#�#�#�#� $� $r )r r i� �d �%r )r �unicodedata�range�name�chr� ValueError�appendr �hex�round�sorted)r$ �valid�cr! �rg�lens�gap_lens�pstart�pstop�start�stopr s @r �recompute_unicode_rangesr6 ! se �� � ���������E� �1�\� "� "� � �� ����S��V�V�$�$�$�$��� � � ��H� ���� ���Q�����$� $� $� $� $� �f�f�U�m�m� � �B� �D��H��M�F�E�� $� $���t����D��J�����������E� � �C��J�J�5�%�RW�-�Y`�I`�ad�Id�Ce�Ce�@h�@h�@h�i�j�j�j��t�����(���B��s �"A� A�Ac �2 � ddl m} m} | dg� � } | |� � }t |� � }t |� � }d}||k s|dk r+t � � \ }}} } d|� d| � d|� d | � d |� d| � d|� d �}||k s J |� � �|dk s J |� � �dS )zz Test that the ranges we test for unicode names give the same number of results than testing the full length. r )�_unicode_name_compute�_UNICODE_RANGES)r r Ni� z�_UNICODE_RANGES likely wrong and need updating. This is likely due to a new release of Python. We've find that the biggest gap in unicode characters has reduces in size to be z characters (z), from z, to zH. In completer.py likely update to _UNICODE_RANGES = [(32, z), (zS, 0xe01f0)] And update the assertion below to use len_exp <= z i8 )�IPython.core.completerr8 r9 �lenr6 )r8 r9 � expected_list�test�len_exp�len_test�message�sizer4 r5 �prcts r �test_unicode_rangerC C s6 � � O�N�N�N�N�N�N�N�)�)�=�/�:�:�M� � ��1�1�D��-� � �G��4�y�y�H� �G��(���g��.�.�":�"<�"<���e�T�4� �9=� � � � � � � � � %)� � � &+� � � 15� � � � � � �� �h�������� �f����g�����r c # � K � t � � } | j j } d| j _ d V � || j _ d S # || j _ w xY w)NT)r � Completer�greedy)�ip�greedy_originals r �greedy_completionrI e sW � � � � ���B��l�)�O�.�"���� ����-�������o����-�-�-�-s �<