+
    Bi                     n   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIHt ^ RIHtHtHt ^ RIHtHtHtHtHtHtHtHt ]P6                  t. ROtRt]3R lt]^3R lt]P@                   ! R R	]PB                  4      4       t"R
 t#]$R8X  d   ]PJ                  ! 4        R# R# )    N)support)import_helperis_apple	os_helper)make_pkgmake_scriptmake_zip_pkgmake_zip_scriptassert_python_okassert_python_failurespawn_pythonkill_pythona  # Script may be run with optimisation enabled, so don't rely on assert
# statements being executed
def assertEqual(lhs, rhs):
    if lhs != rhs:
        raise AssertionError('%r != %r' % (lhs, rhs))
def assertIdentical(lhs, rhs):
    if lhs is not rhs:
        raise AssertionError('%r is not %r' % (lhs, rhs))
# Check basic code execution
result = ['Top level assignment']
def f():
    result.append('Lower level reference')
f()
assertEqual(result, ['Top level assignment', 'Lower level reference'])
# Check population of magic variables
assertEqual(__name__, '__main__')
from importlib.machinery import BuiltinImporter
_loader = __loader__ if __loader__ is BuiltinImporter else type(__loader__)
print('__loader__==%a' % _loader)
print('__file__==%a' % __file__)
print('__cached__==%a' % __cached__)
print('__package__==%r' % __package__)
# Check PEP 451 details
import os.path
if __package__ is not None:
    print('__main__ was located through the import system')
    assertIdentical(__spec__.loader, __loader__)
    expected_spec_name = os.path.splitext(os.path.basename(__file__))[0]
    if __package__:
        expected_spec_name = __package__ + "." + expected_spec_name
    assertEqual(__spec__.name, expected_spec_name)
    assertEqual(__spec__.parent, __package__)
    assertIdentical(__spec__.submodule_search_locations, None)
    assertEqual(__spec__.origin, __file__)
    if __spec__.cached is not None:
        assertEqual(__spec__.cached, __cached__)
# Check the sys module
import sys
assertIdentical(globals(), sys.modules[__name__].__dict__)
if __spec__ is not None:
    # XXX: We're not currently making __main__ available under its real name
    pass # assertIdentical(globals(), sys.modules[__spec__.name].__dict__)
from test import test_cmd_line_script
example_args_list = test_cmd_line_script.example_args
assertEqual(sys.argv[1:], example_args_list)
print('sys.argv[0]==%a' % sys.argv[0])
print('sys.path[0]==%a' % sys.path[0])
# Check the working directory
import os
print('cwd==%a' % os.getcwd())
c                 H    \        WV4      p\        P                  ! 4        V# N)r   	importlibinvalidate_caches)
script_dirscript_basenamesource	to_returns   &&& 0/usr/lib/python3.14/test/test_cmd_line_script.py_make_test_scriptr   O   s     J@I!    c                 J    \        WW#WE4      p\        P                  ! 4        V# r   )r	   r   r   )zip_dirzip_basenamepkg_namer   r   depthr   s   &&&&&& r   _make_test_zip_pkgr   T   s%    WH#,I!r   c                     a  ] tR t^\t o RCR ltRR/R ltRR/R ltR tR t]	P                  RDR l4       tRDR	 ltRDR
 ltR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R  t#R! t$R" t%R# t&R$ t']	P                  R% 4       t(R& t)R' t*R( t+R) t,R* t-R+ t.R, t/R- t0R. t1R/ t2R0 t3R1 t4R2 t5R3 t6R4 t7R5 t8R6 t9R7 t:R8 t;R9 t<R: t=]>P~                  ! ]@P                  P                  R;4      R<4      ]>P                  ! ]DP                  P                  R=4      ;'       d:    ]@P                  ! R>4      P                  ]@P                  ! R?4      P                  8H  R@4      RA 4       4       tIRBtJV tKR# )ECmdLineTestNc
                z   \         ^8  d'   \        RV,          4       \        \        V4      4       V P                  V^ 4       RV,          p
RV,          pRV,          pRV,          pRV,          pV	f   \        P
                  ! 4       p	RV	,          p\         ^8  d8   \        R	4       \        V4       \        V4       \        V4       \        V4       V P                  V
P                  R
4      V4       V P                  VP                  R
4      V4       V P                  VP                  R
4      V4       V P                  VP                  R
4      V4       \        P                  P                  '       g"   V P                  VP                  R
4      V4       V P                  VP                  R
4      V4       R# )   zOutput from test script %r:z__loader__==%az__file__==%az__package__==%rzsys.argv[0]==%azsys.path[0]==%aNzcwd==%azExpected output:utf-8)verboseprintreprassertEqualosgetcwdassertInencodesysflags	safe_path)selfscript_name	exit_codedataexpected_fileexpected_argv0expected_path0expected_packageexpected_loaderexpected_cwdprinted_loaderprinted_fileprinted_packageprinted_argv0printed_path0printed_cwds   &&&&&&&&&&      r   _check_outputCmdLineTest._check_output^   sY    Q;/+=>$t*A&)O;%5+.>>)N:)N:99;L,.Q;$%,/"- +n++G4d;l))'2D9o,,W5t<m**73T:yy"""MM-..w7>k((148r   cwdc                   \        V\        4      '       d   V.p. \        P                  ! 4       OVOVO\        Op
\        V
R RRV/V	B w  rpV P                  WW,           VW4WVV4	       R# )
__isolatedF__cwdN)
isinstancestrr   !optim_args_from_interpreter_flagsexample_argsr   r@   )r0   script_exec_argsr4   r5   r6   r7   r8   rB   cmd_line_switchesenv_varsrun_argsrcouterrs   &&&&&&&$*,    r   _check_scriptCmdLineTest._check_script}   s     &,, 01JW>>@ J&J)9J<HJ'
"'
/2
6>
 	+M)+c	Cr   c               H   \        V\        4      '       d   V3pM\        V4      pWA,           p\        VR RRV/VB w  rxp	\        ^8  d7   \        RV:R 24       \        \        V	4      4       \        RV,          4       V P                  VP                  R4      V	4       R# )rD   FrE   zOutput from test script  zExpected output: %rr$   N)	rF   rG   tupler   r%   r&   r'   r+   r,   )
