python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_pkgutil.cpython-311.pyc

e_[tddlmZddlmZmZddlmZddlZddlZddl	Z	ddl
mZddlZddl
Z
ddlZ
ddlZddlZddlZGddejZGdd	ejZGd
dejZGdd
ejZGddejZdZedkrejdSdS))Path)unloadCleanImport)check_warningsN)spec_from_file_locationcJeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS)PkgutilTestsctj|_|tj|jtjd|jdSNr)	tempfilemkdtempdirname
addCleanupshutilrmtreesyspathinsertselfs E/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_pkgutil.pysetUpzPkgutilTests.setUpsH'))
t|4444<(((((c tjd=dSr)rrrs rtearDownzPkgutilTests.tearDownsHQKKKrcd}d}tj|j|}tj|ttj|dd}|ttj|dd}|||tjtj|dttj|ddd}|||tj	|d}|
||tj	|d}|
||tj|=dS)Ntest_getdata_filesys%Hello, world!
Second line
Third line__init__.pywbres.txtsubsub/res.txt)
osrjoinrmkdiropenclosewritepkgutilget_dataassertEqualrmodules)rpkg
RESOURCE_DATApackage_dirfres1res2s       rrz!PkgutilTests.test_getdata_filesyssd$D
gll4<55
k=994@@				k955t<<	
				
