python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_readline.cpython-311.opt-2.pyc

e	3	ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZe	dZeedr
d	ejvZnejod
ejvZdZejeedd
GddejZGddejZedkrejdSdS)N)verbose)
import_module)unlinktemp_dirTESTFN)run_pty)assert_python_okreadline_READLINE_LIBRARY_VERSIONzEditLine wrapperlibeditcFtrttdr:tdtjdtdtjdttdrtdtjtdtdSdS)N_READLINE_VERSIONzreadline version: z#xzreadline runtime version: rzreadline library version: zuse libedit emulation? )rhasattrr
printr_READLINE_RUNTIME_VERSIONris_editlineF/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_readline.pysetUpModulers78011	XFx'AFFFGGGVx/QVVVWWW8899	WUx/QUUVVV
5556666677r
clear_historyzXThe history update test cannot be run because the clear_history method is not available.cdeZdZ	dZejeedddZdZ	dS)TestHistoryManipulationcttdtd|tdd|tdd|tddtdd|tdd|tdd|tdd|tdtd|tdd|tdd|tddS)N
first linesecond linerz
replaced line)r
radd_historyassertEqualget_history_itemreplace_history_itemget_current_history_lengthremove_history_item)selfs rtestHistoryUpdatesz*TestHistoryManipulation.testHistoryUpdates/s   \***]+++22155t<<<22155|DDD22155}EEE%%a99922155t<<<22155GGG22155}EEE<<>>BBB$$Q'''22155t<<<22155}EEE<<>>BBBBBrappend_history_filezappend_history not availablec$tjd}||j}|t
|ttdtdt	|t|
tdt||
td|
t
dd|
t
ddtd|tt||
td|
t
dd|
t
dd|
t
ddtj|	td|tj|n#t $rYnwxYwt	|dS)	NF)deleterrrrr)tempfileNamedTemporaryFileclosename
addCleanuprr
rrwrite_history_filer r#read_history_filer!r'osFileNotFoundError)r%hfile	hfilenames   rtest_write_read_appendz.TestHistoryManipulation.test_write_read_appendFs+5999



J		***	   \***]+++##I...   <<>>BBB""9---<<>>BBB22155|DDD22155}EEE	$$Q	222   ""9---<<>>BBB22155|DDD22155}EEE22155}EEE		)	!((I666
Ii    !			D		##I.....s6K&&
K32K3cDt	tdn<#t$r/}|dt|zYd}~nd}~wwxYwtdtddtt|	tjtttttrtd|tdd|tdddS)Nu	entrée 1 Locale cannot encode test data: u	entrée 2ru
entrée 22dummyr)r
rrUnicodeEncodeErrorskipTestformatr"r0rr/r2remover1rr r!)r%errs  rtest_nonascii_historyz-TestHistoryManipulation.test_nonascii_historytsg   	L  ----!	L	L	LMM<vc{{JKKKKKKKK	L[)))%%a666##F+++	6***   ""6***	*
  )))22155{CCC22155|DDDDDs6
A/%A**A/N)
__name__
__module____qualname__r&unittest
skipUnlessrr
r6r?rrrrr%sCCC.X+@AA799*/*/99*/XEEEEErrceZdZejejdkoeddZdZ	dZ
dZdZdZ
ejejd	kd
ejeddZd
S)TestReadlineiz%not supported in this library versionc^tddd\}}}||ddS)Nz-czimport readlinezxterm-256color)TERMr)r	r )r%rcstdoutstderrs    r	test_initzTestReadline.test_initsF.d4E3CEEEFF%%%%%rzvimport readline
readline.set_auto_history({})
input()
print("History length:", readline.get_current_history_length())
ct|jd}|d|dS)NTsHistory length: 1rauto_history_scriptr<assertInr%outputs  rtest_auto_history_enabledz&TestReadline.test_auto_history_enableds=188>>??	


*F33333rct|jd}|d|dS)NFsHistory length: 0rNrQs  rtest_auto_history_disabledz'TestReadline.test_auto_history_disableds=188??@@	


*F33333rc|tjd}t|d}|d|dS)Na
            import readline
            def complete(text, state):
                if state == 0 and text == "$":
                    return "$complete"
                return None
            if "libedit" in getattr(readline, "__doc__", ""):
                readline.parse_and_bind(r'bind "\t" rl_complete')
            else:
                readline.parse_and_bind(r'"\t": complete')
            readline.set_completer_delims(" \t\n")
            readline.set_completer(complete)
            print(input())
        s$	
)inputs	$complete)textwrapdedentrrP)r%scriptrRs   rtest_set_complete_delimsz%TestReadline.test_set_complete_delimssF
"



x000

lF+++++rcLtjtjd}|dvr|d|	tdn<#t$r/}|dt|zYd}~nd}~wwxYwd}d}|dtdzz
}|d	z
}|d
z
}|dz
}t||}|
d||
d
|tjdksts|
d|tsAttdr,|
d||
d|d}|
d|zdz||
d|z|dS)N)CPOSIXzthe LC_CTYPE locale is uëïr8a*import readline

is_editline = readline.__doc__ and "libedit" in readline.__doc__
inserted = "[\xEFnserted]"
macro = "|t\xEB[after]"
set_pre_input_hook = getattr(readline, "set_pre_input_hook", None)
if is_editline or not set_pre_input_hook:
    # The insert_line() call via pre_input_hook() does nothing with Editline,
    # so include the extra text that would have been inserted here
    macro = inserted + macro

if is_editline:
    readline.parse_and_bind(r'bind ^B ed-prev-char')
    readline.parse_and_bind(r'bind "\t" rl_complete')
    readline.parse_and_bind(r'bind -s ^A "{}"'.format(macro))
else:
    readline.parse_and_bind(r'Control-b: backward-char')
    readline.parse_and_bind(r'"\t": complete')
    readline.parse_and_bind(r'set disable-completion off')
    readline.parse_and_bind(r'set show-all-if-ambiguous off')
    readline.parse_and_bind(r'set show-all-if-unmodified off')
    readline.parse_and_bind(r'Control-a: "{}"'.format(macro))

def pre_input_hook():
    readline.insert_text(inserted)
    readline.redisplay()
if set_pre_input_hook:
    set_pre_input_hook(pre_input_hook)

def completer(text, state):
    if text == "t\xEB":
        if state == 0:
            print("text", ascii(text))
            print("line", ascii(readline.get_line_buffer()))
            print("indexes", readline.get_begidx(), readline.get_endidx())
            return "t\xEBnt"
        if state == 1:
            return "t\xEBxt"
    if text == "t\xEBx" and state == 0:
        return "t\xEBxt"
    return None
readline.set_completer(completer)

def display(substitution, matches, longest_match_length):
    print("substitution", ascii(substitution))
    print("matches", ascii(matches))
readline.set_completion_display_matches_hook(display)

print("result", ascii(input()))
print("history", ascii(readline.get_history_item(1)))
z[after]s		sx	
stext 't\xeb'
s#line '[\xefnserted]|t\xeb[after]'
darwinsindexes 11 13
set_pre_input_hookssubstitution 't\xeb'
s matches ['t\xebnt', 't\xebxt']
s'[\xefnserted]|t\xebxt[after]'sresult s
shistory )locale	setlocaleLC_CTYPEr;r
rr:r<lenrrPsysplatformrr)r%locr>rZrWrRexpecteds       r
test_nonasciizTestReadline.test_nonasciisv55.  
MM;C;;<<<	L  ,,,,!	L	L	LMM<vc{{JKKKKKKKK	L2h
3y>>))


''

*F333

@&III<8##;#MM.777	Kwx1EFF	KMM6???MMA6JJJ5

j8+g5v>>>	


kH,f55555sA
B"%BBiz3this readline version does not support history-sizez-editline history size configuration is brokenc	d}t5}tj|d}t	|d5}|d|zdddn#1swxYwYtj|d}t	|d5}ddt
|dzD}||dddn#1swxYwYd	}ttj}||d
<||d<t|d|
t	|d5}|
}	dddn#1swxYwY|t|	|||	d
dddddS#1swxYwYdS)N
inputrcwbsset history-size %d
historyrc3 K|]	}d|zV
dS)sitem %d
Nr).0is  r	<genexpr>z1TestReadline.test_history_size.<locals>.<genexpr>*sC B B$%!-q 0 B B B B B Brrz
import os
import readline

history_file = os.environ["HISTORY_FILE"]
readline.read_history_file(history_file)
input()
readline.write_history_file(history_file)
INPUTRCHISTORY_FILEslast input
)rWenvrbs
last input)rr2pathjoinopenwriterangedictenvironr	readlinesr rgstrip)
r%history_sizetest_dirrofhistory_filedatarZrxliness
          rtest_history_sizezTestReadline.test_history_sizes

ZZ	?8gll8Y77Ggt$$
A0<?@@@
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A7<<)<<LlD))
Qxx B B).|a/?)@)@ B B BBB


	














Frz""C$C	N".CF/s;;;;lD))
&Q


&
&
&
&
&
&
&
&
&
&
&
&
&
&
&SZZ666U2Y__..
>>>?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?s1GA'G'A+	+G.A+	/3G"AC3'G3C7	7G:C7	;A
GE&G&E*	*G-E*	.AGGGN)r@rArBrCskipIfr
rrrLrOrSrUr[rlrrrrrFrFsX_X/&8L_<>>&&>>&444444,,,&[6[6[6DX_X/%7JLLX_[DFF!?!?FFLL!?!?!?rrF__main__)rdr2rhr+rXrCtest.supportrtest.support.import_helperrtest.support.os_helperrrrtest.support.pty_helperrtest.support.script_helperr	r
rrr__doc__rrDTestCaserrFr@mainrrr<module>rs


				



      444444;;;;;;;;;;++++++777777=$$
78011G%)KKKK#E	X5E(EK	7	7	7WWX77>??]E]E]E]E]Ex0]E]E??]E@y?y?y?y?y?8$y?y?y?xzHMOOOOOr