r0   rJ   expected_msgrB   rK   rL   rM   rN   rO   rP   s
   &&&$*,    r   _check_import_errorCmdLineTest._check_import_error   s    &,, 02$%56$7,
"'
/2
6>
 Q;,-=,Aq,ABC$s)',67l))'2C8r   c                    \        R R4      w  rp\        \        P                  P                  4      P                  R4      pV P                  WB4       R# )-czprint(__loader__)r$   N)r   r'   r   	machineryBuiltinImporterr,   r+   )r0   rN   rO   rP   expecteds   &    r   test_dash_c_loaderCmdLineTest.test_dash_c_loader   s@    '.AB	++;;<CCGLh$r   c                B   \        4       p VP                  P                  R 4       VP                  P                  4        \	        V4      p\        \        P                  P                  4      P                  R4      pV P                  W24       R#   \	        T4      pi ; i)s   print(__loader__)
r$   N)r   stdinwriteflushr   r'   r   r[   r\   r,   r+   )r0   prO   r]   s   &   r   test_stdin_loaderCmdLineTest.test_stdin_loader   sq     N	!GGMM01GGMMOa.C	++;;<CCGLh$ a.Cs   5B Bc              #    "   V'       d)   \        R \        P                  R7      pVP                  pM'\        R \        P                  R7      pVP
                  p  VP                  ^4      pVR8X  d   MVP                  4        K,  Vx  \        V4       VP                  4        R#   \        T4       TP                  4        i ; i5i)z-i)stderrs   >>> N)