k511222k5)<<dCC	
				Y//}---]33}---Krc:d}d}d}tj|j|}t	j|d}||dzd||dz|||dz||tj	d	|tj|d
}|||tj|d}|||g}tj
|gD]<}	||	tj||	j=||dgtjd	=tj|=dS)Ntest_getdata_zipfile.ziptest_getdata_zipfilerw/__init__.py/res.txtz/sub/res.txtrr!r#)r$rr%rzipfileZipFilewritestrr(rrr*r+r,iter_modulesassertIsInstance
ModuleInfoappendnamer-)
rzipr.r/zip_filezr2r3names
moduleinfos
          rr6z!PkgutilTests.test_getdata_zipfile<s($D
7<<c22OHc**	


3',,,	

3#]333	

3'777					8$$$Y//}---]33}---!.z::	*	*J!!*g.@AAALL))))!7 8999HQKKrcd}d}d}tj|j|}t	j|d}||dzd||dz||tj	d|	tj|d	}|||g}tj
t|gD]<}||tj||j=|||gtjd=tj|dn2#tjd=tj|dwxYwd
}	|t,|	5t/tj
dddddS#1swxYwYdS)Nr5r6rr7r8r9r:rr!z9path must be None or list of paths to look for modules ininvalid_path)r$rr%rr;r<r=r(rrr*r+r,r>rr?r@rArBr-popassertRaisesRegex
ValueErrorlist)
rrCr.r/rDrEresrFrGexpected_msgs
          rtest_issue44061_iter_modulesz)PkgutilTests.test_issue44061_iter_modules_s($D
7<<c22OHc**	


3',,,	

3#]333					8$$$	'"3	22CS-000E%2DNN3CDD
.
.
%%j'2DEEEZ_----USE***KOOC&&&&KOOC&&&&S

#
#J
=
=	7	7%n55666	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7s(B#E99/F("G77G;>G;c$d}tj|j|}tj|d|tj|tj|jgD]}|	ddS)Nunreadable_packager)rzunexpected package found)
r$rr%rr&rrmdirr*
walk_packagesfail)rpackage_namedts    rtest_unreadable_dir_on_syspathz+PkgutilTests.test_unreadable_dir_on_syspaths+GLL|44	A!$$$&T\N;;;	2	2AII01111	2	2rcd}tj|j|}tj|ttj|dd}|tjtj|dttj|ddd}|ttj|ddd}|d}tj|j|}tj|ttj|dd}|tjtj|dttj|ddd}|ttj|ddd}|gd}dtj|jgD}|	|||D]%}|
drtj|=&dS)	Ntest_walkpackages_filesysrr r"zmod.py)r"zsub.test_walkpackages_filesysz!sub.test_walkpackages_filesys.modr[ztest_walkpackages_filesys.subz!test_walkpackages_filesys.sub.modcg|]
}|dS.0es  r
<listcomp>z:PkgutilTests.test_walkpackages_filesys.<locals>.<listcomp>sEEE!1EEErmod)
r$rr%rr&r'r(r*rTr,endswithrr-)	rpkg1pkg1_dirr1pkg2pkg2_direxpectedactualr.s	         rr[z&PkgutilTests.test_walkpackages_filesyss:*7<<d33
h
66==				
h..///h}==tDD				hx88$??				7<<d33
h
66==				
h(CDDEEEh(C]SSUYZZ				h(CXNNPTUU				


FEw4dl^DDEEE***	!	!C||E""
C  	!	!rc&d}d}d}tj|j|}t	j|d}||dzd||dz|zdzd||dz|zdzd||dzd||dz|zdzd||dz|zdzd|tj	d	|gd
}dtj|gD}|||tjd	=|D]%}|
drtj|=&d
S)zBTests the same as test_walkpackages_filesys, only with a zip file.ztest_walkpackages_zipfile.ziptest_walkpackages_zipfiler"r7r8r9/z/mod.pyr)r"zsub.test_walkpackages_zipfilez!sub.test_walkpackages_zipfile.modrmztest_walkpackages_zipfile.subz!test_walkpackages_zipfile.sub.modcg|]
}|dSr]r_r`s  rrcz:PkgutilTests.test_walkpackages_zipfile.<locals>.<listcomp>sAAA!1AAArrdN)r$rr%rr;r<r=r(rrr*rTr,rer-)	rrCrfrhrDrErjrkr.s	         rrmz&PkgutilTests.test_walkpackages_zipfiles.*7<<c22OHc**	

4.("---	

4#:$~5r:::	

4#:$y0"555	

4.("---	

4#:$~5r:::	

4#:$y0"555				8$$$


BAw4hZ@@AAA***HQK	!	!C||E""
C  	!	!rcxd}|ttf5tt	j|dddn#1swxYwYd}|ttf5tt	j|ddddS#1swxYwYdS)Ntest_dirstest_dir)assertRaises	TypeErrorrLrMr*rT)r	str_inputbytes_inputs   r2test_walk_packages_raises_on_string_or_bytes_inputz?PkgutilTests.test_walk_packages_raises_on_string_or_bytes_inputs+	


	:6
7
7	3	3&y11222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3"


	:6
7
7	5	5&{33444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5s#"AAA"B//B36B3cddl}ddl}dtfdtjfdtjjfd|fd|fd|jfd|jfd	|jjfd
|jjfd|jjjfd|jjjfd
tfdtfdtj	fdtj	fdtfdtfdtjff}dtfdtfdtfdtfdtfdtfdtfdtfdtfdtfdtfdtfdtfd tfd!tfd"tfd#tff}d$}|D]}tj|j|}	tj|d%n#t$$rYLwxYwtj|d&}t'|d'5}|d|dddn#1swxYwYt-jt-j|}|||ffz
}t3|dkr||dd(tffz
}|d)tffz
}|D]]\}	}
||	*5t7j|	}|||
dddn#1swxYwY^|D]t\}	}||	*5||5t7j|	dddn#1swxYwYdddn#1swxYwYudS)+Nrr$zos.pathzos.path:pathseploggingzlogging:zlogging.handlerszlogging.handlers:zlogging.handlers:SysLogHandlerzlogging.handlers.SysLogHandlerz(logging.handlers:SysLogHandler.LOG_ALERTz(logging.handlers.SysLogHandler.LOG_ALERTzbuiltins.intzbuiltins:intzbuiltins.int.from_byteszbuiltins:int.from_byteszbuiltins.ZeroDivisionErrorzbuiltins:ZeroDivisionErrorzos:pathr^g@Tr9z?abczabc/foofoozos.foozos.foo:zos.pth:pathsepzlogging.handlers:NoSuchHandlerz,logging.handlers:SysLogHandler.NO_SUCH_VALUEz,logging.handlers.SysLogHandler.NO_SUCH_VALUEZeroDivisionErrorzos.path.9abc9abc)	u	वमसéÈu안녕하세요uさよならuありがとうuХорошоuспасибоu现代汉语常用字表exist_okrr7u०वमस)s)rxlogging.handlersr$rpathsephandlers
SysLogHandler	LOG_ALERTint
from_bytesrzrsrLImportErrorAttributeErrorr%rmakedirsUnicodeEncodeErrorr'r)flush	importlibinvalidate_caches
import_modulelensubTestr*resolve_namer,rr)
rrx
success_cases
failure_cases
unicode_wordsuwrWr1rdrrjoexcs
             rtest_name_resolutionz!PkgutilTests.test_name_resolutions2J
 
0
 
!
!12
 '"23
-w/?/MN
-w/?/MN
7 .8
:
7 .8
:
S!
S!
&7
&7
)+<=
)+<=
 )

09
	N
)
9

Z 

#
K 
~&
$
{+
-~>
;^L
;^L
 +.
Z(
Z #

,M
 	9	9BT\2..A
A-----&



Q
..Aa
			
















'))))"--Cb#YZ'M2ww{{"SbS';!7!88
	4jABB
(	.	.KAx""
.
.(++  H---
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.$	,	,FAs""
,
,&&s++,,(+++,,,,,,,,,,,,,,,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,	,	,slF
F('F(*HH	H	+KK	K	?M
L6*M
6L::M
=L:>M

M	M	N)
__name__
__module____qualname__rrrr6rPrYr[rmrvrr_rrr	r	s)))
:!!!F%7%7%7N	2	2	2&!&!&!P!!!!!!F555Y,Y,Y,Y,Y,rr	c^eZdZGddeZGddeZdZdZdZdZ	d	S)
PkgutilPEP302Testsc eZdZdZdZdZdS)PkgutilPEP302Tests.MyTestLoadercdSNr_)rspecs  r
create_modulez-PkgutilPEP302Tests.MyTestLoader.create_moduleEs4rcR|jdddz|jd<dS)Nloadsrr^)__dict__get)rrds  rexec_modulez+PkgutilPEP302Tests.MyTestLoader.exec_moduleHs+$'L$4$4Wa$@$@1$DCL!!!rcdS)N
Hello, world!r_)rrs  rr+z(PkgutilPEP302Tests.MyTestLoader.get_dataLs"?rN)rrrrrr+r_rrMyTestLoaderrDsD				E	E	E	#	#	#	#	#rrceZdZddZdS)!PkgutilPEP302Tests.MyTestImporterNctt}t|d|jjz|gS)Nz<%s>)loadersubmodule_search_locations)rrr	__class__r)rfullnamertargetrs     r	find_specz+PkgutilPEP302Tests.MyTestImporter.find_specPsD'4466F*8+1F4D4M+M28FHJJJ
Jr)NN)rrrrr_rrMyTestImporterrOs.	J	J	J	J	J	Jrrcjtjd|dSr)r	meta_pathrrrs rrzPkgutilPEP302Tests.setUpWs,
Q 3 3 5 566666rc tjd=dSr)rrrs rrzPkgutilPEP302Tests.tearDownZsM!rcr|tjdddtjd=dS)Nrydummyr)r,r*r+rr-rs rtest_getdata_pep302z&PkgutilPEP302Tests.test_getdata_pep302]s5)%99?KKKKrcddl}||jd|tjddd||jdt
jd=dS)Nrr^ryrr)ryr,rr*r+rr-)rrys  rtest_alreadyloadedz%PkgutilPEP302Tests.test_alreadyloadedbsp	


A&&&)%99?KKKA&&&KrN)
rrrobjectrrrrrrr_rrrrBs	#	#	#	#	#v	#	#	#JJJJJJJJ777
rrc,eZdZdZdZdZdZdZdS)ExtendPathTestsctj}tjd|t
j||}tj|tt
j|dd5}|	ddddn#1swxYwY|S)Nrrr7zKfrom pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
)
rr
rrrr$r%r&r'r))rpkgnamerpkgdirfls     rcreate_initzExtendPathTests.create_initps"$$7###gw//

"',,v}55s
;
;	frHHdeee	f	f	f	f	f	f	f	f	f	f	f	f	f	f	fsB88B<?B<ctj|||dz}t|d5}t	d||ddddS#1swxYwYdS)N.pyr7zvalue={})file)r$rr%r'printformat)rrrsubmodule_namevaluemodule_namers       rcreate_submodulez ExtendPathTests.create_submodule{sgll7G^e5KLL
+s
#
#	5r*##E**4444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5s%A''A+.A+c
d}||}||}|||dd|||ddddl}ddl}||jjd||jjd|t|j	ttj||tj||gtj|tj|tjd=tjd=tjd=tjd=tjd=dS)Nrybarrbazr^foo.barfoo.baz)rrfoo.barfoo.bazr,rrrsorted__path__r$rr%rrrr-rr	dirname_0	dirname_1rys     rtest_simplezExtendPathTests.test_simplesb$$W--	$$W--	i%;;;i%;;;******	
--i!A!A!#i!A!A!CDD	E	E	E
	
i   
i   HQKHQKKK	"K	"""rctj}tj}d}d}||}tj||}d||}tj	
|dtj	
|d	||||dtj
|t||}||}	|D]}
tj|
|}|j}	|j}n#t"$rYnwxYw||
tjj||
|	||tjj|tj|
||t25t|ddddn#1swxYwY|t25t|ddddn#1swxYwYt5j|tjd=	tj	d=tj	d=dS#t8$rYdSwxYw#t5j|tjd=	tj	d=tj	d=w#t8$rYwwxYwxYw)Nspameggsz{}.{}rzinvalid.modulez.spamz	spam.eggs)r*iter_importersget_importerrr$rr%rrr-rJrrrrM	_get_specrrr?	machinery
FileFinderr,SourceFileLoaderassertIsNonerrrrrKeyError)
rrrrmodnamerpathitemr	importersexpected_importerfinderrrs
             rtest_iter_importersz#ExtendPathTests.test_iter_importersso /+""7++7<<11>>'733$'''&&&"	!!'7GQ???#H---^^H5566I ,X 6 6#

F

F(::#]FF%D%%fi.A.LMMM  ):;;;%%f&/&9&JLLL!!'"3FG"D"DEEEE"";//
7
7^^$455666
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7"";//
.
.^^G,,---
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
M'"""
K'K,,,




M'"""
K'K,,



s)A/JD! J!
D.+J-D..B&JG9-J9G==JG=JI7JIJ
IJ0J
JJ"K+KK+
K(%K+'K((K+c
ld}||}||}|||ddtjtj||d|||ddddl}ddl}||j	j
d||jj
d|t|j
ttj||tj||gtj|tj|t jd=t jd=t jd=t jd=t jd=dS)	Nryrrrrr^rr)rrr$unlinkrr%rrr,rrrrrrrrr-rs     rtest_mixed_namespacez$ExtendPathTests.test_mixed_namespaces$$W--	$$W--	i%;;;
	"',,y'=AABBBi%;;;******	
--i!A!A!#i!A!A!CDD	E	E	E
	
i   
i   HQKHQKKK	"K	"""rN)rrrrrrrrr_rrrros`			555
###:---`#####rrc&eZdZdZdZdZdZdS)NestedNamespacePackageTestchtj|_tjdd|_dSr)rr
basedirrrold_pathrs rrz NestedNamespacePackageTest.setUps''))


