python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_code_module.cpython-312.opt-2.pyc

͑e#	ddlZddlZddlmZddlmZddlmZddlmZejdZ
GddejZe
d	k(rejyy)
N)dedent)	ExitStack)mock)
import_helpercodecNeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
y)
TestInteractiveConsolecVtj|_|jy)N)rInteractiveConsoleconsolemock_sysselfs I/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_code_module.pysetUpzTestInteractiveConsole.setUps..0

c	t}|j|j|jt	j
dd|_|jt	j
d|_|jt	j
d|_t	j
dtjtj}|j||_tjtjur%|jj|j_|j`|j`y)Nz
code.inputT)createzcode.sys.stdoutzcode.sys.stderrzcode.sys)wrapsspec)r
addCleanupclose
enter_contextrpatchinfuncstdoutstderrrsyssysmod
excepthook__excepthook__ps1ps2)rstackprepatchs   rr
zTestInteractiveConsole.mock_syss8$))$**\15+78))$**5F*GH))$**5F*GH::jtxxH))(3>>S///%)[[%?%?DKK"KKOKKOrcZtd|j_|jj	|j|jjdd|j_|jj	|j|jjdy)NFinishedz>>> z	custom1> )EOFErrorrside_effectrinteractassertEqualrr"rs rtest_ps1zTestInteractiveConsole.test_ps1#n"*:"6&1%+6rcZtd|j_|jj	|j|jjdd|j_|jj	|j|jjdy)Nr'z... z	custom2> )	r(rr)rr*r+rr#r"rs rtest_ps2zTestInteractiveConsole.test_ps2+r-rcddtdg|j_|jj	t|jjD]}ddj|dvsytd)Nz	'antioch'r'antiochzno console stdout)
r(rr)rr*listrmethod_callsjoinAssertionErrorrcalls  rtest_console_stderrz*TestInteractiveConsole.test_console_stderr3sn#.HZ4H"I112	6DBGGDG,,	6!!455rcdtdg|j_|jj	|j
jD]}ddj|dvsytd)N	undefinedr'	NameErrorr1r3zNo syntax error from console)	r(rr)rr*rr5r6r7r8s  rtest_syntax_errorz(TestInteractiveConsole.test_syntax_error<si#.0D"EKK,,	ADbggd1g..	A!!?@@rcdtdg|j_tj}||j
_|jj|j|jy)Nzraise ValueError('')r')r(rr)rMockrr rr*
assertTruecalled)rhooks  rtest_sysexcepthookz)TestInteractiveConsole.test_sysexcepthookEsR#9$,Z$8#:yy{!%$rc(td|j_|jj	d|jt
|jjd|jjd}|j|ddig|jjtd|j_|jj	d|jt
|jjd	y)
Nr'Foobannerrwrite)zFoo
r1
r(rr)rr*r+lenrr5
reset_mock)rbanner_calls  rtest_bannerz"TestInteractiveConsole.test_bannerMs"*:"6U+T[[556:kk..q1w
B&?@	
 "*:"6R(T[[556:rctd|j_|jj	d|jt
|jjd|jjd}d}|j|d|fig|jjtd|j_|jj	dd|jt
|jjd|jjd	}td|j_|jj	d||jt
|jjd|jjd}|d
z}|j|d|figy)Nr'r1rGrKr3z"now exiting InteractiveConsole...
rJ)rHexitmsgu	bye! ζж
rL)rerr_msgexpectedmessages    r
test_exit_msgz$TestInteractiveConsole.test_exit_msg[sk"*:"6R(T[[556:++**1-87XK"<=	
 "*:"6R4T[[556:	
 K	#+:"6R9T[[556:++**1-T>7XK"<=rcdtdg|j_|jj	djd|jjD}td}|j||y)Nz(raise ValueError('') from AttributeErrorr'r1c3DK|]}dj|dywr1r3Nr6.0r9s  r	<genexpr>z7TestInteractiveConsole.test_cause_tb.<locals>.<genexpr>{Oda)O z
        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_tbwsh#M$,Z$8#:Odkk6N6NOO
	


h'rcdtdg|j_|jj	djd|jjD}td}|j||y)Nztry: ham
except: eggs
r'r1c3DK|]}dj|dywrZr[r\s  rr^z9TestInteractiveConsole.test_context_tb.<locals>.<genexpr>r_r`ah
        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
        rarcs   rtest_context_tbz&TestInteractiveConsole.test_context_tbsh#=$,Z$8#:Odkk6N6NOO


	


h'rN)__name__
__module____qualname__rr
r,r/r:r>rDrPrWrerhrrr	r	
s: 776A%;>8( (rr	__main__)runittesttextwrapr
contextlibrrtest.supportr
import_modulerTestCaser	rimainrlrr<module>rus]E
 &#}""6*J(X..J(ZzHMMOr