r   
subprocessPIPErh   STDOUTstdoutreadreadliner   close)r0   separate_stderrrd   rh   r3   s   &&   r   interactive_pythonCmdLineTest.interactive_python   s     T*//:AXXFT**;*;<AXXF
	{{1~7?!GNLLN NLLNs   AC0B( C(CCc                L   V P                  V4      ;_uu_ 4       pVP                  P                  R 4       VP                  P                  4        V P	                  RVP
                  P                  4       P                  4       4       RRR4       R#   + '       g   i     R# ; i)s   print('foo')
s   fooN)rq   ra   rb   rc   r(   rl   rn   strip)r0   rp   rd   s   && r   check_repl_stdout_flush#CmdLineTest.check_repl_stdout_flush   sh    $$_55GGMM+,GGMMOVQXX%6%6%8%>%>%@A 6555s   A.BB#	c                \   V P                  V4      ;_uu_ 4       pVP                  P                  R 4       VP                  P                  4        V'       d   VP                  MVP
                  pV P                  RVP                  4       4       V P                  RVP                  4       4       V P                  RVP                  4       4       V P                  RVP                  4       4       V P                  RVP                  4       4       RRR4       R#   + '       g   i     R# ; i)s   1/0
s
   Traceback s   File "<stdin>"s   1/0       ~^~s   ZeroDivisionErrorN)rq   ra   rb   rc   rh   rl   r+   rn   )r0   rp   rd   rh   s   &&  r   check_repl_stderr_flush#CmdLineTest.check_repl_stderr_flush   s    $$_55GGMM(#GGMMO!0QXXahhFMM-):;MM+V__->?MM&&//"34MM*foo&78MM.0AB 6555s   C6DD+	c                &    V P                  4        R # r   ru   r0   s   &r   test_repl_stdout_flush"CmdLineTest.test_repl_stdout_flush       $$&r   c                (    V P                  R 4       R# TNr|   r}   s   &r   &test_repl_stdout_flush_separate_stderr2CmdLineTest.test_repl_stdout_flush_separate_stderr       $$T*r   c                &    V P                  4        R # r   ry   r}   s   &r   test_repl_stderr_flush"CmdLineTest.test_repl_stderr_flush   r   r   c                (    V P                  R 4       R# r   r   r}   s   &r   &test_repl_stderr_flush_separate_stderr2CmdLineTest.test_repl_stderr_flush_separate_stderr   r   r   c                    \         P                  ! 4       ;_uu_ 4       p\        VR 4      pV P                  W"VVR\        P
                  P                  VR7       RRR4       R#   + '       g   i     R# ; i)scriptN)r9   r   temp_dirr   rQ   r   r[   SourceFileLoaderr0   r   r1   s   &  r   test_basic_scriptCmdLineTest.test_basic_script   s\    !!Z+JAK{)4(22CC,6  8 "!!!s   <A$$A5	c           
        \         P                  ! 4       ;_uu_ 4       pV P                  \        P                  P                  V4      V4       \        VR 4      p\        P                  P                  V4      pV P                  W2VVR\        P                  P                  4       RRR4       R#   + '       g   i     R# ; i)r   N)r   temp_cwd
assertTruer)   pathisabsr   basenamerQ   r   r[   r   )r0   r   r1   relative_names   &   r   test_script_abspathCmdLineTest.test_script_abspath   s     !!ZOOBGGMM*5zB+JAKGG,,[9M}=)4(22CCE "!!!s   BB00C	c           
     r   \         P                  ! 4       ;_uu_ 4       p\        VR 4      p\        P                  ! VRR7       \
        P                  ! V4       \        P                  ! V4      pV P                  W3W1R\        P                  P                  4       RRR4       R#   + '       g   i     R# ; i)r   TdoraiseNr   r   r   
py_compilecompiler)   remover   make_legacy_pycrQ   r   r[   SourcelessFileLoaderr0   r   r1   pyc_files   &   r   test_script_compiled CmdLineTest.test_script_compiled   s    !!Z+JAK{D9IIk"$44[AHx'T(22GGI "!!!s   A=B%%B6	c           
         \         P                  ! 4       ;_uu_ 4       p\        VR 4      pV P                  WVVR\        P
                  P                  4       RRR4       R#   + '       g   i     R# ; i)__main__rT   Nr   r   s   &  r   test_directoryCmdLineTest.test_directory   sU    !!Z+J
CKz
)2(22CCE "!!!   :A""A3	c           
     t   \         P                  ! 4       ;_uu_ 4       p\        VR 4      p\        P                  ! VRR7       \
        P                  ! V4       \        P                  ! V4      pV P                  WVVR\        P                  P                  4       RRR4       R#   + '       g   i     R# ; i)r   Tr   rT   Nr   r   s   &   r   test_directory_compiled#CmdLineTest.test_directory_compiled  s    !!Z+J
CK{D9IIk"$44[AHzZ)2(22GGI "!!!s   A>B&&B7	c                    \         P                  ! 4       ;_uu_ 4       pR V,          pV P                  W4       RRR4       R#   + '       g   i     R# ; i)"can't find '__main__' module in %rN)r   r   rW   )r0   r   msgs   &  r   test_directory_error CmdLineTest.test_directory_error  s:    !!Z6CC$$Z5 "!!!s   AA	c           
         \         P                  ! 4       ;_uu_ 4       p\        VR 4      p\        VRV4      w  r4V P	                  W4W3R\
        P                  4       RRR4       R#   + '       g   i     R# ; i)r   test_ziprT   N)r   r   r   r
   rQ   	zipimportzipimporter)r0   r   r1   zip_namerun_names   &    r   test_zipfileCmdLineTest.test_zipfile  s\    !!Z+J
CK!0Z!UHx8r(446 "!!!s   >A&&A7	c           
     V   \         P                  ! 4       ;_uu_ 4       p\        VR 4      p\        P                  ! VR\        P
                  P                  R7      p\        VRV4      w  rEV P                  WEWDR\        P                  4       RRR4       R#   + '       g   i     R# ; ir   T)r   invalidation_moder   rT   N)r   r   r   r   r   PycInvalidationMode	TIMESTAMPr
   rQ   r   r   r0   r   r1   compiled_namer   r   s   &     r   test_zipfile_compiled_timestamp+CmdLineTest.test_zipfile_compiled_timestamp  s    !!Z+J
CK&..T","@"@"J"JLM "1Z!WHx8r(446 "!!!   A/BB(	c           
     V   \         P                  ! 4       ;_uu_ 4       p\        VR 4      p\        P                  ! VR\        P
                  P                  R7      p\        VRV4      w  rEV P                  WEWDR\        P                  4       RRR4       R#   + '       g   i     R# ; ir   )r   r   r   r   r   r   CHECKED_HASHr
   rQ   r   r   r   s   &     r   "test_zipfile_compiled_checked_hash.CmdLineTest.test_zipfile_compiled_checked_hash$  s    !!Z+J
CK&..T","@"@"M"MOM "1Z!WHx8r(446 "!!!r   c           
     V   \         P                  ! 4       ;_uu_ 4       p\        VR 4      p\        P                  ! VR\        P
                  P                  R7      p\        VRV4      w  rEV P                  WEWDR\        P                  4       RRR4       R#   + '       g   i     R# ; ir   )r   r   r   r   r   r   UNCHECKED_HASHr
   rQ   r   r   r   s   &     r   $test_zipfile_compiled_unchecked_hash0CmdLineTest.test_zipfile_compiled_unchecked_hash.  s    !!Z+J
CK&..T","@"@"O"OQM "1Z!WHx8r(446 "!!!r   c                    \         P                  ! 4       ;_uu_ 4       p\        VR 4      p\        VRV4      w  r4RV,          pV P	                  W54       RRR4       R#   + '       g   i     R# ; i)not_mainr   r   N)r   r   r   r
   rW   )r0   r   r1   r   r   r   s   &     r   test_zipfile_errorCmdLineTest.test_zipfile_error8  sW    !!Z+J
CK!0Z!UH6AC$$X3	 "!!!s   6AA/	c                J   \         P                  ! 4       ;_uu_ 4       p\        P                  P	                  VR 4      p\        V4       \        VR4      pV P                  RR.W3VR \        P                  P                  VR7       RRR4       R#   + '       g   i     R# ; i)test_pkgr   -mtest_pkg.scriptrB   Nr   r   r)   r   joinr   r   rQ   r   r[   r   r0   r   pkg_dirr1   s   &   r   test_module_in_package"CmdLineTest.test_module_in_package?  s~    !!Zggll:z:GW+GX>K&78+):(22CC#-  /	 "!!!   A)BB"	c                    \         P                  ! 4       ;_uu_ 4       p\        VR RR4      w  r#V P                  RR.W3VR\        P
                  W!R7       RRR4       R#   + '       g   i     R# ; i)r   r   r   r   r   
PYTHONPATHrB   Nr   r   r   rQ   r   r   r0   r   r   r   s   &   r   !test_module_in_package_in_zipfile-CmdLineTest.test_module_in_package_in_zipfileI  sd    !!Z!3J
JX`!aH&78():y7L7L*2  D "!!!s   8A  A1	c                    \         P                  ! 4       ;_uu_ 4       p\        VR RR^R7      w  r#V P                  RR.W3VR\        P
                  W!R7       RRR4       R#   + '       g   i     R# ; i)	r   r   r   )r   r   ztest_pkg.test_pkg.scriptztest_pkg.test_pkgr   Nr   r   s   &   r   $test_module_in_subpackage_in_zipfile0CmdLineTest.test_module_in_subpackage_in_zipfileP  si    !!Z!3J
JX`hi!jH&@A8)+>(44*2  D "!!!r   c                J   \         P                  ! 4       ;_uu_ 4       p\        P                  P	                  VR 4      p\        V4       \        VR4      pV P                  RR .VW1R \        P                  P                  VR7       RRR4       R#   + '       g   i     R# ; i)r   r   r   r   Nr   r   s   &   r   test_packageCmdLineTest.test_packageX  s}    !!Zggll:z:GW+GZ@Kj1;*
(22CC#-  /	 "!!!r   c                   \         P                  ! 4       ;_uu_ 4       p\        P                  P	                  VR 4      p\        V4       \        VR4      p\        P                  ! VRR7      p\        P                  ! V4       \        P                  ! V4      pV P                  RR .VWQR \        P                  P                  VR7       RRR4       R#   + '       g   i     R# ; i)r   r   Tr   r   r   N)r   r   r)   r   r   r   r   r   r   r   r   r   rQ   r   r[   r   )r0   r   r   r1   r   r   s   &     r   test_package_compiled!CmdLineTest.test_package_compiledb  s    !!Zggll:z:GW+GZ@K&..{DIMIIk"$44[AHj18'Z(22GG#-  / "!!!s   B-CC&	c                    \         P                  ! 4       ;_uu_ 4       p\        P                  P	                  VR 4      p\        V4       RpV P                  RR .W1R7       RRR4       R#   + '       g   i     R# ; i)r   z7'test_pkg' is a package and cannot be directly executedr   r   Nr   r   r)   r   r   r   rW   )r0   r   r   r   s   &   r   test_package_errorCmdLineTest.test_package_erroro  s]    !!Zggll:z:GW*C$$dJ%7$M "!!!s   AA++A<	c                T   \         P                  ! 4       ;_uu_ 4       p\        P                  P	                  VR 4      p\        V4       \        P                  P	                  VR4      p\        V4       RpV P                  RR .WAR7       RRR4       R#   + '       g   i     R# ; i)r   r   z^Cannot use package as __main__ module; 'test_pkg' is a package and cannot be directly executedr   r   Nr   )r0   r   r   main_dirr   s   &    r   test_package_recursion"CmdLineTest.test_package_recursionw  s{    !!Zggll:z:GWww||GZ8HX*C $$dJ%7$M "!!!s   A.BB'	c                |   \         P                  ! 4       ;_uu_ 4       p\         P                  ! VR 7      ;_uu_ 4        \        P                  P                  VR4      p\        VR4       \        VR4      p\        RR.\        O5RR/ w  rEp\        ^8  d   \        \        V4      4       RR,          pV P                  VP                  R	4      V4       V P                  W4VW3VR\         P"                  P$                  4       R
R
R
4       R
R
R
4       R
#   + '       g   i     L; i  + '       g   i     R
# ; i)r   r   z1import sys; print('init_argv0==%r' % sys.argv[0])r   r   r   rD   Fzinit_argv0==%rr$   N)r   r   
change_cwdr)   r   r   r   r   r   rI   r%   r&   r'   r+   r,   r@   r   r[   r   )r0   r   r   r1   rN   rO   rP   r]   s   &       r   test_issue8202CmdLineTest.test_issue8202  s     !!Z%%:66'',,z:>"UV/B/6Gi,ichiQ;$s)$+d2hoog6<"";C#.Z#,#6#6#G#GI 7 "!66 "!!s#    D*CD	D*D'"D**D;	c                *   \         P                  ! 4       ;_uu_ 4       p\         P                  ! VR 7      ;_uu_ 4        \        RRRR7      ;_uu_ 4       pVP	                  R4       \        RRRR7      w  r4p\        ^8  d   \        \        V4      4       R	R
,          pV P                  VP                  R4      V4       RRR4       RRR4       RRR4       R#   + '       g   i     L"; i  + '       g   i     L-; i  + '       g   i     R# ; i)r   rZ   wr$   encodingr3   z2import sys; print("sys.path[0]==%r" % sys.path[0])F)rD   zsys.path[0]==%rrT   N)r   r   r   openrb   r   r%   r&   r'   r+   r,   )r0   r   frN   rO   rP   r]   s   &      r   "test_issue8202_dash_c_file_ignored.CmdLineTest.test_issue8202_dash_c_file_ignored  s     !!Z%%:66$g66!GGFO#3DL#($*LBS {d3i(025HMM(//'":C@ 7 7 "!66 76 "!!s;    DC.	A,CC.		DC+&C.	.C>9DD	c                   \         P                  ! 4       ;_uu_ 4       p\        VR 4      p\         P                  ! VR7      ;_uu_ 4        \	        RRRR7      ;_uu_ 4       pVP                  R4       \        RR .\        O5RR/ w  rEpV P                  W$VW"VR	\        P                  P                  4       R
R
R
4       R
R
R
4       R
R
R
4       R
#   + '       g   i     L"; i  + '       g   i     L-; i  + '       g   i     R
# ; i)otherr   r   r   r$   r  r3   rD   FrT   N)r   r   r   r   r  rb   r   rI   r@   r   r[   r   )r0   r   r1   r  rN   rO   rP   s   &      r   "test_issue8202_dash_m_file_ignored.CmdLineTest.test_issue8202_dash_m_file_ignored  s     !!Z+J@K%%:66$g66!GGFO#3D' $FL $F?D$FLBS&&{&1
B&/&9&9&J&JL	 7 7 "! 76 76 "!!s<   ,C8
C%	!AC8C%	 C8C"C%	%C50C88D		c           	        \         P                  ! 4       ;_uu_ 4       p\        P                  P	                  VR 4      p\        VRRRR7      ;_uu_ 4       pVP                  R4       VP                  R4       \        ^4       F  pVP                  R
4       K  	  VP                  R4       RRR4       \         P                  ! VR7      ;_uu_ 4        \        V4      w  rVpRRR4       V P                  R	X4       V P                  R	X4       RRR4       R#   + '       g   i     Lt; i  + '       g   i     LQ; i  + '       g   i     R# ; i)zissue20884.pyr   latin1
)r  newlinez#coding: iso-8859-1
z"""
Nr   r   zQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
)r   r   r)   r   r   r  rb   ranger   r   r(   )r0   r   r1   r  _rN   rO   rP   s   &       r   test_issue20884CmdLineTest.test_issue20884  s     !!Z'',,z?CKk34HHA/0 rAGGM* #  I %%:66/< 7S#&S#& "!HH 76 "!!s<   8D?AD	-'D?D,	#,D?D)$D?,D<7D??E	c           	   '  Z  "   \         P                  ! 4       ;_uu_ 4       p\         P                  ! VR 7      ;_uu_ 4        \        P                  P                  VR4      p\        V.VO5!   Vx  RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i5i)r   r   N)r   r   r   r)   r   r   r   )r0   argsr   r   s   &*  r   setup_test_pkgCmdLineTest.setup_test_pkg  sl     !!Z$$*55ggll:z:GW$t$M 6 "!55 "!!s4   B+ B 2B	2B:
B+BBB(	"	B+c                    \        R .VO5RR/ w  r#p\        ^8  d   \        \        V4      4       V P	                  V^4       V# )r   rD   F)r   r%   r&   r'   r(   )r0   r  rN   rO   rP   s   &*   r   check_dash_m_failure CmdLineTest.check_dash_m_failure  sB    ,TKDKUKQ;$s)Q
r   c                    V P                  4       ;_uu_ 4       p\        VR R4      pV P                  ! R.\        O5!  pV P	                  RV4       RRR4       R#   + '       g   i     R# ; i)r  z+if __name__ == '__main__': raise ValueErrorztest_pkg.others
   ValueErrorN)r  r   r  rI   r+   )r0   r   r1   rP   s   &   r   test_dash_m_error_code_is_one)CmdLineTest.test_dash_m_error_code_is_one  sZ       ""g+GW,Y[K++,<L|LCMM--	 #"""s   8AA,	c                   RpV Fk  w  r#V P                  V4      ;_uu_ 4        \        RV4      w  rEpV P                  V^4       V P                  Wc4       V P	                  RV4       RRR4       Km  	  R#   + '       g   i     K  ; i)builtinsr   	   TracebackN))r  s   No code object available)z
builtins.xs=   Error while finding module specification.*ModuleNotFoundError)zbuiltins.x.ys]   Error while finding module specification.*ModuleNotFoundError.*No module named.*not a package)r   s=   No module named.*is a package and cannot be directly executed)zimportlib.nonexistents   No module named)z	.unittests#   Relative module names not supported)subTestr   r(   assertRegexassertNotIn)r0   testsnameregexrN   r  rP   s   &      r   test_dash_m_errorsCmdLineTest.test_dash_m_errors  sv    

 !KDd##24>