rcd|jtjdd<tj|jdSr)rrrrrrrs rrz#NestedNamespacePackageTest.tearDowns+m
dl#####rc|dd\}}tj|j|dtjj}tj|dttj||dzd5}|	|ddddS#1swxYwYdS)N.r^Tr~rr7)
rsplitr$rr%rreplaceseprr'r))rrBcontentsbasefinal	base_pathr1s       rrz(NestedNamespacePackageTest.create_moduleskk#q))eGLLt||C/M/MNN	
I----
"',,y%%-88#
>
>	!
GGH																		s)CCCcd}|d||d||d||d||dd|dd	tjd
tj|jdtjd
tj|jdd
dl}|td
|
t|jdd
dl
}|td|
t|jjdd
dlm}d
dlm}|
|d|
|ddS)NzBimport pkgutil; __path__ = pkgutil.extend_path(__path__, __name__)za.pkg.__init__zb.pkg.__init__za.pkg.subpkg.__init__zb.pkg.subpkg.__init__za.pkg.subpkg.czc = 1zb.pkg.subpkg.dzd = 2rabr.z
pkg.subpkg)c)rWr^)rrrrr$r%rr.rrr,rr
pkg.subpkgsubpkgpkg.subpkg.crpkg.subpkg.drW)rpkgutil_boilerplater.rrWs     rtest_nestedz&NestedNamespacePackageTest.test_nesteds
A		
+-@AAA+-@AAA24GHHH24GHHH+W555+W55527<<c::;;;27<<c::;;;


