python (3.12.0)
Αe8 d Z ddlmZ ddlmZ ddlZddlZddlZddlZddl Z ddl
Z
ddlZddlm
Z
ddlmZ ddlmZmZmZ ddlmZ ed Z eed
rdej0 v Znej xr dej v Zd
Z ej6 eed d G d dej8 Z G d dej8 ZddZe dk( r ejB yy)z:
Very minimal unittests for parts of the readline module.
) ExitStack)EION)verbose)
import_module)unlinktemp_dirTESTFN)assert_python_okreadline_READLINE_LIBRARY_VERSIONzEditLine wrapperlibeditc " t rt t d r:t dt j d t dt j
d t t d rt dt j t dt y y )N_READLINE_VERSIONzreadline version: z#xzreadline runtime version: r zreadline library version: zuse libedit emulation? )r hasattrr printr _READLINE_RUNTIME_VERSIONr is_editline F/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_readline.pysetUpModuler s| 801&x'A'A"&EFG.x/Q/QRT.UVW889.x/Q/Q.TUV
'}56 r
clear_historyzXThe history update test cannot be run because the clear_history method is not available.c \ e Zd ZdZd Z ej eed d d Z d Z
y)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 j t j d t j d | j t j d d | j t j d d | j t j d d t j dd | j t j d d | j t j d d | j t j d d | j t j
d t j d | j t j d d | j t j d d | j t j
d y )N
first linesecond liner z
replaced line)r r add_historyassertEqualget_history_itemreplace_history_itemget_current_history_lengthremove_history_item)selfs r testHistoryUpdatesz*TestHistoryManipulation.testHistoryUpdates1 sR \*]+2215t<2215|D2215}E%%a92215t<2215G2215}E<<>B$$Q'2215t<2215}E<<>Br append_history_filezappend_history not availablec t j d }|j |j }| j t
| t j t j d t j d t j | t j | j t j d t j | | j t j d | j t j d d | j t j d d t j d| t j t j | | j t j d | j t j d d | j t j d d | j t j d d t j
| t j d| t j
| t j | y # t $ r Y !w xY w) NF)deleter r r r r )tempfileNamedTemporaryFileclosename
addCleanupr r r r write_history_filer! r$ read_history_filer"