s  Q'  ,  s3	 $# !###s   AA66Bc                   \         P                  ! 4       ;_uu_ 4       p\         P                  ! VR 7      ;_uu_ 4        \        P                  ! R4       \        RR4      ;_uu_ 4         RRR4       V P                  R4      pV P                  VR4       V P                  RV4       V P                  RV4       RRR4       RRR4       R#   + '       g   i     Li; i  + '       g   i     L-; i  + '       g   i     R# ; i)r   r   ztest_pkg/__init__.pycwbNsG   Error while finding module specification.*ImportError.*bad magic numbers   is a packager  )	r   r   r   r)   mkdirr  r  r!  r"  r0   r   rP   s   &  r   test_dash_m_bad_pycCmdLineTest.test_dash_m_bad_pyc  s    !!Z$$*55HHZ -t44 5++J7CS23 _c2\3/ 6 "! 54 65 "!!s;    C2+C	)C+AC	:C2CC	C/*C22D	c                   \         P                  ! 4       ;_uu_ 4       p\         P                  ! VR 7      ;_uu_ 4        \        RR4      ;_uu_ 4         RRR4       V P	                  R4      pV P                  RV4       RRR4       RRR4       R#   + '       g   i     LE; i  + '       g   i     L-; i  + '       g   i     R# ; i)r   z
asyncio.pyr)  Ns>   Try using 'asyncio' instead of 'asyncio.py' as the module name)r   r   r   r  r  r+   r+  s   &  r   *test_hint_when_triying_to_import_a_py_file6CmdLineTest.test_hint_when_triying_to_import_a_py_file  s    !!Z$$*55lD)) *++L9CMM @ADF 6 "! *) 65 "!!s:    B8B%	B+B%	 B8B"B%	%B50B88C		c           
         \         \        \        \        3pV F  pVP                  pR P                  V4      pV P                  V4      ;_uu_ 4        V P                  V4      ;_uu_ 4       pV P                  R4      pV P                  VP                  R4      V4       V P                  RV4       V P                  RV4       RRR4       RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)z%raise {0}('Exception in __init__.py')r   asciis   Exception in __init__.pyr  N)ImportErrorAttributeError	TypeError
