python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_code_module.cpython-311.opt-1.pyc

e#dZddlZddlZddlmZddlmZddlmZddlm	Z	e	j
dZGdd	ejZ
ed
krejdSdS)zCTest InteractiveConsole and InteractiveInterpreter from code moduleN)dedent)	ExitStack)mock)
import_helpercodecPeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dS)
TestInteractiveConsolecjt|_|dS)N)rInteractiveConsoleconsolemock_sysselfs I/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_code_module.pysetUpzTestInteractiveConsole.setUps&..00

cdt}||j|t	jdd|_|t	jd|_|t	jd|_t	jdtj
tj
}|||_tjtj
ur|jj
|j_|j`|j`dS)	z.Mock system environment for InteractiveConsolez
code.inputT)createzcode.sys.stdoutzcode.sys.stderrzcode.sys)wrapsspecN)r
addCleanupclose
enter_contextrpatchinfuncstdoutstderrrsyssysmod
excepthook__excepthook__ps1ps2)rstackprepatchs   rr
zTestInteractiveConsole.mock_syss$$$))$*\15+7+7+788))$*5F*G*GHH))$*5F*G*GHH:jtxHHH))(33>S///%)[%?DK"KOKOOOrc4td|j_|j||jjdd|j_|j||jjddS)NFinishedz>>> z	custom1> )EOFErrorrside_effectrinteractassertEqualrr"rs rtest_ps1zTestInteractiveConsole.test_ps1#"*:"6"6&111%+66666rc4td|j_|j||jjdd|j_|j||jjddS)Nr'z... z	custom2> )	r(rr)rr*r+rr#r"rs rtest_ps2zTestInteractiveConsole.test_ps2+r-rcddtdg|j_|jt|jjD]"}dd|dvrdS#td)Nz	'antioch'r'antiochzno console stdout)
r(rr)rr*listrmethod_callsjoinAssertionErrorrcalls  rtest_console_stderrz*TestInteractiveConsole.test_console_stderr3s#.HZ4H4H"I122	6	6DBGGDG,,,,-!!4555rcdtdg|j_|j|jjD]"}dd|dvrdS#td)N	undefinedr'	NameErrorr1r3zNo syntax error from console)	r(rr)rr*rr5r6r7r8s  rtest_syntax_errorz(TestInteractiveConsole.test_syntax_error<s{#.0D0D"EK,	A	ADbggd1g..../!!?@@@rcdtdg|j_tj}||j_|j|	|j
dS)Nzraise ValueError('')r')r(rr)rMockrr rr*
assertTruecalled)rhooks  rtest_sysexcepthookz)TestInteractiveConsole.test_sysexcepthookEs_#9$,Z$8$8#:y{{!%$$$$$rctd|j_|jd|t
|jjd|jjd}||ddig|j	td|j_|jd|t
|jjd	dS)
Nr'Foobannerrwrite)zFoo
r1
r(rr)rr*r+lenrr5
reset_mock)rbanner_calls  rtest_bannerz"TestInteractiveConsole.test_bannerMs"*:"6"6U+++T[566:::k.q1w
B&?@@@	
   "*:"6"6R(((T[566:::::rcvtd|j_|jd|t
|jjd|jjd}d}||d|fig|j	td|j_|jdd|t
|jjd|j	d	}td|j_|jd||t
|jjd|jjd}|d
z}||d|figdS)Nr'r1rGrKr3z"now exiting InteractiveConsole...
rJ)rHexitmsgu	bye! ζж
rL)rerr_msgexpectedmessages    r
test_exit_msgz$TestInteractiveConsole.test_exit_msg[s"*:"6"6R(((T[566:::+*1-87XK"<===	
   "*:"6"6R444T[566:::	
   K	#+:"6"6R999T[566:::+*1-T>7XK"<=====rc
dtdg|j_|jdd|jjD}td}|	||dS)Nz(raise ValueError('') from AttributeErrorr'r1c3LK|]}d|dV dSr1r3Nr6.0r9s  r	<genexpr>z7TestInteractiveConsole.test_cause_tb.<locals>.<genexpr>{2OOda))OOOOOOrz
        AttributeError

        The above exception was the direct cause of the following exception:

        Traceback (most recent call last):
          File "<console>", line 1, in <module>
        ValueError
        
r(rr)rr*r6rr5rassertInroutputrUs   r
test_cause_tbz$TestInteractiveConsole.test_cause_tbws#M$,Z$8$8#:OOdk6NOOOOO

	


h'''''rc
dtdg|j_|jdd|jjD}td}|	||dS)Nztry: ham
except: eggs
r'r1c3LK|]}d|dV dSrZr[r\s  rr^z9TestInteractiveConsole.test_context_tb.<locals>.<genexpr>r_rah
        Traceback (most recent call last):
          File "<console>", line 1, in <module>
        NameError: name 'ham' is not defined

        During handling of the above exception, another exception occurred:

        Traceback (most recent call last):
          File "<console>", line 2, in <module>
        NameError: name 'eggs' is not defined
        r`rbs   rtest_context_tbz&TestInteractiveConsole.test_context_tbs#=$,Z$8$8#:OOdk6NOOOOO




	


h'''''rN)__name__
__module____qualname__rr
r,r/r:r>rDrPrWrdrgrrr	r	
s 777777666AAA%%%;;;>>>8((( (((((rr	__main__)__doc__runittesttextwrapr
contextlibrrtest.supportr
import_modulerTestCaser	rhmainrkrr<module>rusEE



      &&&&&&#}"6**J(J(J(J(J(X.J(J(J(ZzHMOOOOOr