Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_readline.cpython-311.pyc |
�
�Ke�8 � � � d Z ddlmZ ddlmZ ddlZddlZddlZddlZddl Z ddl
Z
ddlZddlm
Z
ddlmZ ddlmZmZmZ ddlmZ ed � � Z eed
� � r
dej v Znej odej v Zd
� Z ej eed� � d� � G d� dej � � � � Z G d� dej � � Zdd�Ze dk r ej! � � dS dS )z:
Very minimal unittests for parts of the readline module.
� )� ExitStack)�EION)�verbose)�
import_module)�unlink�temp_dir�TESTFN)�assert_python_ok�readline�_READLINE_LIBRARY_VERSIONzEditLine wrapper�libeditc �F � t r�t t d� � r:t dt j d��� � t dt j d��� � t t d� � rt dt j ��� � t dt � �� � d S d S )N�_READLINE_VERSIONzreadline version: z#xzreadline runtime version: r zreadline library version: zuse libedit emulation? )r �hasattrr �printr �_READLINE_RUNTIME_VERSIONr �is_editline� � �</usr/local/apps/python3/lib/python3.11/test/test_readline.py�setUpModuler s� � �� 7� �8�0�1�1� X��F�x�'A�F�F�F�G�G�G��V�x�/Q�V�V�V�W�W�W��8�8�9�9� W��U�x�/Q�U�U�V�V�V�
�5��5�5�6�6�6�6�6�7� 7r �
clear_historyzXThe history update test cannot be run because the clear_history method is not available.c �f � e Zd ZdZd� Z ej eed� � d� � d� � � Z d� Z
dS )�TestHistoryManipulationz�
These tests were added to check that the libedit emulation on OSX and the
"real" readline have the same interface for history manipulation. That's
why the tests cover only a small subset of the interface.
c � � t � � � t � d� � t � d� � | � t � d� � d � � | � t � d� � d� � | � t � d� � d� � t � dd� � | � t � d� � d � � | � t � d� � d� � | � t � d� � d� � | � t � � � d� � t � d� � | � t � d� � d � � | � t � d� � d� � | � t � � � d� � d S )N�
first line�second liner � � z
replaced line)r r �add_history�assertEqual�get_history_item�replace_history_item�get_current_history_length�remove_history_item)�selfs r �testHistoryUpdatesz*TestHistoryManipulation.testHistoryUpdates1 s� � ���� � � ����\�*�*�*����]�+�+�+�����2�2�1�5�5�t�<�<�<�����2�2�1�5�5�|�D�D�D�����2�2�1�5�5�}�E�E�E��%�%�a��9�9�9�����2�2�1�5�5�t�<�<�<�����2�2�1�5�5��G�G�G�����2�2�1�5�5�}�E�E�E�����<�<�>�>��B�B�B��$�$�Q�'�'�'�����2�2�1�5�5�t�<�<�<�����2�2�1�5�5�}�E�E�E�����<�<�>�>��B�B�B�B�Br �append_history_filezappend_history not availablec �$ � t j d�� � }|� � � |j }| � t
|� � t � � � t � d� � t � d� � t � |� � t � � � | �
t � � � d� � t � |� � | �
t � � � d� � | �
t �
d� � d� � | �
t �
d� � d� � t � d|� � t � � � t � |� � | �
t � � � d� � | �
t �
d� � d� � | �
t �
d� � d� � | �
t �
d� � d� � t j |� � t � d|� � t j |� � n# t $ r Y nw xY wt � |� � d S ) NF)�deleter r r r r � )�tempfile�NamedTemporaryFile�close�name�
addCleanupr r r r �write_history_filer! r$ �read_history_filer"