ValueError__name__formatr   r  r  r+   r,   )r0   
exceptions	exceptioninitr   rP   s   &     r   test_dash_m_init_traceback&CmdLineTest.test_dash_m_init_traceback  s     ">9jI
#I!**I:AA)LDi((''--//
;i..w7=93?lC0	 . )( $ .- )((s%   C,,ACC,C)$C,,C=c                   V P                  4       ;_uu_ 4       pR p\        VRV4       V P                  R4      pV P                  RV4       V P                  RV4       V P                  RV4       RRR4       R#   + '       g   i     R# ; i)z1raise ImportError('Exception in __main__ module')r   r   s   ImportErrors   Exception in __main__ moduler  N)r  r   r  r+   )r0   r   mainrP   s   &   r   test_dash_m_main_traceback&CmdLineTest.test_dash_m_main_traceback  sn      ""gFDgz48++J7CMM.#.MM93?MM,, #"""s   AA::B	c                   \         P                  ! R 4      p\        P                  ! 4       ;_uu_ 4       p\	        VRV4      p\        V4      w  rEpVP                  R4      P                  R4      pV P                  \        V4      ^4       V P                  V^ ,          R4       V P                  V^,          R4       V P                  V^,          R4       RRR4       R#   + '       g   i     R# ; i)z            try:
                raise ValueError
            except ValueError:
                raise NameError from None
            r   r2  r  	Tracebackz  File 	NameErrorN)textwrapdedentr   r   r   r   decodesplitr(   lenassertStartsWithr0   r   r   r1   exitcoderl   rh   texts   &       r   test_pep_409_verbiage!CmdLineTest.test_pep_409_verbiage  s      "  !!Z+J&IK'<['I$Hf==)//5DSY*!!$q';7!!$q'95!!$q';7 "!!!s   B"C  C1	c                t   \         P                  '       dG   \        P                  R9  d2   \        '       g&   \
        P                  ! \         P                  4      pM8\         P                  '       d   \         P                  pMV P                  R4       Rp\        \
        P                  ! 4       XV4      pV P                  \         P                  V4       \        V4      w  rEpV P                  \        V4      VP!                  4       P#                  R4      RV: RV: 24       V P                  ^ V4       R# )win32zneed os_helper.TESTFN_NONASCIIzprint(ascii(__file__))
r2  zstdout=z stderr=N>   wasirQ  
emscripten)r   TESTFN_UNDECODABLEr-   platformr   r)   fsdecodeTESTFN_NONASCIIskipTestr   r*   
addCleanupunlinkr   r(   r2  rstriprG  )r0   r$  r   r1   rN   rl   rh   s   &      r   test_non_asciiCmdLineTest.test_non_ascii0  s     ((( %  H;;y;;<D&&&,,DMM:; ,'		T6B	((+6-k:F+MMO""7+%+V4	6 	Br   c                >   \         P                  ! R 4      p\        P                  ! 4       ;_uu_ 4       p\	        VRV4      p\        V4      w  rEpVP                  R4      pV P                  VP                  4       R4       RRR4       R#   + '       g   i     R# ; i)z            import sys
            error = None
            try:
                raise ValueError('some text')
            except ValueError as err:
                error = err

            if error:
                sys.exit(error)
            r   r2  z	some textN)	rE  rF  r   r   r   r   rG  r(   r[  rK  s   &       r   )test_issue20500_exit_with_exception_value5CmdLineTest.test_issue20500_exit_with_exception_valueM  sx     
" 
 !!Z+J&IK'<['I$Hf==)DT[[]K8	 "!!!s   ABB	c                J   R p\         P                  ! 4       ;_uu_ 4       p\        VRV4      p\        V4      w  rEp\        P
                  ! \        P                  ! V4      R4      P                  4       pV P                  RV4       RRR4       R#   + '       g   i     R# ; i)z
1 + 1 = 2
r   r2  z
    ^^^^^
N)	r   r   r   r   ioTextIOWrapperBytesIOrm   r+   rK  s   &       r   *test_syntaxerror_unindented_caret_position6CmdLineTest.test_syntaxerror_unindented_caret_position_  sv    !!Z+J&IK'<['I$Hf##BJJv$6@EEGDMM/40 "!!!   A'BB"	c                f   \         P                  ! R 4      p\        P                  ! 4       ;_uu_ 4       p\	        VRV4      p\        V4      w  rEp\        P                  ! \        P                  ! V4      R4      P                  4       pV P                  RV4       Rp\	        VRV4      p\        V4      w  rEp\        P                  ! \        P                  ! V4      R4      P                  4       pV P                  RV4       V P                  RV4       RRR4       R#   + '       g   i     R# ; i)z;            if True:
                1 + 1 = 2
            r   r2  z
    1 + 1 = 2
    ^^^^^
zif True:
    1 + 1 = 2
N)rE  rF  r   r   r   r   rb  rc  rd  rm   r+   r"  rK  s   &       r   (test_syntaxerror_indented_caret_position4CmdLineTest.test_syntaxerror_indented_caret_positionh  s     "  !!Z+J&IK'<['I$Hf##BJJv$6@EEGDMM8$?$  ,J&IK'<['I$Hf##BJJv$6@EEGDT4(MM8$?! "!!!s   C!DD0	c                    R p\         P                  ! 4       ;_uu_ 4       p\        VRV4      p\        V4      w  rEpV P	                  VP                  4       RR . RO4       RRR4       R#   + '       g   i     R# ; i)zfoo = f"""{}
foo"""
r   N)s       foo = f"""{}s                  ^s;   SyntaxError: f-string: valid expression required before '}'r   r   r   r   r(   
splitlinesr0   r   r   r1   rL  rl   rh   s   &      r   #test_syntaxerror_multi_line_fstring/CmdLineTest.test_syntaxerror_multi_line_fstring  sj    )!!Z+J&IK'<['I$Hf!!#BC( "!!!   AA++A<	c                    R p\         P                  ! 4       ;_uu_ 4       p\        VRV4      p\        RV4      w  rEpV P	                  VP                  4       RR . RO4       RRR4       R#   + '       g   i     R# ; i)zfoo = """\q"""
r   z-WerrorNrm  )s       foo = """\q"""s                ^^sd   SyntaxError: "\q" is an invalid escape sequence. Did you mean "\\q"? A raw string is also an option.rn  rp  s   &      r   3test_syntaxerror_invalid_escape_sequence_multi_line?CmdLineTest.test_syntaxerror_invalid_escape_sequence_multi_line  sq    $!!Z+J&IK'<;($Hf !!#BC( "!!!s   AA,,A=	c                    R p\         P                  ! 4       ;_uu_ 4       p\        VRV4      p\        V4      w  rEpV P	                  VP                  4       RR RR.4       RRR4       R#   + '       g   i     R# ; i)z?x = ' ' nothing to see here
';import os;os.system('echo pwnd')
r   Ns	       x = '2   SyntaxError: source code cannot contain null bytesrn  rp  s   &      r   test_syntaxerror_null_bytes'CmdLineTest.test_syntaxerror_null_bytes  sp    U!!Z+J&IK'<['I$Hf!!#BC( I "!!!rs  c                   R R.p\         P                  ! 4       ;_uu_ 4       pV FC  p\        VRV4      p\        V4      w   rVV P	                  VP                  4       RR RR.4       KE  	  RRR4       R#   + '       g   i     R# ; i)z
'''
multilinestring 
'''z
f'''
multilinestring 
'''r   Ns       multilinestringrx  ry  rn  )r0   scriptsr   r   r1   r  rh   s   &      r   /test_syntaxerror_null_bytes_in_multiline_string;CmdLineTest.test_syntaxerror_null_bytes_in_multiline_string  s    24TU!!Z!/
HfM4[A1  %%',.M " "!!!s   A
A66B	c                l    \        R R4      w   r. ROpV P                  VP                  4       V4       R# )rZ   z1/0N)s"   Traceback (most recent call last):s&     File "<string>", line 1, in <module>s       1/0rx   s#   ZeroDivisionError: division by zero)r   r(   ro  )r0   r  rh   expected_liness   &   r   /test_source_lines_are_shown_when_running_source;CmdLineTest.test_source_lines_are_shown_when_running_source  s4    ,T5914 	**,n=r   c                J   R p\         P                  ! 4       ;_uu_ 4       p\        VRV4      p\        V4      w  rEp\        P
                  ! \        P                  ! V4      R4      P                  4       pV P                  VR4       RRR4       R#   + '       g   i     R# ; i)znonlocal x
r   r2  z>SyntaxError: nonlocal declaration not allowed at module level
N)	r   r   r   r   rb  rc  rd  rm   assertEndsWithrK  s   &       r   test_syntaxerror_does_not_crash+CmdLineTest.test_syntaxerror_does_not_crash  s|    !!Z+J&IK'<['I$Hf##BJJv$6@EEGDQS "!!!rg  c           
        \         P                  ! R 4      pRV n        \        P                  ! 4       ;_uu_ 4       p\        P                  ! 4       ;_uu_ 4       p\        VRV4      p\        RWBR7      p\        V4      P                  4       P                  4       pV P                  V^ ,          V4       V P                  W&4       \        RW2R7      p\        V4      P                  4       P                  4       pV P                  Wv4       \        RW2R7      p\        V4      P                  4       P                  4       pV P                  WV4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c            import sys
            for entry in sys.path:
                print(entry)
            Nr   z-Esr   z-I)rE  rF  maxDiffr   r   r   r   r   rG  ro  r(   r"  )	r0   r   work_dirr   r1   rd   out_by_name
out_by_dirout_by_dir_isolateds	   &        r   -test_consistent_sys_path_for_direct_execution9CmdLineTest.test_consistent_sys_path_for_direct_execution  s%     "  !!Xy/A/A/C/Cz+J
FKK UK>A%a.//1<<>K[^Z8X3UJ=A$Q..0;;=JZ5T:<A"-a."7"7"9"D"D"F0kJ 0D!!/C/C!!!s$   E5C7E"	E5"E2-E55F	c                   \         P                  ! R 4      pRV n        \        P                  ! 4       ;_uu_ 4       p\
        P                  P                  VR4      p\
        P                  ! V4       \        VRV4      p\        RRVR7      p\        V4      P                  4       P                  4       pV P                  V^ ,          V4       V P                  W64       \        RRVR7      p\        V4      P                  4       P                  4       pV P                  Wv4       \!        RRVR7      w  rp
V
P                  4       P                  4       pV P#                  RVR	,          4       RRR4       R#   + '       g   i     R# ; i)
r  N
script_pkgr   z-smzscript_pkg.__main__r   z-ImzNo module named script_pkg)rE  rF  r  r   r   r)   r   r   r*  r   r   r   rG  ro  r(   r"  r   r+   )r0   r   r  r   r1   rd   out_by_moduleout_by_packagerL  rl   rh   traceback_liness   &           r   -test_consistent_sys_path_for_module_execution9CmdLineTest.test_consistent_sys_path_for_module_execution  s4     "  !!Xh=JHHZ +J
FKK U$9xHA'N113>>@M]1-x8Z7ULh?A(^224??AN^;'<|($Hf %mmo88:OMM68KL) "!!!s   D1E66F	c                <   R pV P                  \        P                  P                  V4      4       \	        VR\
        P                  \
        P                  R7      pVP                  4       w  r4V P                  RV4       V P                  VP                  ^ 4       R# )znonexistingscript.pyT)rM  rl   rh   z: can't open file N)assertFalser)   r   existsr   ri   rj   communicater+   assertNotEqual
returncode)r0   r   procrO   rP   s   &    r   test_nonexisting_script#CmdLineTest.test_nonexisting_script  su    
 (/0F#-??#-??4 ##%*C0DOOQ/r   z	/dev/fd/0zrequires /dev/fd platformfreebsdz/devz/dev/fdz.Requires fdescfs mounted on /dev/fd on FreeBSDc                   R p\         P                  ! 4       ;_uu_ 4       p\        VRV4      p\        VR4      ;_uu_ 4       p\	        RVP                  4        2R^ ^^VP                  4       3R7      pVP                  4       w  rgV P                  VR4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z print("12345678912345678912345")z	script.pyrz/dev/fd/T)	close_fdspass_fdss   12345678912345678912345
N)r   r   r   r  r   filenor  r(   )r0   r   r  r1   fprd   rO   rP   s   &       r   test_script_as_dev_fd!CmdLineTest.test_script_as_dev_fd  s     4!!X+Hk6JKk3''2 8BIIK=!9TUVWXYZ[][d[d[fTgh==?  &BC ( "!'' "!!s$   "B=AB*	B=*B:5B==C	)r  r   )F)Lr7  
__module____qualname____firstlineno__r@   rQ   rW   r^   re   
contextlibcontextmanagerrq   ru   ry   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r	  r  r  r  r  r&  r,  r/  r<  r@  rN  r\  r_  re  rj  rq  ru  rz  r~  r  r  r  r  r  unittest
skipUnlessr)   r   r  skipIfr-   rU  
startswithstatst_devr  __static_attributes____classdictcell__)__classdict__s   @r   r!   r!   \   s    9>C 59C9489 %
%  &B	C'+'+8
EIEI6
66664/DD//N	NI"AL'"  .4(0F1-8$ :9$1@. 
>SK>#MJ0 46QR__S\\,,Y7 I IWWV_++rwwy/A/H/HHEG
DG S
Dr   r!   c                  0    \         P                  ! 4        R # r   )r   reap_children r   r   tearDownModuler  /  s    r   r   )test1test2test3)&r  r   importlib.machineryr   r  r-   r)   os.pathr   ri   rb  rE  testr   test.supportr   r   r   test.support.script_helperr   r   r	   r
   r   r   r   r   r%   rI   test_sourcer   r   force_not_colorized_test_classTestCaser!   r  r7  r?  r  r   r   <module>r     s         
 	    	   ; ;H H H //*3j ;F  * 	''ND(## ND (NDd zMMO r   