Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.12.161.138
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_runpy.pyc
�
?��cc@s"ddlZddlZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZmZm
Z
mZmZmZddlmZmZmZmZdejfd��YZdejfd��YZd	ejfd
��YZd�Zedkre�ndS(
i����N(tverbosetrun_unittesttforget(ttemp_dirtmake_scripttcompile_scripttmake_pkgtmake_zip_scripttmake_zip_pkg(t	_run_codet_run_module_codet
run_moduletrun_pathtRunModuleCodeTestcBs2eZdZddgZdZd�Zd�ZRS(s9Unit tests for runpy._run_code and runpy._run_module_codesTop level assignmentsLower level references�# Check basic code execution
result = ['Top level assignment']
def f():
    result.append('Lower level reference')
f()
# Check the sys module
import sys
run_argv0 = sys.argv[0]
run_name_in_sys_modules = __name__ in sys.modules
if run_name_in_sys_modules:
   module_in_sys_modules = globals() is sys.modules[__name__].__dict__
# Check nested operation
import runpy
nested = runpy._run_module_code('x=1\n', mod_name='<run>')
cCs�tjd}t|ji�}|j|d|j�|j|dd�|j|dd�|j|dd�|j|dd�|j|d|�|jd|�|jtjd|�dS(	Nitresultt__name__t__file__t
__loader__t__package__t	run_argv0trun_name(	tsystargvR	ttest_sourcetassertEqualtexpected_resulttassertIstNonetassertNotIn(tselftsaved_argv0td((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt
test_run_code*s
c	Csbt�}d}d}d}d}td|�}tjd}t|j|||||�}|jd|�|j|d|�|j|d|j	�|j|dd	d
�|j|d|�|j
|d�|j
|d
�|j|d|�|j|d|�|j|d|�|j|d|�|jtjd|�|j|tj�dS(Ns
<Nonsense>sSome other nonsensesNow you're just being sillyttinitialiRtnestedtxiRtrun_name_in_sys_modulestmodule_in_sys_modulesRRRR(tobjecttdictRRR
RRRRRt
assertTruetmodules(	RR"tnametfiletloadertpackagetd1Rtd2((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_run_module_code6s4	
		(Rt
__module__t__doc__RRR R1(((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyR
s
	t
RunModuleTestcBs�eZdZd�Zd�Zd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
�Zdd�Z
d�Zd
�Zd�Zd�Zd�ZRS(sUnit tests for runpy.run_modulecCs7yt|�Wntk
r!nX|jd|�dS(NsExpected import error for (RtImportErrortfail(Rtmod_name((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pytexpect_import_errorVs

cCs_|jd�|jd�|jd�|jd�|jd�|jd�|jd�dS(NRssys.imp.ericsos.path.halfsa.bees.howards..eatentmultiprocessing(R8(R((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_invalid_names^s





cCstd�dS(Ntrunpy(R(R((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_library_modulejscCsJtj|�tjj|dtjd�}t|d�}|j�|S(Nt__init__tpytw(tostmkdirtpathtjointextseptopentclose(Rtpkg_dirt	pkg_fnametpkg_file((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt_add_pkg_dirms

 
t
runpy_testc
Cs0d}|tjd}tj�}}tr9dG|GHntjjd|�tredGtjdGHnx\t|�D]N}tjj	||�}|j
|�}	tr�dG|GHntrrdG|	GHqrqrWtjj	||�}
t|
d�}|j|�|j
�trdG|
GHn|d	||}||
|fS(
Nt
__runpy_pkg__R>s  Package tree in:is  Updated sys.path:s  Next level in:s
  Created:R?t.(R@RDttempfiletmkdtempRRRBtinserttrangeRCRJREtwriteRF(
Rtsourcetdepthtmod_basetpkg_namet
test_fnameRGtsub_dirtiRHt	mod_fnametmod_fileR7((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt	_make_pkgts.

cCs|x3ttj�D]"}|jd�rtj|=qqWtrDdGHntjd=tr\dGHnx�tj|dt�D]�\}}}xR|D]J}y tj	tjj
||��Wq�tk
r�}	tr�|	GHq�q�Xq�WxX|D]P}tjj
||�}
ytj|
�Wq�tk
r,}	tr-|	GHq-q�Xq�WqrWytj|�trSdGHnWn!tk
rw}	trx|	GHqxnXdS(NRLs  Removed sys.modules entriesis  Removed sys.path entryttopdowns  Removed package tree(
tlistRR*t
startswithRRBR@twalktFalsetremoveRCtOSErrortrmdir(RttopRTR7tentrytroottdirstfilesR+textfullname((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt_del_pkg�s:
%
 

cCs|jd|�\}}}t|�z�tr:dG|GHnt|�}|jd|�|j|ddk�~t|�tj|�t	j
s�tr�dG|GHnt|�}|jd|�|j|ddk�~nWd|j|||�XtrdGHndS(Nsx=1
sRunning from source:R$isRunning from compiled:sModule executed successfully(R\RRRtassertInR)t
__import__R@RbRtdont_write_bytecodeRl(RRTRGRZR7R/R0((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt
_check_module�s*


	
c	Cs |jd|d�\}}}|jd�\}}}t|�z�trUdG|GHnt|�}|jd|�|j|ddk�~t|�tj	|�t
js�tr�dG|GHnt|�}|jd|�|j|ddk�~nWd|j|||�XtrdGHndS(	Nsx=1
t__main__RMsRunning from source:R$isRunning from compiled:sPackage executed successfully(
R\t
rpartitionRRRRmR)RnR@RbRRoRl(	RRTRGRZR7RVt_R/R0((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt_check_package�s,


	
cCs[|dkrtd��nd}|}x/t|�D]!}|}tjj||�}q4Wtjj|dtjd�}t|d�}	|	j�tr�dG|GHntjj|d�}
|j	|
�tr�d	G|
GHntjj|
d
�}|j	|�trdG|GHntjj|dtjd�}t|d�}
|
j�trWd
G|GHndS(Nis$Relative module test needs depth > 1RLtsiblingR>R?s  Added sibling module:tuncles  Added uncle package:tcousins  Added cousin package:tnephews  Added nephew module:(
t
ValueErrorRQR@RBRCRDRERFRRJ(Rtbase_dirRSRTRVt
module_dirRYt
parent_dirt
sibling_fnametsibling_filet	uncle_dirt
cousin_dirtnephew_fnametnephew_file((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt_add_relative_modules�s2 


 
c
Cssd}|j||�\}}}z)|j|||�|jd�d}tr\dG|GHnt|d|�}|jd|�|j|d|k�|jd|�|jd|�~t|�tj	|�t
jsItr�d	G|GHnt|d|�}	|jd|	�|j|	d|k�|jd|	�|jd|	�~	nWd|j|||�Xtrod
GHndS(Nsa\
from __future__ import absolute_import
from . import sibling
from ..uncle.cousin import nephew
RMisRunning from source:RRRuRxsRunning from compiled:sModule executed successfully(
R\R�RrRRRmR)RnR@RbRRoRl(
RRTRtcontentsRGRZR7RVR/R0((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt_check_relative_imports�s6

	
cCs:x3td�D]%}tr%dG|GHn|j|�q
WdS(NisTesting package depth:(RQRRp(RRT((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_run_modulescCs=x6tdd�D]%}tr(dG|GHn|j|�qWdS(NiisTesting package depth:(RQRRt(RRT((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_run_packagesc
Cs#ttttf}x
|D]}|j}dj|�}|jddd�}|\}}}|jdd�}z�tj	j
|dd�}	t|	d��}
|
j|�WdQXyt
|�Wn/|k
r�}d	}|j|t|��nX|jd
j|��Wd|j|d|�XqWdS(Ns raise {0}('{0} in __init__.py.')R!iRqs	.__main__RLs__init__.pytwtscannot be directly executedsNothing raised; expected {}(R5tAttributeErrort	TypeErrorRyRtformatR\treplaceR@RBRCRERRRRR6Rl(
Rt
exceptionst	exceptionR+RSRRGRsR7tinitR[terrtmsg((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt test_run_package_init_exceptionss$
	cCs=x6tdd�D]%}tr(dG|GHn|j|�qWdS(Niis"Testing relative imports at depth:(RQRR�(RRT((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_explicit_relative_import)scCs@x9tdd�D](}tr(dG|GHn|j|d�qWdS(Niis'Testing main relative imports at depth:Rq(RQRR�(RRT((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_main_relative_import.sN(RR2R3R8R:R<RJR\RlRpRtR�RR�R�R�R�R�R�(((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyR4Ss 								 				tRunPathTestcBs�eZdZdZdd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�ZRS(sUnit tests for runpy.run_pathsX# 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 assertIs(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 the sys module
import sys
assertIs(globals(), sys.modules[__name__].__dict__)
argv0 = sys.argv[0]
cCs(|dkr|j}nt|||�S(N(RRR(Rt
script_dirtscript_basenameRS((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt_make_test_scriptMscCspt|�}|j|d|�|j|d|�|jd|�|j|d|�|j|d|�dS(NRRtargv0R(RRRm(Rtscript_namet
expected_namet
expected_filetexpected_argv0texpected_packageR((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt
_check_scriptRscCs)tj|�}|jt|t|�dS(N(tretescapetassertRaisesRegexpR5R(RR�R�((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt_check_import_error[sc
CsGt��8}d}|j||�}|j|d||d�WdQXdS(Ntscripts
<run_path>(RR�R�R(RR�R7R�((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_basic_script_s
c
Cs`t��Q}d}|j||�}t|�}tj|�|j|d||d�WdQXdS(NR�s
<run_path>(RR�RR@RbR�R(RR�R7R�t
compiled_name((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_script_compiledfs
c
CsGt��8}d}|j||�}|j|d||d�WdQXdS(NRqs
<run_path>R!(RR�R�(RR�R7R�((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_directoryos
c
Cs`t��Q}d}|j||�}t|�}tj|�|j|d||d�WdQXdS(NRqs
<run_path>R!(RR�RR@RbR�(RR�R7R�R�((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_directory_compiledvs
cCsHt��9}d}|j||�}d|}|j||�WdQXdS(Ntnot_mains"can't find '__main__' module in %r(RR�R�(RR�R7R�R�((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_directory_errors

c
Cs_t��P}d}|j||�}t|d|�\}}|j|d||d�WdQXdS(NRqttest_zips
<run_path>R!(RR�RR�(RR�R7R�tzip_nametfname((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_zipfile�s
c
Cskt��\}d}|j||�}t|�}t|d|�\}}|j|d||d�WdQXdS(NRqR�s
<run_path>R!(RR�RRR�(RR�R7R�R�R�R�((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_zipfile_compiled�scCs`t��Q}d}|j||�}t|d|�\}}d|}|j||�WdQXdS(NR�R�s"can't find '__main__' module in %r(RR�RR�(RR�R7R�R�R�R�((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_zipfile_error�s
c	
Cs�t��r}t��`}d}d|}|j|||�}t|d|�\}}d}|jt|t|�WdQXWdQXdS(NRqs import runpy
runpy.run_path(%r)
R�srecursion depth exceeded(RR�RR�tRuntimeErrorR(	RR�t	dummy_dirR7RSR�R�R�R�((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyttest_main_recursion_error�sN(RR2R3RRR�R�R�R�R�R�R�R�R�R�R�R�(((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyR�4s													cCstttt�dS(N(RR
R4R�(((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt	test_main�sRq(tunittestR@tos.pathRR�RNttest.test_supportRRRttest.script_helperRRRRRRR;R	R
RRtTestCaseR
R4R�R�R(((s6/usr/local/python-2.7/lib/python2.7/test/test_runpy.pyt<module>s.">�u	
© 2025 GrazzMean