&&&S\**A...---SZ0111555""""""""""""AArN)rrrrrrrr_rrrrsP$$$$$$rrceZdZdZdZdZdZejedkddZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdS)ImportlibMigrationTestsc.tdtfS)Nz[This emulation is deprecated and slated for removal in Python 3.12; use 'importlib' instead)rDeprecationWarningrs rcheck_deprecatedz(ImportlibMigrationTests.check_deprecateds!4

!""	"rc|5tjdddddS#1swxYwYdSNr9)rr*ImpImporterrs rtest_importer_deprecatedz0ImportlibMigrationTests.test_importer_deprecated s

"
"
$
$	$	$###	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$s7;;c|5tjddddddddS#1swxYwYdSr)rr*	ImpLoaderrs rtest_loader_deprecatedz.ImportlibMigrationTests.test_loader_deprecated$s

"
"
$
$	.	.b"b"---	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.s
:>>ct5}|tjd|tjd|tjd|t|jdddddS#1swxYwYdSNrr$ztest.supportr)rassertIsNotNoner*
get_loaderr,rwarningsrr7s  r test_get_loader_avoids_emulationz8ImportlibMigrationTests.test_get_loader_avoids_emulation(s


	1  !3E!:!:;;;  !3D!9!9:::  !3N!C!CDDDS__a000		1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1BB::B>B>__main__znot compatible with __main__ct}b	t5}|tjt
