%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/test_import.pyo

ó
Nźįac@søddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZmZmZmZmZmZmZddlmZddlmZd„Zd„Zd„Zde	jfd	„ƒYZd
e	jfd„ƒYZde	jfd
„ƒYZde	jfd„ƒYZde	jfd„ƒYZ e!d„Z"e#dkr“ddl$m"Z"e"ƒndS(i’’’’N(tunlinktTESTFNtunloadtrun_unittesttrmtreet	is_jythontcheck_warningstEnvironmentVarGuard(tsymlink_support(t
script_helpercCsC|tjd|tjd|tjd|tjd|dfS(Ntpytpyctpyotpyws	$py.class(tostextsep(tname((s,/usr/local/lib/python2.7/test/test_import.pyt_filess
cCs]xVt|ƒD]H}ytj|dƒWq
tk
rT}|jtjkrU‚qUq
Xq
WdS(Ni€(RRtchmodtOSErrorterrnotENOENT(Rtftexc((s,/usr/local/lib/python2.7/test/test_import.pytchmod_filesscCs%xt|ƒD]}t|ƒq
WdS(N(RR(RR((s,/usr/local/lib/python2.7/test/test_import.pytremove_files"stImportTestscBs
eZd„ZeZd„Zd„Zd„Zeje	j
dkdƒejej
dƒd„ƒƒZejej
dƒd„ƒZd	„Zd
d„Zd„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsttƒdS(N(RR(tself((s,/usr/local/lib/python2.7/test/test_import.pyttearDown)scCs5yddl}Wntk
r#nX|jdƒdS(Ni’’’’s3import of RAnDoM should have failed (case mismatch)(tRAnDoMtImportErrortfail(RR((s,/usr/local/lib/python2.7/test/test_import.pyttest_case_sensitivity-s

cCsddlm}dS(Ni’’’’(tdouble_const(ttestR!(RR!((s,/usr/local/lib/python2.7/test/test_import.pyttest_double_const7scsއfd†}tjjdtjƒzW|tjdƒtjjdƒr{x-ddddd	d
gD]}||ƒqdWnWdtjd=XdS(Nc		s™t|}ttjd}tr.td}nttjd}t|dƒX}|d|dfIJtjdƒ}tjdƒ}|dI|IJ|d	I|IJWdQXzuyttƒ}Wn*tk
rē}ˆj	d
||fƒn5Xˆj
|j|d|ƒˆj
|j|d|ƒWdt
|ƒXzHytjsJtj|ƒnWn$tk
rq}ˆj	d|ƒnXWdt
|ƒt
|ƒttƒXdS(
NRs	$py.classRtws)# This tests Python's ability to import asfile.ičsa =sb =simport from %s failed: %ss'module loaded (%s) but contents invalids import from .pyc/.pyo failed: %s(RRRRtopentrandomt	randranget
__import__RRtassertEqualtatbRtsystdont_write_bytecodetimptreloadR(	texttsourceRRRR*R+tmodterr(R(s,/usr/local/lib/python2.7/test/test_import.pyttest_with_extension=s>


		

iR
twins.PYs.Pys.pYs.pyws.PYWs.pYw(R,tpathtinsertRtcurdirRtplatformt
startswith(RR4R0((Rs,/usr/local/lib/python2.7/test/test_import.pyttest_import<s'tposixs%test meaningful only on posix systemss*test meaningful only when writing bytecodecCsItjdƒ}tjjdtjƒzńttjd}t|dƒj	ƒ}tj
|tjtj
BtjBtjBtjBtjBƒttƒ|d}tjj|ƒsŁ|d}tjj|ƒsŁ|jdƒqŁntj|ƒ}|jtj|jƒtjtj
BtjBƒWdtj|ƒttƒttƒtjd=XdS(NiiR
R$tctosC__import__ did not result in creation of either a .pyc or .pyo file(RtumaskR,R6R7R8RRR%tcloseRtstattS_IRUSRtS_IRGRPtS_IROTHtS_IXUSRtS_IXGRPtS_IXOTHR(texistsRR)tS_IMODEtst_modeRR(RtoldmasktfnameRtfnts((s,/usr/local/lib/python2.7/test/test_import.pyttest_execute_bit_not_copiedms(	-





cCsotjjdtjƒttjd}zt|dƒ}|jdƒWdQXtj	|ƒ}tj
||j|jdfƒtj
|dƒttƒ}|j|jdƒtj
|dƒt|dƒ}|jd	ƒWdQXttƒttƒ}|j|jd
ƒt|ƒttƒttƒ}|j|jd
ƒWdttƒttƒttƒtjd=XdS(NiR
R$sx = 'original'
iįõitoriginali€sx = 'rewritten'
t	rewritten(R,R6R7RR8RRR%twriteRAtutimetst_atimetst_mtimeRR(R)txRRRR(RRLRRNtm1tm2tm3((s,/usr/local/lib/python2.7/test/test_import.pyt&test_rewrite_pyc_with_read_only_source‹s0 





cCs}tj}tj}tƒ\tjdƒ}tjd|Œ}|jt|ƒ|j||jƒ|j||jƒWdQXdS(NR(	RR6tgetenvRR.tfind_moduletload_moduletassertIstassertIsNot(Rt	orig_pathtorig_getenvRVtnew_os((s,/usr/local/lib/python2.7/test/test_import.pyttest_imp_moduleÆs
		
tlonglistcBsÜ|ejd}e|dƒE}|jdƒx!edƒD]}|jdƒq=W|jdƒWdQXe|dƒ}ej|ƒWdQXe|ƒej	j
dƒd	|dUej	d
=e|dƒe|dƒdS(
NR
sw+sd = [
ičżs"",
t]trtsimport i’’’’R=R>(RRR%RRtranget
py_compiletcompileRR,R6tappend(RtmoduletfilenameRti((s,/usr/local/lib/python2.7/test/test_import.pyttest_module_with_large_stackĀs


cCs°ttjd}t|dƒ}|dIJWdQXtjjdtjƒzKxDdddgD]3}|jt	t
tƒ|jttjd|ƒq\WWdtjd=t
tƒXdS(	NR
R$s
a = 1 // 0iiiis'damaged module in sys.modules on %i try(RRRR%R,R6R7R8tassertRaisestZeroDivisionErrorR(tassertNotIntmodulesR(RR1RRn((s,/usr/local/lib/python2.7/test/test_import.pyttest_failing_import_sticksŻs
cCsettjd}t|dƒ}|dIJ|dIJWdQXtjjdtjƒzģttƒ}|j	ttj
ƒ|j|jddƒ|j|j
ddƒttƒt|dƒ}|d	IJ|d
IJWdQX|jttj|ƒtj
jtƒ}|j|ddƒ|j|jddƒ|j|j
ddƒWdtjd=ttƒttƒXdS(
NR
R$sa = 1sb = 2iis!module has wrong attribute valuesisa = 10s	b = 20//0s$expected module to be in sys.modulesi
(RRRR%R,R6R7R8R(tassertInRsR)R*R+RRpRqR.R/tgetR_tNoneR(RR1RR2((s,/usr/local/lib/python2.7/test/test_import.pyttest_failing_reloadīs,




cCsAtjjdtjjtƒƒzddl}Wdtjd=XdS(Nii’’’’(R,R6R7Rtdirnamet__file__tinfinite_reload(RR{((s,/usr/local/lib/python2.7/test/test_import.pyttest_infinite_reloadscCssddl}ddl}|j|||jƒ|jt|jdƒƒddlj}|j||j|jƒdS(Ni’’’’Rz(R"ttest.test_supportR^t__name__t
assertTruethasattrttest_support(RRVR"ty((s,/usr/local/lib/python2.7/test/test_import.pyttest_import_name_binding!scCs0tdtfƒ|jttdƒWdQXdS(NRgs
site-packages(Rt
ImportWarningRpRR((R((s,/usr/local/lib/python2.7/test/test_import.pyt&test_import_initless_directory_warning,scCsRtjjtƒ}|jtƒ}t|ƒWdQX|jd|jj	dƒdS(Ns$Import by filename is not supported.i(
RR6tabspathRRpRR(R)t	exceptiontargs(RR6R=((s,/usr/local/lib/python2.7/test/test_import.pyttest_import_by_filename2s
	cCsAtjdttjdƒƒ}ztj|ƒWdt|ƒXdS(NRgs›            import sys
            class C:
               def __del__(self):
                  import imp
            sys.argv.insert(0, C())
            (R	tmake_scriptRttextwraptdedenttassert_python_okR(Rttestfn((s,/usr/local/lib/python2.7/test/test_import.pyt!test_import_in_del_does_not_crash9s
cCsRtd}tj|ƒz&|jttftjtdgƒWdtj|ƒXdS(Ns.pyt.(	RRtmkdirRpRtIOErrorR.R\trmdir(RR1((s,/usr/local/lib/python2.7/test/test_import.pyttest_bug7732Gs

cCs	tjjdtjƒz×td}|tr2dnd}t|dƒ}WdQXytj|d
dfƒWngt	k
r‹|j
d	ƒnJtk
rŌ}|jt
td
dƒkr»‚n|j
dj|ƒƒnXttƒtj|ƒWdtjd=ttƒXdS(Nis.pyR=R>R$ii!is-cannot set modification time to large integert	EOVERFLOWs2cannot set modification time to large integer ({})IIū’’’IIū’’’(R,R6R7RR8Rt	__debug__R%RSt
OverflowErrortskipTestRRtgetattrRwtformatR(RAR(RR1tcompiledRte((s,/usr/local/lib/python2.7/test/test_import.pyttest_timestamp_overflowPs$



c
CsvtjjdtjƒzHd}d}x5t||ƒD]$\}}t|}|d}|trddnd}t|d	ƒ}|j	d
ƒWdQXtj
|||fƒt|ƒ}	tjj|ƒsŽt
|ƒ|jdƒnttj|ƒjƒd@}
t|d
ƒ*}tjd|jdƒdƒd}WdQXt
|ƒt
|ƒ|j|
|ƒq5WWdtjjdƒXdS(Nii¢’Ni“ļOtspamteggss.pyR=R>R$s# Just testing
x=1, 2, 3
sCouldn't create .pyc/.pyo file.I’’’’trbs<Lii(i¢’Ni“ļO(RžRŸ(R,R6R7RR8tzipRR–R%RRRSR(RHRR˜tintRARUtstructtunpacktreadR)tpop(RtmtimesttailstmtimettailRlR1R›Rtmtmtime1tmtime2((s,/usr/local/lib/python2.7/test/test_import.pyttest_pyc_mtimehs,


)

cCsņtjjtƒ}tj|ƒ|jt|ƒtjj|dƒ}tj|ƒttjj|dƒdƒ}|j	dƒWdQXttjj|dƒdƒ}|j	dƒWdQXt
jjd|ƒ|jt
jjdƒddl
}dS(	Ntsas__init__.pyR$s	import v1sv1.pys>import sys;sys.modules['sa'] = sys.modules[__name__];import saii’’’’(RR6R†RR‘t
addCleanupRtjoinR%RRR,R7R¦RÆ(Rtdir_nametpkg_dirt	init_filetv1_fileRÆ((s,/usr/local/lib/python2.7/test/test_import.pyt"test_replace_parent_in_sys_moduless

!!c	CsŒ|jtƒ}tdddgƒWdQX|jdt|jƒƒ|jtƒ}tdddgƒWdQX|jdt|jƒƒdS(Nt	encodingstfromlistualiasessmust be str, not unicodeismust be str, not int(Rpt	TypeErrorR(RutstrR‡(Rtcm((s,/usr/local/lib/python2.7/test/test_import.pyttest_fromlist_type”s(R~t
__module__RtsetUpR R#R;tunittestt
skipUnlessRRtskipIfR,R-RORZRcRoRtRxR|RƒR…R‰RR”RR®R¶R¼(((s,/usr/local/lib/python2.7/test/test_import.pyR's2		
		1#			)	
								(	tPycRewritingTestscBs›eZdZdZejjeƒZejj	eeƒej
dZeerSdndZ
d„Zd„Zd„Zd„Zd	„Zd
„Zd„ZRS(tunlikely_module_names§
import sys
code_filename = sys._getframe().f_code.co_filename
module_filename = __file__
constant = 1
def func():
    pass
func_filename = func.func_code.co_filename
R
R=R>cCs}tj|_tjj|jdƒ|_tj	|j
ƒt|jdƒ}|j
|jƒWdQXtjjd|j
ƒdS(NR$i(R,R6tsys_pathRsR¦tmodule_nameRwtorig_moduleRR‘R²R%t	file_nameRRt
module_sourceR7(RR((s,/usr/local/lib/python2.7/test/test_import.pyR¾½s
cCsj|jtj(|jdk	r2|jtj|j<n
t|jƒt|j	ƒt|j
ƒt|jƒdS(N(
RÄR,R6RĘRwRsRÅRRRĒt
compiled_nameRR²(R((s,/usr/local/lib/python2.7/test/test_import.pyRÅs



cCs*tƒ}t|j||ƒtj|jS(N(tglobalsR(RÅR,Rs(Rtns((s,/usr/local/lib/python2.7/test/test_import.pyt
import_moduleĻs	cCs¹|jƒ}|j|j|jƒ|j|j|jƒ|j|j|jƒtj|j=|jƒ}tj	s‰|j|j|j
ƒn|j|j|jƒ|j|j|jƒdS(N(RĢR)tmodule_filenameRĒt
code_filenamet
func_filenameR,RsRÅR-RÉ(RR2((s,/usr/local/lib/python2.7/test/test_import.pyttest_basicsŌs
	cCshtj|jddƒ|jƒ}|j|j|jƒ|j|j|jƒ|j|j|jƒdS(Ntdfilesanother_module.py(	RiRjRĒRĢR)RĶRÉRĪRĻ(RR2((s,/usr/local/lib/python2.7/test/test_import.pyttest_incorrect_code_nameąs
cCsxd}tj|jd|ƒtj|jƒ|jƒ}|j|j|jƒ|j|j	|ƒ|j|j
|ƒdS(Nsanother_module.pyRŃ(RiRjRĒRtremoveRĢR)RĶRÉRĪRĻ(RttargetR2((s,/usr/local/lib/python2.7/test/test_import.pyttest_module_without_sourceēscCsAtj|jƒt|jdƒ%}|jdƒ}tj|ƒ}WdQXt|j	ƒ}t
j}|jdƒ}|||<t
|ƒ|j|j|j|j|jt|ƒ|j|j|j|j|j|j|j|jƒ}t|jdƒ$}|j|ƒtj||ƒWdQX|jƒ}|j|j j|jƒdS(NR iitwb(!RiRjRĒR%RÉR„tmarshaltloadtlistt	co_constst	test_maint	func_codetindexttypetco_argcountt
co_nlocalstco_stacksizetco_flagstco_codettupletco_namestco_varnamestco_filenametco_nametco_firstlinenot	co_lnotabtco_freevarstco_cellvarsRRtdumpRĢR)tconstant(RRtheadertcodet	constantstforeign_codetposR2((s,/usr/local/lib/python2.7/test/test_import.pyttest_foreign_codešs$	

(R~R½RÅRČRR6R†RR²R±RRĒR–RÉR¾RRĢRŠRŅRÕRō(((s,/usr/local/lib/python2.7/test/test_import.pyRĀŖs	 		
					t
PathsTestscBsJeZeZd„Zd„Zd„Zd„Zej	dkrHeZ
nRS(cCs!tj|jƒtj|_dS(N(RR‘R6R,tsyspath(R((s,/usr/local/lib/python2.7/test/test_import.pyR¾scCst|jƒ|jtj(dS(N(RR6RöR,(R((s,/usr/local/lib/python2.7/test/test_import.pyRs
cCs{ttjj|jdƒdƒ}|jdƒWdQXtjj|jdƒtdƒ}|j|j	dƒt
dƒdS(Nstest_trailing_slash.pyR$s testdata = 'test_trailing_slash't/ttest_trailing_slash(R%RR6R±RRR,RkR(R)ttestdataR(RRR2((s,/usr/local/lib/python2.7/test/test_import.pyRųs$c	Cs+ttjj|jdƒdƒ}|jdƒWdQXtjj|jƒ}ddl}|jƒ}|d}d||f}||d7}ytj|ƒWnNt	k
rķ}|j
t
jt
jt
j
fkrē|jd|fƒn‚nXtjj|ƒtd	ƒ}|j|jd	ƒtd	ƒdS(
Nstest_trailing_slash.pyR$s testdata = 'test_trailing_slash'i’’’’is\\%s\%s$is%cannot access administrative share %rRų(R%RR6R±RRR†tsockettgethostnametlistdirRRtEPERMtEACCESRR˜R,RkR(R)RłR(	RRR6RśthntdrivetuncRœR2((s,/usr/local/lib/python2.7/test/test_import.pyt_test_UNC_paths$$
!twin32(R~R½RR6R¾RRųRR,R9t
test_UNC_path(((s,/usr/local/lib/python2.7/test/test_import.pyRõs					tRelativeImportTestscBs2eZd„ZeZd„Zd„Zd„ZRS(cCstdƒdS(Nstest.relimport(R(R((s,/usr/local/lib/python2.7/test/test_import.pyR6scCs*ddlm}|jt|dƒƒdS(Ni(t	relimportR(RgRRR€(RR((s,/usr/local/lib/python2.7/test/test_import.pyttest_relimport_star:scs$‡fd†}‡fd†}tddddƒ‰|ƒ|ƒtddddƒ‰|ƒ|ƒtddddƒ‰td	tfƒ|ƒWdQX|jt|ƒtddddƒ‰td	tfƒ|ƒWdQX|jt|ƒtdtƒƒ‰|jt|ƒ|jt|ƒdS(
NcsdˆUdS(Nsfrom os import path(((RĖ(s,/usr/local/lib/python2.7/test/test_import.pytcheck_absoluteAscsdˆUdS(Nsfrom . import relimport(((RĖ(s,/usr/local/lib/python2.7/test/test_import.pytcheck_relativeCst__package__R"R~stest.notarealmodulesnotarealpkg.notarealmoduletfoos.+foo(tdictRtRuntimeWarningRptSystemErrortobjectt
ValueError(RRR	((RĖs,/usr/local/lib/python2.7/test/test_import.pyttest_issue3221?s&

cCs7|jtƒ"ddlm}|jdƒWdQXdS(Ni(tseps>explicit relative import triggered an implicit absolute import(RpRRRR(RR((s,/usr/local/lib/python2.7/test/test_import.pyt#test_absolute_import_without_futureas(R~R½RR¾RRR(((s,/usr/local/lib/python2.7/test/test_import.pyR4s
			"tTestSymbolicallyLinkedPackagecBsoeZdZd„Zed„ƒZejee	dƒpIe	j
ƒd	kdƒejd„ƒƒZ
d„ZRS(
tsamplecCs²tjj|jƒr(tj|jƒntjj|jƒrPtj|jƒnt	j|_
tj|jƒtjj|jdƒ}t
|dƒjƒtj|j|jƒdS(Ns__init__.pyR$(RR6RHttaggedtshutilRtpackage_nameRtremove_symlinkR,t
orig_sys_pathR‘R±R%R@tsymlink(RR“((s,/usr/local/lib/python2.7/test/test_import.pyR¾ns
cCs|jdS(Ns-tagged(R(R((s,/usr/local/lib/python2.7/test/test_import.pyRƒstgetwindowsversioniisWindows Vista or later requiredcCsdgtj(t|jƒdS(NR(R,R6R(R(R((s,/usr/local/lib/python2.7/test/test_import.pyttest_symlinked_dir_importableˆs
cCsatjj|jƒr(tj|jƒntjj|jƒrPtj|jƒn|j	t
j(dS(N(RR6RHRRRRRRRR,(R((s,/usr/local/lib/python2.7/test/test_import.pyR”s
(ii(R~R½RR¾tpropertyRRæRĄR€R,RRtskip_unless_symlinkRR(((s,/usr/local/lib/python2.7/test/test_import.pyRks	cCsttttttƒdS(N(RRRĀRõRR(tverbose((s,/usr/local/lib/python2.7/test/test_import.pyRۜst__main__(RŪ(%RR.R×RRiR&RAR£R,RæR‹RR}RRRRRRRRR"RR	RRRtTestCaseRRĀRõRRRwRŪR~ttest.test_import(((s,/usr/local/lib/python2.7/test/test_import.pyt<module>s6:			’„[/71

Zerion Mini Shell 1.0