ó
    ×›‘hhG  ã                  óh  • S r SSKJr  SSKrSSKrSSKrSSKrSSKJr  SSK	J
r
  SSKJrJr  SSKJr  SSKrSSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr   " S S\5      r " S S\\5      r  " S S\ 5      r! " S S\ 5      r" " S S\"5      r# " S S\"5      r$ " S S\5      r%/ SQr&g)zV
Tests for twisted.python.modules, abstract access to imported or importable
objects.
é    )ÚannotationsN)ÚPathEntryFinder)Ú
ModuleType)ÚAnyÚ	Generator)ÚProtocol)Úmodules)ÚnetworkString)ÚFilePath)ÚnamedAny)ÚTwistedModulesMixin)Úzipit)ÚTestCasec                  ó&   • \ rS rSr    SS jrSrg)Ú_SupportsWalkModulesé   c                ó   • g ©N© )ÚselfÚimportPackagess     Ú]C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/test/test_modules.pyÚwalkModulesÚ _SupportsWalkModules.walkModules   s   € ð 	ó    r   N)r   ÚboolÚreturnz+Generator[modules.PythonModule, None, None])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__r   r   r   r   r      s   † ðØ"ðà	4÷r   r   c                  ó8   • \ rS rSrSr\S4       SS jjrSrg)ÚTwistedModulesTestCaseé%   z'
Base class for L{modules} test cases.
Fc                ó„   • UR                  US9 H  nUR                  U:X  d  M  Us  $    U R                  SU< S35        g)zÏ
You don't ever actually want to do this, so it's not in the public
API, but sometimes we want to compare the result of an iterative call
with a lookup call and make sure they're the same for test purposes.
©r   zUnable to find module z through iteration.N)r   ÚnameÚfail)r   ÚmodnameÚwherer   Úmodinfos        r   ÚfindByIterationÚ&TwistedModulesTestCase.findByIteration*   sG   € ð ×(Ñ(¸Ð(ÓGˆGØ�|‰|˜wÕ&Ø’ñ Hð 	�	‰	Ð*¨7©+Ð5HÐIÕJr   r   N)r*   Ústrr+   r   r   r   r   zmodules.PythonModule)r   r   r    r!   Ú__doc__r	   r-   r"   r   r   r   r$   r$   %   sE   † ñð '.Ø$ð	KàðKð $ðKð ð	Kð
 
÷Kð Kr   r$   c                  óŒ   • \ rS rSrSS jrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSS jrSrg)Ú
BasicTestsé;   c                ó  • [        S5        SnU R                  5       nUR                  S5      nUR                  S5      R                  U5        UR                  S5      nUR	                  5         UR                  S5      R                  U5        UR                  S5      R                  S5        U R                  5       nUR                  S5      nUR                  S5      R                  U5        UR                  S5      nUR	                  5         UR                  S5      R                  U5        UR                  S5      R                  S5        U R                  UR                  UR                  /5        [        R                  " S5      n UR                  S	S
9 V	s/ s H  o™R                  PM     n
n	[        [        R                  R                  5       5       H,  nUR                  S5      (       d  M  [        R                  U	 M.     / SQnU R                  X«5        gs  sn	f ! [        [        R                  R                  5       5       H,  nUR                  S5      (       d  M  [        R                  U	 M.     f = f)zL
Duplicate packages are not yielded when iterating over namespace
packages.
ÚpkgutilsB   import pkgutil; __path__ = pkgutil.extend_path(__path__, __name__)Útest_packageú__init__.pyÚnested_packagez	module.pyr   z
module2.pyTr'   )r6   ztest_package.nested_packagez"test_package.nested_package.modulez#test_package.nested_package.module2N)Ú
__import__ÚpathEntryWithOnePackageÚchildÚ
setContentÚmakedirsÚreplaceSysPathÚpathr	   Ú	getModuler   r(   ÚlistÚsysÚkeysÚ
startswithÚassertEqual)r   ÚnamespaceBoilerplateÚentryÚtestPackagePathÚnestedEntryÚanotherEntryÚanotherPackagePathÚanotherNestedEntryÚmoduleÚmodÚwalkedNamesÚexpecteds               r   Útest_namespacedPackagesÚ"BasicTests.test_namespacedPackages<   s  € ô 	�9Ôð Vð 	ð2 ×,Ñ,Ó.ˆØŸ+™+ nÓ5ˆØ×Ñ˜mÓ,×7Ñ7Ð8LÔMà%×+Ñ+Ð,<Ó=ˆØ×ÑÔØ×Ñ˜-Ó(×3Ñ3Ð4HÔIØ×Ñ˜+Ó&×1Ñ1°#Ô6à×3Ñ3Ó5ˆØ)×/Ñ/°Ó?ÐØ× Ñ  Ó/×:Ñ:Ð;OÔPà/×5Ñ5Ð6FÓGÐØ×#Ñ#Ô%Ø× Ñ  Ó/×:Ñ:Ð;OÔPØ× Ñ  Ó.×9Ñ9¸#Ô>à×Ñ˜UŸZ™Z¨×):Ñ):Ð;Ô<ä×"Ò" >Ó2ˆð
	,Ø/5×/AÑ/AÐQUÐ/AÑ/VÓWÒ/V¨Ÿ8œ8Ñ/VˆKÐWäœsŸ{™{×/Ñ/Ó1Ö2�Ø×$Ñ$ ^×4Ó4ÜŸ™ FÒ+ñ 3ò
ˆð 	×Ñ˜Õ/ùò XøäœsŸ{™{×/Ñ/Ó1Ö2�Ø×$Ñ$ ^×4Ó4ÜŸ™ FÒ+ò 3ús$   ÆH* Æ!H%Æ6H* È%H* È*?JÉ-Jc                óê   • / n[         R                  " U R                  5       R                  /UR                  0 0 SS0S9nU R                  U/ 5        U R                  US   R                  5       5        g)zì
If a package has been explicitly forbidden from importing by setting a
L{None} key in sys.modules under its name,
L{modules.PythonPath.__getitem__} should still be able to retrieve an
unloaded L{modules.PythonModule} for that package.
r6   N)ÚsysPathÚmoduleLoaderÚimporterCacheÚsysPathHooksÚ
moduleDict)r	   Ú
PythonPathr:   r?   ÚappendrE   ÚassertFalseÚisLoaded)r   ÚshouldNotLoadr?   s      r   Útest_unimportablePackageGetItemÚ*BasicTests.test_unimportablePackageGetItemˆ   ss   € ð $&ˆÜ×!Ò!Ø×1Ñ1Ó3×8Ñ8Ð9Ø&×-Ñ-ØØØ&¨Ð-ñ
ˆð 	×Ñ˜¨Ô+Ø×Ñ˜˜nÑ-×6Ñ6Ó8Õ9r   c                óf  • U R                  5       nU R                  UR                  /5        U R                  SS05        [	        [
        R                  " 5       5      nU R                  U Vs/ s H  o3R                  PM     snS/5        U R                  US   R                  5       5        gs  snf )zá
If a package has been explicitly forbidden from importing by setting a
L{None} key in sys.modules under its name, L{modules.walkModules} should
still be able to retrieve an unloaded L{modules.PythonModule} for that
package.
r6   Nr   )r:   r>   r?   ÚreplaceSysModulesrA   r	   r   rE   r(   r[   r\   )r   ÚexistentPathÚwalkedÚms       r   Ú#test_unimportablePackageWalkModulesÚ.BasicTests.test_unimportablePackageWalkModulesš   s“   € ð ×3Ñ3Ó5ˆØ×Ñ˜\×.Ñ.Ð/Ô0Ø×Ñ °Ð5Ô6ä”g×)Ò)Ó+Ó,ˆØ×Ñ©&Ó1ª& QŸ&œ&©&Ñ1°NÐ3CÔDØ×Ñ˜ ™×+Ñ+Ó-Õ.ùò 2s   Á-B.c                ó  • U R                  5       n[        U R                  5       5      nU R                  UR	                  5       5        U R                  UR                  /5        [        R                  " S5      /n[        [        R                  " 5       5      n[        R                  R                  UR                  5        [        [        R                  " 5       5      nU R                  XC5        U R                  XS5        g)zf
Verify that L{modules.walkModules} ignores entries in sys.path which
do not exist in the filesystem.
r6   N)r:   r   Úmktempr[   Úexistsr>   r?   r	   r@   rA   r   rB   rZ   rE   )r   rb   ÚnonexistentPathrP   ÚbeforeModulesÚafterModuless         r   Útest_nonexistentPathsÚ BasicTests.test_nonexistentPaths©   s»   € ð
 ×3Ñ3Ó5ˆä" 4§;¡;£=Ó1ˆØ×Ñ˜×/Ñ/Ó1Ô2à×Ñ˜\×.Ñ.Ð/Ô0ä×%Ò% nÓ5Ð6ˆäœW×0Ò0Ó2Ó3ˆÜ�‰�‰˜×,Ñ,Ô-ÜœG×/Ò/Ó1Ó2ˆà×Ñ˜Ô1Ø×Ñ˜Õ0r   c                óÚ  • U R                  5       n[        U R                  5       5      nU R                  UR	                  5       5        UR                  S5        U R                  UR                  /5        [        [        R                  " 5       5      n[        R                  R                  UR                  5        [        [        R                  " 5       5      nU R                  X45        g)zp
Verify that L{modules.walkModules} ignores entries in sys.path which
refer to regular files in the filesystem.
s   zip file or whatever
N)r:   r   rh   r[   ri   r<   r>   r?   rA   r	   r   rB   rZ   rE   )r   rb   ÚnonDirectoryPathrk   rl   s        r   Útest_nonDirectoryPathsÚ!BasicTests.test_nonDirectoryPaths¾   s¬   € ð
 ×3Ñ3Ó5ˆä# D§K¡K£MÓ2ÐØ×ÑÐ)×0Ñ0Ó2Ô3Ø×#Ñ#Ð$=Ô>à×Ñ˜\×.Ñ.Ð/Ô0äœW×0Ò0Ó2Ó3ˆÜ�‰�‰Ð(×-Ñ-Ô.ÜœG×/Ò/Ó1Ó2ˆà×Ñ˜Õ5r   c                ón   • U R                  [        R                  " S5      U R                  S5      5        g)zË
Scrounge around in the top-level module namespace and make sure that
Twisted shows up, and that the module thusly obtained is the same as
the module that we find when we look for it explicitly by name.
ÚtwistedN©rE   r	   r@   r-   ©r   s    r   Útest_twistedShowsUpÚBasicTests.test_twistedShowsUpÑ   s*   € ð 	×Ñœ×*Ò*¨9Ó5°t×7KÑ7KÈIÓ7VÕWr   c           	     ó”   • U R                  [        R                  " S5      U R                  S[        R                  " S5      S95        g)zW
Verify that the walkModules APIs will give us back subpackages, not just
subpackages.
útwisted.pythonrt   )r+   Nru   rv   s    r   Útest_dottedNamesÚBasicTests.test_dottedNamesÙ   s@   € ð
 	×ÑÜ×ÒÐ.Ó/Ø× Ñ Ð!1¼×9JÒ9JÈ9Ó9UÐ ÐVõ	
r   c                ó”   • [         R                  " 5        H/  nU R                  SUR                  ;   SUR                  -  5        M1     g)zq
Verify that the iterModules API will only return top-level modules and
packages, not submodules or subpackages.
Ú.z9no nested modules should be returned from iterModules: %rN)r	   ÚiterModulesr[   r(   ÚfilePath)r   rM   s     r   Útest_onlyTopModulesÚBasicTests.test_onlyTopModulesã   s@   € ô
 ×)Ò)Ö+ˆFØ×ÑØ�v—{‘{Ñ"ØKØ—?‘?ñ$öò ,r   c                óò   • S Hq  n[        U5      nU R                  [        R                  " U5      R	                  5       U5        U R                  U R                  U5      R	                  5       U5        Ms     g)zT
Verify that we can locate and load packages, modules, submodules, and
subpackages.
©Úosrt   rz   ztwisted.python.reflectN)r   ÚfailUnlessIdenticalr	   r@   Úloadr-   )r   Únrd   s      r   Útest_loadPackagesAndModulesÚ&BasicTests.test_loadPackagesAndModulesï   sa   € ó
 OˆAÜ˜“ˆAØ×$Ñ$¤W×%6Ò%6°qÓ%9×%>Ñ%>Ó%@À!ÔDØ×$Ñ$ T×%9Ñ%9¸!Ó%<×%AÑ%AÓ%CÀQÖGò Or   c                óº   • S HU  nU R                  [        R                  " U5      R                  R                  R
                  [        R
                  5        MW     g)z]
Verify that path entries discovered via module loading are, in fact, on
sys.path somewhere.
r„   N)ÚfailUnlessInr	   r@   Ú	pathEntryr€   r?   rB   )r   rˆ   s     r   Útest_pathEntriesOnPathÚ!BasicTests.test_pathEntriesOnPathù   sA   € ó
 OˆAØ×Ñœg×/Ò/°Ó2×<Ñ<×EÑE×JÑJÌCÏHÉHÖUò Or   c                ó  ^• [        U R                  5       5      nUR                  5         [        R                  " UR
                  /S9nUR                  mS
U4S jjnUR                  S5      R                  S5        [        R                  " UR
                  SS9  U R                  [        [        UR                  5       5      5      S5        X2l        U R                  US   R                  UR                  S5      5        g	)zf
Verify that .py files will always be preferred to .pyc files, regardless of
directory listing order.
©rT   c                óN   >^• T" U 5      nUR                   mSU4S jjnX!l         U$ )Nc                 óh   >• [        T" 5       5      n U R                  5         U R                  5         U $ r   )rA   ÚsortÚreverse)ÚxÚoriginalChildrens    €r   ÚevilChildrenÚLBasicTests.test_alwaysPreferPy.<locals>._evilSmartPath.<locals>.evilChildren  s*   ø€ ô Ñ)Ó+Ó,�Ø—‘”Ø—	‘	”Ø�r   )r   r   )Úchildren)ÚpathNameÚor˜   r—   ÚoriginalSmartPaths      @€r   Ú_evilSmartPathÚ6BasicTests.test_alwaysPreferPy.<locals>._evilSmartPath  s(   ù€ Ù! (Ó+ˆAØ Ÿz™zÐ÷ð &ŒJØˆHr   zabcd.pyó   
T)Úquieté   ÚabcdN)r›   r/   r   r   )r   rh   ÚcreateDirectoryr	   rY   r?   Ú
_smartPathr;   r<   Ú
compileallÚcompile_dirrE   ÚlenrA   rš   r€   )r   ÚmypathÚpprž   r�   s       @r   Útest_alwaysPreferPyÚBasicTests.test_alwaysPreferPy  s¼   ø€ ô
 ˜$Ÿ+™+›-Ó(ˆØ×ÑÔ Ü×Ò¨¯©¨Ñ6ˆØŸM™MÐ÷	ð 	�‰�YÓ×*Ñ*¨5Ô1Ü×Ò˜vŸ{™{°$Ò7à×ÑœœT &§/¡/Ó"3Ó4Ó5°qÔ9Ø&ŒØ×Ñ˜˜F™×,Ñ,¨f¯l©l¸9Ó.EÕFr   c                ó  • [        U R                  5       5      nUR                  5         [        R                  " UR
                  /S9nUR                  S5      nUR                  5         UR                  S5      R                  S5        [        R
                  R                  UR
                  5        [        S5         [        UR                  5       5      nU R                  [        U5      S5        U R                  US   R                  S5        [        R                  S	 [        R
                  R!                  UR
                  5        g! [        R                  S	 [        R
                  R!                  UR
                  5        f = f)zk
A package can delete its __path__ for some reasons,
C{modules.PythonPath} should be able to deal with it.
r‘   r£   r7   s   del __path__
é   r   N)r   rh   r¤   r	   rY   r?   r;   r<   rB   rZ   r9   rA   r   rE   r¨   r(   Úremove)r   r©   rª   ÚsubpathÚls        r   Útest_packageMissingPathÚ"BasicTests.test_packageMissingPath!  s
  € ô
 ˜$Ÿ+™+›-Ó(ˆØ×ÑÔ Ü×Ò¨¯©¨Ñ6ˆØ—,‘,˜vÓ&ˆØ×ÑÔ!Ø�‰�mÓ$×/Ñ/Ð0AÔBÜ�‰�‰˜Ÿ™Ô$Ü�6Ôð	)Ü�R—^‘^Ó%Ó&ˆAØ×ÑœS ›V QÔ'Ø×Ñ˜Q˜q™TŸY™Y¨Ô/ä—‘˜FÐ#Ü�H‰H�O‰O˜FŸK™KÕ(øô —‘˜FÐ#Ü�H‰H�O‰O˜FŸK™KÕ(ús   Â?AE Å<F	r   N©r   ÚNone)r   r   r    r!   rQ   r^   re   rm   rq   rw   r{   r�   r‰   rŽ   r«   r²   r"   r   r   r   r2   r2   ;   sE   † ôJ0ôX:ô$/ô1ô*6ô&Xô
ô
ôHôVôG÷@)r   r2   c                  óŽ   • \ rS rSrSr\R                  " 5       rSS jrSS jr	SSS jjr
SS jrSS jrSS jrSS	 jrSS
 jrSrg)ÚPathModificationTestsi7  zd
These tests share setup/cleanup behavior of creating a dummy package and
stuffing some code in it.
c                ó¸  • U R                  5       U l        [        U R                  5      U l        U R                  R	                  5         S[        U R                  5      4-  U l        U R                  R                  U R                  5      U l	        U R                  R	                  5         U R                  R                  S5      R                  S5        U R                  R                  S5      R                  S5        U R                  R                  S5      R                  S5        U R                  R                  S5      R                  S5        SU l        g )Nzpyspacetests%dr7   r   za.pyzb.pyzc__init__.pyF)rh   ÚpathExtensionNamer   ÚpathExtensionr¤   ÚnextÚ
_serialnumÚpackageNamer;   ÚpackagePathr<   Ú	pathSetUprv   s    r   ÚsetUpÚPathModificationTests.setUp@  s  € Ø!%§¡£ˆÔÜ% d×&<Ñ&<Ó=ˆÔØ×Ñ×*Ñ*Ô,Ø+¬t°D·O±OÓ/DÐ.FÑFˆÔØ×-Ñ-×3Ñ3°D×4DÑ4DÓEˆÔØ×Ñ×(Ñ(Ô*Ø×Ñ×Ñ˜}Ó-×8Ñ8¸Ô=Ø×Ñ×Ñ˜vÓ&×1Ñ1°#Ô6Ø×Ñ×Ñ˜vÓ&×1Ñ1°#Ô6Ø×Ñ×Ñ˜~Ó.×9Ñ9¸#Ô>Øˆ�r   c                óŠ   • U R                   (       a   eSU l         [        R                  R                  U R                  5        g ©NT)r¿   rB   r?   rZ   r¹   rv   s    r   Ú_setupSysPathÚ#PathModificationTests._setupSysPathM  s,   € Ø—>—>Ð!Ð!ØˆŒÜ�‰�‰˜×.Ñ.Õ/r   c                ó4  • U R                  5       n[        U5      nUR                  5         UR                  S5      R	                  S5        U R
                  R                  S5      R	                  [        S[        U5       S35      5        U R                  5         [        R                  " U R                  5      nU R                  U R                  U R                  S-   XAS9US   5        U R                  US   R                  5       R                  S	5        g )
Nz	foozle.pys   x = 123
r7   z__path__.append(z)
z.foozler'   Úfoozleé{   )rh   r   r¤   r;   r<   r¾   r
   ÚreprrÄ   r	   r@   r½   rE   r-   r‡   r–   )r   ÚdoImportÚmoddir2Úfpmdr,   s        r   Ú_underUnderPathTestÚ)PathModificationTests._underUnderPathTestR  sô   € Ø—+‘+“-ˆÜ˜Ó ˆØ×ÑÔØ�
‰
�;Ó×*Ñ*¨<Ô8Ø×Ñ×Ñ˜}Ó-×8Ñ8ÜÐ,¬T°'«]¨O¸3Ð?Ó@ô	
ð 	×ÑÔÜ×#Ò# D×$4Ñ$4Ó5ˆØ×ÑØ× Ñ Ø× Ñ  9Ñ,¨gð !ð ð �HÑô		
ð 	×Ñ˜ Ñ*×/Ñ/Ó1×3Ñ3°SÕ9r   c                ó$   • U R                  5         g)zM
Verify that iterModules will honor the __path__ of already-loaded packages.
N)rÍ   rv   s    r   Ú"test_underUnderPathAlreadyImportedÚ8PathModificationTests.test_underUnderPathAlreadyImportede  s   € ð 	× Ñ Õ"r   c                ó  • [         R                  " U R                  5      nUR                  5        Vs/ s H   o"R                  R                  S5      S   PM"     nnUR                  5         U R                  U/ SQ5        g s  snf )Nr~   éÿÿÿÿ)ÚaÚbÚ	c__init__)r	   r@   r½   r   r(   Úsplitr”   rE   )r   Úpkginfor,   Únfnis       r   Ú_listModulesÚ"PathModificationTests._listModulesk  si   € Ü×#Ò# D×$4Ñ$4Ó5ˆØ;B×;NÑ;NÔ;PÓQÒ;P°—‘×"Ñ" 3Ó'¨Ô+Ñ;PˆÐQØ�	‰	ŒØ×Ñ˜Ò6Õ7ùò Rs   ³'Bc                óD   • U R                  5         U R                  5         g)zi
Make sure the module list comes back as we expect from iterModules on a
package, whether zipped or not.
N)rÄ   rÚ   rv   s    r   Útest_listingModulesÚ)PathModificationTests.test_listingModulesq  s   € ð
 	×ÑÔØ×ÑÕr   c                ón   • U R                  5         [        U R                  5        U R                  5         g)z˜
Make sure the module list comes back as we expect from iterModules on a
package, whether zipped or not, even if the package has already been
imported.
N)rÄ   r   r½   rÚ   rv   s    r   Ú"test_listingModulesAlreadyImportedÚ8PathModificationTests.test_listingModulesAlreadyImportedy  s*   € ð 	×ÑÔÜ�×!Ñ!Ô"Ø×ÑÕr   c                óæ   • U R                   (       a`  Sn[        R                  R                  5       U R                  L d
   US-   5       eU R                  [        R                  ;  d
   US-   5       eg g )Nz<path cleanup failed: don't be surprised if other tests breakz, 1z, 2)r¿   rB   r?   Úpopr¹   )r   ÚHORKs     r   ÚtearDownÚPathModificationTests.tearDownƒ  s]   € ð �>�>ØQˆDÜ—8‘8—<‘<“> T×%;Ñ%;Ò;ÐI¸TÀE¹\ÓIÐ;Ø×)Ñ)´·±Ó9ÐG¸4À%¹<ÓGÑ9ð r   )r½   r¾   rº   r¹   r¿   Nr´   )T)rÊ   r   r   rµ   )r   r   r    r!   r0   Ú	itertoolsÚcountr¼   rÀ   rÄ   rÍ   rÐ   rÚ   rÝ   rà   rå   r"   r   r   r   r·   r·   7  s>   † ñð
 —’Ó"€Jôô0ö
:ô&#ô8ôô÷Hr   r·   c                  ó,   • \ rS rSrSrSS jrSS jrSrg)ÚRebindingTestsiŒ  z†
These tests verify that the default path interrogation API works properly
even when sys.path has been rebound to a different object.
c                óì   • U R                   (       a   eSU l         [        R                  U l        [        R                  S S  [        l        [        R                  R	                  U R
                  5        g rÃ   )r¿   rB   r?   ÚsavedSysPathrZ   r¹   rv   s    r   rÄ   ÚRebindingTests._setupSysPath’  sG   € Ø—>—>Ð!Ð!ØˆŒÜŸH™HˆÔÜ—8‘8™A�;ŒŒÜ�‰�‰˜×.Ñ.Õ/r   c                óR   • U R                   (       a  U R                  [        l        gg)z6
Clean up sys.path by re-binding our original object.
N)r¿   rì   rB   r?   rv   s    r   rå   ÚRebindingTests.tearDown™  s   € ð �>�>Ø×(Ñ(ŒC�Hð r   )r¿   rì   Nr´   )r   r   r    r!   r0   rÄ   rå   r"   r   r   r   rê   rê   Œ  s   † ñô
0÷)r   rê   c                  ó   • \ rS rSrSS jrSrg)ÚZipPathModificationTestsi¡  c                ó  • U R                   (       a   e[        U R                  U R                  S-   5        U =R                  S-  sl        [        R                  " U R                  5      (       d   e[
        R                  U 5        g )Nz.zip)r¿   r   r¹   ÚzipfileÚ
is_zipfiler·   rÄ   rv   s    r   rÄ   Ú&ZipPathModificationTests._setupSysPath¢  sf   € Ø—>—>Ð!Ð!Üˆd×$Ñ$ d×&<Ñ&<¸vÑ&EÔFØ×Ò &Ñ(ÕÜ×!Ò! $×"8Ñ"8×9Ñ9Ð9Ð9Ü×+Ñ+¨DÕ1r   r   Nr´   )r   r   r    r!   rÄ   r"   r   r   r   rñ   rñ   ¡  s   † ÷2r   rñ   c                  ó@   • \ rS rSrSrS	S jrS	S jrS	S jrS	S jrSr	g)
ÚPythonPathTestsiª  z~
Tests for the class which provides the implementation for all of the
public API of L{twisted.python.modules}, L{PythonPath}.
c                ó  ^^	•  " S S5      mS	U4S jjnS/n0 nU/n0 nS
S jn[         R                  " X#XEU5      n[        UR                  5       5      m	U R	                  [        T	5      S5        U R                  [        U	4S j5        g)ze
Make sure that the behavior when encountering an unknown importer
type is not catastrophic failure.
c                  ó   • \ rS rSrSrg)Ú>PythonPathTests.test_unhandledImporter.<locals>.SecretImporteri¶  r   N)r   r   r    r!   r"   r   r   r   ÚSecretImporterrú   ¶  s   † Úr   rû   c                ó   >• T" 5       $ r   r   )r(   rû   s    €r   ÚhookÚ4PythonPathTests.test_unhandledImporter.<locals>.hook¹  s   ø€ Ù!Ó#Ð#r   zexample/pathc                ó   • g r   r   )r(   s    r   Ú	sysloaderÚ9PythonPathTests.test_unhandledImporter.<locals>.sysloaderÁ  s   € Ør   r®   c                 ó   >• T S   S   $ )Nr   rM   r   )Úentriess   €r   Ú<lambda>Ú8PythonPathTests.test_unhandledImporter.<locals>.<lambda>Ç  s   ø€ ¨G°A©J°xÒ,@r   N)r(   Úobjectr   rû   )r(   r  r   rµ   )r	   rY   rA   ÚiterEntriesrE   r¨   ÚassertRaisesÚKeyError)
r   rý   ÚsyspathÚ
sysmodulesÚsyshooksÚsyscacher   Úspacerû   r  s
           @@r   Útest_unhandledImporterÚ&PythonPathTests.test_unhandledImporter°  s€   ù€ ÷	ñ 	÷	$ð "Ð"ˆØ,.ˆ
Ø�6ˆØ68ˆô	ô ×"Ò" 7¸ÈIÓVˆÜ�u×(Ñ(Ó*Ó+ˆØ×Ñœ˜W› qÔ)Ø×Ñœ(Ô$@ÕAr   c                óú  • [         R                  " / [        R                   / 0 5      nU[           nU R	                  U R
                  /5      nU R                  US   S   [        5        U R                  US   S   [        [        R                  5      R                  5       R                  5       S-   [        -   S-   5        U R                  [        U5      S5        U R                  UR                  [        5        g)z«
If the path a module loaded with L{PythonPath.__getitem__} is not
present in the path importer cache, a warning is emitted, but the
L{PythonModule} is returned as usual.
r   ÚcategoryÚmessagez (for module zR) not in path importer cache (PEP 302 violation - check your local configuration).r®   N)r	   rY   rB   r   ÚflushWarningsÚtest_inconsistentImporterCacherE   ÚUserWarningr   rt   Ú__file__ÚparentÚdirnamer¨   r(   )r   r  Ú
thisModuleÚwarningss       r   r  Ú.PythonPathTests.test_inconsistentImporterCacheÉ  sÙ   € ô ×"Ò" 2¤s§{¡{°B¸Ó;ˆØœ8‘_ˆ
Ø×%Ñ% t×'JÑ'JÐ&KÓLˆØ×Ñ˜ !™ ZÑ0´+Ô>Ø×ÑØ�Q‰K˜	Ñ"Ü”W×%Ñ%Ó&×-Ñ-Ó/×7Ñ7Ó9ØñäñðDñDô	
ð 	×Ñœ˜X›¨Ô*Ø×Ñ˜Ÿ™¬(Õ3r   c                óR   • [         R                  " 5       nU R                  SU5        g)zÆ
L{PythonPath} implements the C{in} operator so that when it is the
right-hand argument and the name of a module which exists on that
L{PythonPath} is the left-hand argument, the result is C{True}.
r…   N)r	   rY   ÚassertIn©r   ÚthePaths     r   Útest_containsModuleÚ#PythonPathTests.test_containsModuleÞ  s    € ô ×$Ò$Ó&ˆØ�‰�d˜GÕ$r   c                óR   • [         R                  " 5       nU R                  SU5        g)zÏ
L{PythonPath} implements the C{in} operator so that when it is the
right-hand argument and the name of a module which does not exist on
that L{PythonPath} is the left-hand argument, the result is C{False}.
ÚbogusModuleN)r	   rY   ÚassertNotInr  s     r   Útest_doesntContainModuleÚ(PythonPathTests.test_doesntContainModuleç  s"   € ô ×$Ò$Ó&ˆØ×Ñ˜¨Õ0r   r   Nr´   )
r   r   r    r!   r0   r  r  r!  r&  r"   r   r   r   r÷   r÷   ª  s   † ñô
Bô24ô*%÷1r   r÷   )r2   r·   rê   rñ   r÷   )'r0   Ú
__future__r   r¦   rç   rB   ró   Úimportlib.abcr   Útypesr   Útypingr   r   Útyping_extensionsr   rt   Útwisted.pythonr	   Útwisted.python.compatr
   Útwisted.python.filepathr   Útwisted.python.reflectr   Ú#twisted.python.test.modules_helpersr   Ú twisted.python.test.test_zippathr   Útwisted.trial.unittestr   r   r$   r2   r·   rê   rñ   r÷   Ú__all__r   r   r   Ú<module>r5     s®   ðñõ #ã Û Û 
Û Ý )Ý ß !å &ã Ý "Ý /Ý ,Ý +Ý CÝ 2Ý +ô˜8ô ôKÐ0°(ô Kô,y)Ð'ô y)ôxRHÐ2ô RHôj)Ð*ô )ô*2Ð4ô 2ôD1�hô D1òN�r   