|t|jddddn#1swxYwY|adS#|awxYwr)	
__loader__rrr*rrr,rr)rthis_loaderr7s   r0test_get_loader_handles_missing_loader_attributezHImportlibMigrationTests.test_get_loader_handles_missing_loader_attribute/s!	%!!
5Q$$W%7%A%ABBB  QZ!444
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5%JJJJ$$$$s/BAA9-B9A==BA=BBcd}tt|}|`t|5|tj|<tj|}dddn#1swxYwY||dSNrtyper__spec__rr-r*rrrrBrdrs    r.test_get_loader_handles_missing_spec_attributezFImportlibMigrationTests.test_get_loader_handles_missing_spec_attribute;sd3iiooL


	.	. #CK'--F	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	
&!!!!!s$A!!A%(A%cd}tt|}d|_t|5|tj|<tj|}dddn#1swxYwY||dSr&r'r*s    r+test_get_loader_handles_spec_attribute_nonezCImportlibMigrationTests.test_get_loader_handles_spec_attribute_noneDsd3iioo


	.	. #CK'--F	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	
&!!!!!s$A&&A*-A*cd}dtj|<	tj|}tj|=n#tj|=wxYw||dSNz
totally bogus)rr-r*rrrrBrs   r#test_get_loader_None_in_sys_modulesz;ImportlibMigrationTests.test_get_loader_None_in_sys_modulesMse D	"'--FD!!D!!!!!&!!!!!s	5Ac\d}tj|}||dSr/)r*find_loaderrr0s   rtest_find_loader_missing_modulez7ImportlibMigrationTests.test_find_loader_missing_moduleVs1$T**&!!!!!rct5}|tjd|tjd|tjd|t|jdddddS#1swxYwYdSr)rrr*r3r,rrrs  r!test_find_loader_avoids_emulationz9ImportlibMigrationTests.test_find_loader_avoids_emulation[s


	1  !4U!;!;<<<  !4T!:!:;;;  !4^!D!DEEES__a000		1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1rct5}|tjd|t|jdddddS#1swxYwYdS)Nz*??r)rrr*rr,rrrs  r"test_get_importer_avoids_emulationz:ImportlibMigrationTests.test_get_importer_avoids_emulationbs


	1g2599:::S__a000	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1sAA,,A03A0c	tjtddS#t$r|dYdSwxYw)Nz/homez3Unexpected AttributeError when calling get_importer)r*rrrrUrs rtest_issue44061z'ImportlibMigrationTests.test_issue44061hs`	M g/////	M	M	MIIKLLLLLL	Ms!%AAct5}tjD]}|t	|jdddddS#1swxYwYdSr)rr*rr,rr)rr7importers   r$test_iter_importers_avoids_emulationz<ImportlibMigrationTests.test_iter_importers_avoids_emulationns


	1#244::S__a000	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1s?AA"AN)rrrrrrrunittestskipIfr$r+r-r1r4r6r8r:r=r_rrr
r
s
"""$$$...111X_X+-KLL	%	%ML	%""""""""""""
111111MMM11111rr
cfddl}ddl}|j|jdSr)	zipimportr_zip_directory_cacheclearr)rArs  rtearDownModulerDtsF
"((***I!!!!!rr )pathlibrtest.support.import_helperrrtest.support.warnings_helperrr>rrimportlib.utilrr*r$os.pathrrr;TestCaser	rrrr
rDrmainr_rr<module>rLs::::::::777777



222222				



j,j,j,j,j,8$j,j,j,Z	(((((*(((Zx#x#x#x#x#h'x#x#x#z&&&&&!2&&&R\1\1\1\1\1h/\1\1\1~"""zHMOOOOOr