ó
    ×›‘hÊ_  ã                  óä  • S r SSKJ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  SSKJrJrJr  SSKJrJrJr  SS	KJr  SS
KJrJr  SSKJrJrJr  SSKJr  SSK J!r!J"r"Jr  SSK#J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  \(       a  SSK+J,r,  S S jr- " S S\(R\                  5      r/S!S jr0 " S S\(R\                  5      r1 " S S\(R\                  5      r2 " S S\25      r3 " S S\(R\                  5      r4g)"z"
Tests for loading tests by name.
é    )ÚannotationsN)Úmd5)Ú
attrgetter)Ú
ModuleType)ÚTYPE_CHECKINGÚCallableÚ	Generator)Úassert_thatÚequal_toÚhas_properties)ÚMatcher)ÚfilepathÚutil)ÚPythonAttributeÚPythonModuleÚ	getModule)ÚModuleNotFound)ÚreporterÚrunnerÚunittest)Ú_iterateTests)Ú	ITestCase)Úpackagesé   )Úafter)ÚSupportsRichComparisonc                ól   • / n[        U 5       H"  nUR                  UR                  5       5        M$     U$ )zA
Return the id of each test within the given test suite or case.
)r   ÚappendÚid)ÚtestsÚnamesÚtests      ÚbC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/trial/test/test_loader.pyÚ	testNamesr$   !   s/   € ð €EÜ˜eÖ$ˆØ�‰�T—W‘W“YÖñ %à€Ló    c                  óT   ^ • \ rS rSrSU 4S jjrSS jrSS jrSS jrSS jrSr	U =r
$ )	ÚFinderPy3Testsé+   c                óV   >• [         TU ]  5         [        R                  " 5       U l        g ©N)ÚsuperÚsetUpr   Ú
TestLoaderÚloader)ÚselfÚ	__class__s    €r#   r,   ÚFinderPy3Tests.setUp,   s   ø€ Ü‰‰ŒÜ×'Ò'Ó)ˆ�r%   c                óZ   • U R                  [        U R                  R                  S5        g)z­
findByName, if given something findable up until the last entry, will
raise AttributeError (as it cannot tell if 'nonexistent' here is
supposed to be a module or a class).
ztwisted.trial.test.nonexistentN)ÚassertRaisesÚAttributeErrorr.   Ú
findByName©r/   s    r#   Útest_findNonModuleÚ!FinderPy3Tests.test_findNonModule0   s$   € ð 	×ÑÜ˜DŸK™K×2Ñ2Ð4Tõ	
r%   c                óZ   • U R                  [        U R                  R                  S5        g )NÚ	nonextant)r3   r   r.   r5   r6   s    r#   Útest_findNonPackageÚ"FinderPy3Tests.test_findNonPackage:   s   € Ø×Ñœ.¨$¯+©+×*@Ñ*@À+ÕNr%   c                ó�   • [         R                  " [        S5      nU R                  [        U R
                  R                  U5        g)zp
findByName, given a file path that doesn't exist, will raise a
ValueError saying that it is not a Python file.
znonexistent.pyN)r   ÚsibpathÚ__file__r3   Ú
ValueErrorr.   r5   )r/   Úpaths     r#   Útest_findNonFileÚFinderPy3Tests.test_findNonFile=   s1   € ô
 �|Š|œHÐ&6Ó7ˆØ×Ñœ* d§k¡k×&<Ñ&<¸dÕCr%   c                óZ   • U R                  [        U R                  R                  S5        g)zV
findByName will re-raise ImportErrors inside modules that it has found
and imported.
zunimportablepackage.test_moduleN)r3   ÚImportErrorr.   r5   r6   s    r#   Útest_findFileWithImportErrorÚ+FinderPy3Tests.test_findFileWithImportErrorE   s$   € ð
 	×ÑÜ˜Ÿ™×/Ñ/Ð1Rõ	
r%   ©r.   ©ÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r,   r7   r;   rB   rF   Ú__static_attributes__Ú__classcell__)r0   s   @r#   r'   r'   +   s#   ø† ÷*ô
ôOôD÷
ò 
r%   r'   c                ó  • U R                   nUc   e[        [        UR                  5      [	        [
        R                  [        [
        R                  " UR                  5      5      5      S.5      n[	        [        S5      U5      $ )a  
Match a module with a L{ModuleSpec} like that of the given module.

@return: A matcher for a module spec that has the same name and origin as
    the given module spec, though the origin may be structurally inequal
    as long as it is semantically equal.
)ÚnameÚoriginÚ__spec__)	rU   r   r   rS   r   r   ÚFilePathrT   r   )ÚmoduleÚexpectedÚ
match_specs      r#   ÚlooselyResemblesrZ   O   sr   € ð �‰€Hð ÑÐÐÜä˜XŸ]™]Ó+ÜÜ×!Ñ!Üœ×*Ò*¨8¯?©?Ó;Ó<óñ	
ó€Jô ”˜JÓ'¨Ó4Ð4r%   c                  ór   • \ rS 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rg)Ú	FileTestség   z'
Tests for L{runner.filenameToModule}.
c                ó„   • U R                  [        [        R                  S5      nU R	                  [        U5      S5        g)zW
L{runner.filenameToModule} raises a C{ValueError} when a non-existing
file is passed.
Úitz'it' doesn't existN)r3   r@   r   ÚfilenameToModuleÚassertEqualÚstr)r/   Úerrs     r#   Útest_notFileÚFileTests.test_notFilel   s3   € ð
 ×Ñ¤
¬F×,CÑ,CÀTÓJˆØ×Ñœ˜S›Ð#7Õ8r%   c                ó�   • [         R                  " [        R                  " [        S5      5      nSSKJn  U R                  X!5        g)zp
If the file in question is a module on the Python path, then it should
properly import and return that module.
z	sample.pyr   ©ÚsampleN)r   r`   r   r>   r?   Útwisted.trial.testrh   ra   ©r/   Úsample1Úsample2s      r#   Útest_moduleInPathÚFileTests.test_moduleInPatht   s0   € ô
 ×)Ò)¬$¯,ª,´xÀÓ*MÓNˆÝ8à×Ñ˜Õ*r%   c                óž  • U R                  U R                  5        [        R                  " [        R
                  R                  U R                  SS5      5      nU R                  UR                  S5        U R                  5         U R                  U R                  5        SSKJn  U R                  X5        [        U[!        U5      5        g)zè
If passed the path to a file containing the implementation of a
module within a package which is not on the import path,
L{runner.filenameToModule} returns a module object loosely
resembling the module defined by that file anyway.
Úgoodpackageztest_sample.pyzgoodpackage.test_sampler   )Útest_sampleN)ÚmangleSysPathÚoldPathr   r`   ÚosrA   ÚjoinÚparentra   rL   ÚcleanUpModulesÚnewPathrp   rq   ÚassertIsNotr
   rZ   rj   s      r#   Útest_moduleNotInPathÚFileTests.test_moduleNotInPath~   s—   € ð 	×Ñ˜4Ÿ<™<Ô(Ü×)Ò)Ü�G‰G�L‰L˜Ÿ™ mÐ5EÓFó
ˆð 	×Ñ˜×)Ñ)Ð+DÔEà×ÑÔØ×Ñ˜4Ÿ<™<Ô(Ý6à×Ñ˜Ô*Ü�GÔ-¨gÓ6Õ7r%   c                óÆ   • [         R                  " [        R                  R	                  U R
                  S5      5      nU R                  U[        R                  S   5        g)zr
If the file in question is a package on the Python path, then it should
properly import and return that package.
rp   N)	r   r`   rt   rA   ru   rv   ÚassertIsÚsysÚmodules)r/   Úpackage1s     r#   Útest_packageInPathÚFileTests.test_packageInPath“   s>   € ô
 ×*Ò*¬2¯7©7¯<©<¸¿¹À]Ó+SÓTˆà�‰�h¤§¡¨MÑ :Õ;r%   c                ó˜  • U R                  U R                  5        [        R                  " [        R
                  R                  U R                  S5      5      nU R                  UR                  S5        U R                  5         U R                  U R                  5        SSKnU R                  X5        [        U[        U5      5        g)zÓ
If passed the path to a directory which represents a package which
is not on the import path, L{runner.filenameToModule} returns a
module object loosely resembling the package defined by that
directory anyway.
rp   r   N)rr   rs   r   r`   rt   rA   ru   rv   ra   rL   rw   rx   rp   ry   r
   rZ   )r/   r€   rp   s      r#   Útest_packageNotInPathÚFileTests.test_packageNotInPathœ   sŽ   € ð 	×Ñ˜4Ÿ<™<Ô(Ü×*Ò*¬2¯7©7¯<©<¸¿¹À]Ó+SÓTˆØ×Ñ˜×*Ñ*¨MÔ:à×ÑÔØ×Ñ˜4Ÿ<™<Ô(Ûà×Ñ˜Ô/Ü�HÔ.¨{Ó;Õ<r%   c                ó2  • [         R                  " U R                  5      R                  S5      nUR	                  5         U R                  [        [        R                  UR                  5      nU R                  [        U5      UR                  < S35        g)zÀ
L{runner.filenameToModule} raises a C{ValueError} when the name of an
empty directory is passed that isn't considered a valid Python package
because it doesn't contain a C{__init__.py} file.
ÚemptyDirectoryz is not a package directoryN)r   rV   rv   ÚchildÚcreateDirectoryr3   r@   r   r`   rA   ra   rb   )r/   ÚemptyDirrc   s      r#   Útest_directoryNotPackageÚ"FileTests.test_directoryNotPackage®   so   € ô ×$Ò$ T§[¡[Ó1×7Ñ7Ð8HÓIˆØ× Ñ Ô"à×Ñ¤
¬F×,CÑ,CÀXÇ]Á]ÓSˆØ×Ñœ˜S› h§m¡mÑ%6Ð6QÐ#RÕSr%   c                óâ   • [         R                  " U R                  5      R                  S5      nUR	                  S5        U R                  [        [        R                  UR                  5        g)zV
L{runner.filenameToModule} raises a C{SyntaxError} when a non-Python
file is passed.
Ú	notpythons   This isn't pythonN)
r   rV   rv   rˆ   Ú
setContentr3   ÚSyntaxErrorr   r`   rA   )r/   Úfilenames     r#   Útest_filenameNotPythonÚ FileTests.test_filenameNotPythonº   sN   € ô
 ×$Ò$ T§[¡[Ó1×7Ñ7¸ÓDˆØ×ÑÐ0Ô1Ø×Ñœ+¤v×'>Ñ'>ÀÇÁÕNr%   c                ó–  • [         R                  " U R                  5      R                  S5      nUR	                  [
        R                  R                  S5      5         [        R                  " UR                  5      nU R                  UR                  UR                  5        UR                  5         g! UR                  5         f = f)zH
The C{__file__} attribute of the module should match the package name.
zgoodpackage.pyÚutf8N)r   rV   rv   rˆ   r�   r   Ú
testModuleÚencoder   r`   rA   ra   r?   Úremove)r/   r‘   rW   s      r#   Útest_filenameMatchesPackageÚ%FileTests.test_filenameMatchesPackageÃ   s‰   € ô ×$Ò$ T§[¡[Ó1×7Ñ7Ð8HÓIˆØ×ÑœH×/Ñ/×6Ñ6°vÓ>Ô?ð	Ü×,Ò,¨X¯]©]Ó;ˆFØ×Ñ˜XŸ]™]¨F¯O©OÔ<à�O‰OÕøˆH�O‰OÕús   ÁAB6 Â6Cc                ól  • [         R                  " U R                  5      R                  S5      nUR	                  5         UR                  S5      R                  S5         [        R                  " UR                  5      nU R                  UR                  R                  S5      5        [        R                  " UR                  [        R                  R                  -   5      nU R                  UR                  R                  S5      5        UR                  5         g! UR                  5         f = f)z‡
Test loader against a filesystem directory containing an empty
C{__init__.py} file. It should handle 'path' and 'path/' the same way.
ÚgoodDirectoryú__init__.pyr%   N)r   rV   rv   rˆ   r‰   r�   r   r`   rA   Ú
assertTruerL   Úendswithrt   Úsepr˜   )r/   ÚgoodDirrW   s      r#   Útest_directoryÚFileTests.test_directoryÐ   sË   € ô
 ×#Ò# D§K¡KÓ0×6Ñ6°ÓGˆØ×ÑÔ!Ø�‰�mÓ$×/Ñ/°Ô4ð	Ü×,Ò,¨W¯\©\Ó:ˆFØ�O‰O˜FŸO™O×4Ñ4°_ÓEÔFÜ×,Ò,¨W¯\©\¼B¿G¹G¿K¹KÑ-GÓHˆFØ�O‰O˜FŸO™O×4Ñ4°_ÓEÔFà�N‰NÕøˆG�N‰NÕús   Á!B/D! Ä!D3© NrI   )rL   rM   rN   rO   Ú__doc__rd   rm   rz   r�   r„   r‹   r’   r™   r¢   rP   r¤   r%   r#   r\   r\   g   s6   † ñô9ô+ô8ô*<ô=ô$
TôOô÷r%   r\   c                  óZ  • \ rS 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$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$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#)&ÚLoaderTestséâ   z 
Tests for L{trial.TestLoader}.
c                óv   • [         R                  " 5       U l        [        R                  R                  U 5        g r*   )r   r-   r.   r   ÚSysPathManglingTestr,   r6   s    r#   r,   ÚLoaderTests.setUpç   s&   € Ü×'Ò'Ó)ˆŒÜ×$Ñ$×*Ñ*¨4Õ0r%   c                ó  ^• SSK Jn  U R                  R                  UR                  5      nU R                  / SQUR                   Vs/ s H  o3R                  PM     sn5        / SQn[        [        U[        S5      5      5      mU4S jU R                  l        U R                  R                  UR                  5      nU R                  XBR                   Vs/ s H  o3R                  PM     sn5        g s  snf s  snf )Nr   rg   )Útest_aÚtest_bÚtest_c)r®   r¯   r­   é   c                óD   >• TR                  U R                  5       S5      $ )Néÿÿÿÿ)ÚgetÚshortDescription)ÚxÚsortDicts    €r#   Ú<lambda>Ú,LoaderTests.test_sortCases.<locals>.<lambda>õ   s   ø€  x§|¡|°A×4FÑ4FÓ4HÈ"Ô'Mr%   )ri   rh   r.   Ú	loadClassÚAlphabetTestra   Ú_testsÚ_testMethodNameÚdictÚzipÚrangeÚsorter)r/   rh   Úsuiter"   ÚnewOrderr¶   s        @r#   Útest_sortCasesÚLoaderTests.test_sortCasesë   s½   ø€ Ý-à—‘×%Ñ% f×&9Ñ&9Ó:ˆØ×ÑÚ*Ø.3¯lªlÓ;ªl d×!Ô!©lÑ;ô	
ò 2ˆÜœ˜H¤e¨A£hÓ/Ó0ˆÜMˆ�‰ÔØ—‘×%Ñ% f×&9Ñ&9Ó:ˆØ×Ñ˜Ç\Â\Ó#RÂ\¸T×$8Ô$8Á\Ñ#RÕSùò <ùò $Ss   Á	C7
ÃC<
c                ó  • U R                   R                  S5      n[        R                  " 5       nUR	                  U5        U R                  UR                  S5        U R                  [        UR                  5      S5        g)zc
Loading a test that fails and getting the result of it ends up with one
test ran and one failure.
z6twisted.trial.test.erroneous.TestRegularFail.test_failr   N)	r.   Ú
loadByNamer   Ú
TestResultÚrunra   ÚtestsRunÚlenÚfailures)r/   rÁ   Úresults      r#   Útest_loadFailureÚLoaderTests.test_loadFailureù   sd   € ð
 —‘×&Ñ&ØDó
ˆô ×$Ò$Ó&ˆØ�	‰	�&ÔØ×Ñ˜Ÿ™¨!Ô,Ø×Ñœ˜VŸ_™_Ó-¨qÕ1r%   c                óþ   • SSK Jn  U R                  R                  UR                  R
                  UR                  / SQS9nU R                  SUR                  5       5        U R                  SUR                  5        g)z™
A decorated test method for which the decorator has failed to set the
method's __name__ correctly is loaded and its name in the class scope
discovered.
r   rg   )rh   ÚDecorationTestÚtest_badDecorator©rv   ÚqualNamer   rÑ   N)	ri   rh   r.   ÚloadAnythingrÐ   rÑ   ra   ÚcountTestCasesr¼   ©r/   rh   rÁ   s      r#   Útest_loadBadDecoratorÚ!LoaderTests.test_loadBadDecorator  sm   € õ 	.à—‘×(Ñ(Ø×!Ñ!×3Ñ3Ø×(Ñ(ÚFð )ð 
ˆð
 	×Ñ˜˜E×0Ñ0Ó2Ô3Ø×ÑÐ,¨e×.CÑ.CÕDr%   c                óþ   • SSK Jn  U R                  R                  UR                  R
                  UR                  / SQS9nU R                  SUR                  5       5        U R                  SUR                  5        g)z�
A decorated test method for which the decorator has set the method's
__name__ correctly is loaded and the only name by which it goes is used.
r   rg   )rh   rÐ   Útest_goodDecoratorrÒ   r   rÚ   N)	ri   rh   r.   rÔ   rÐ   rÚ   ra   rÕ   r¼   rÖ   s      r#   Útest_loadGoodDecoratorÚ"LoaderTests.test_loadGoodDecorator  sm   € õ
 	.à—‘×(Ñ(Ø×!Ñ!×4Ñ4Ø×(Ñ(ÚGð )ð 
ˆð
 	×Ñ˜˜E×0Ñ0Ó2Ô3Ø×ÑÐ-¨u×/DÑ/DÕEr%   c                óþ   • SSK Jn  U R                  R                  UR                  R
                  UR                  / SQS9nU R                  SUR                  5       5        U R                  SUR                  5        g)z—
Load a decorated method which has been copied to a new name inside the
class.  Thus its __name__ and its key in the class's __dict__ no
longer match.
r   rg   )rh   rÐ   Útest_renamedDecoratorrÒ   r   rÞ   N)	ri   rh   r.   rÔ   rÐ   rÞ   ra   rÕ   r¼   rÖ   s      r#   Útest_loadRenamedDecoratorÚ%LoaderTests.test_loadRenamedDecorator%  sm   € õ 	.à—‘×(Ñ(Ø×!Ñ!×7Ñ7Ø×(Ñ(ÚJð )ð 
ˆð
 	×Ñ˜˜E×0Ñ0Ó2Ô3Ø×ÑÐ0°%×2GÑ2GÕHr%   c                ó  • SSK Jn  U R                  R                  UR                  5      nU R                  SUR                  5       5        U R                  SS/UR                   Vs/ s H  o3R                  PM     sn5        g s  snf )Nr   rg   é   Útest_barÚtest_foo)	ri   rh   r.   r¹   ÚFooTestra   rÕ   r»   r¼   )r/   rh   rÁ   r"   s       r#   Útest_loadClassÚLoaderTests.test_loadClass5  sh   € Ý-à—‘×%Ñ% f§n¡nÓ5ˆØ×Ñ˜˜E×0Ñ0Ó2Ô3Ø×ÑØ˜Ð$ÈÏÊÓ&UÊÀ×';Ô';ÉÑ&Uõ	
ùÚ&Us   Á(B
c                ó�  • SSK Jn  U R                  [        U R                  R
                  U5        U R                  [        U R                  R
                  UR                  R                  5        U R                  [        U R                  R
                  S5        U R                  [        U R                  R
                  S5        g ©Nr   rg   Ústring)ÚfooÚbar)ri   rh   r3   Ú	TypeErrorr.   r¹   rå   rä   ©r/   rh   s     r#   Útest_loadNonClassÚLoaderTests.test_loadNonClass>  s   € Ý-à×Ñœ) T§[¡[×%:Ñ%:¸FÔCØ×Ñœ) T§[¡[×%:Ñ%:¸F¿N¹N×<SÑ<SÔTØ×Ñœ) T§[¡[×%:Ñ%:¸HÔEØ×Ñœ) T§[¡[×%:Ñ%:¸NÕKr%   c                óz   • SSK Jn  U R                  [        U R                  R
                  UR                  5        g ©Nr   rg   )ri   rh   r3   r@   r.   r¹   ÚNotATestrî   s     r#   Útest_loadNonTestCaseÚ LoaderTests.test_loadNonTestCaseF  s%   € Ý-à×Ñœ* d§k¡k×&;Ñ&;¸V¿_¹_ÕMr%   c                ó†   • SSK Jn  U R                  R                  U5      nU R	                  SUR                  5       5        g )Nr   rg   é
   )ri   rh   r.   Ú
loadModulera   rÕ   rÖ   s      r#   Útest_loadModuleÚLoaderTests.test_loadModuleK  s2   € Ý-à—‘×&Ñ& vÓ.ˆØ×Ñ˜˜U×1Ñ1Ó3Õ4r%   c                ó¤  • SSK Jn  U R                  [        U R                  R
                  UR                  5        U R                  [        U R                  R
                  UR                  R                  5        U R                  [        U R                  R
                  S5        U R                  [        U R                  R
                  S5        g ré   )ri   rh   r3   rí   r.   rø   rå   rä   rî   s     r#   Útest_loadNonModuleÚLoaderTests.test_loadNonModuleQ  sƒ   € Ý-à×Ñœ) T§[¡[×%;Ñ%;¸V¿^¹^ÔLØ×Ñœ) T§[¡[×%;Ñ%;¸V¿^¹^×=TÑ=TÔUØ×Ñœ) T§[¡[×%;Ñ%;¸XÔFØ×Ñœ) T§[¡[×%;Ñ%;¸^ÕLr%   c                ó‚   • SS K nU R                  R                  U5      nU R                  SUR	                  5       5        g ©Nr   é   ©rp   r.   ÚloadPackagera   rÕ   ©r/   rp   rÁ   s      r#   Útest_loadPackageÚLoaderTests.test_loadPackageY  s2   € Ûà—‘×'Ñ'¨Ó4ˆØ×Ñ˜˜E×0Ñ0Ó2Õ3r%   c                ó¤  • SSK Jn  U R                  [        U R                  R
                  UR                  5        U R                  [        U R                  R
                  UR                  R                  5        U R                  [        U R                  R
                  S5        U R                  [        U R                  R
                  S5        g ré   )ri   rh   r3   rí   r.   r  rå   rä   rî   s     r#   Útest_loadNonPackageÚLoaderTests.test_loadNonPackage_  sƒ   € Ý-à×Ñœ) T§[¡[×%<Ñ%<¸f¿n¹nÔMØ×Ñœ) T§[¡[×%<Ñ%<¸f¿n¹n×>UÑ>UÔVØ×Ñœ) T§[¡[×%<Ñ%<¸hÔGØ×Ñœ) T§[¡[×%<Ñ%<¸nÕMr%   c                óf   • SSK Jn  U R                  [        U R                  R
                  U5        g rò   )ri   rh   r3   rí   r.   r  rî   s     r#   Útest_loadModuleAsPackageÚ$LoaderTests.test_loadModuleAsPackageg  s#   € Ý-ð 	×Ñœ) T§[¡[×%<Ñ%<¸fÕEr%   c                ó€   • SS K nU R                  R                  USS9nU R                  SUR	                  5       5        g ©Nr   T©Úrecurseé   r  r  s      r#   Útest_loadPackageRecursiveÚ%LoaderTests.test_loadPackageRecursivem  s7   € Ûà—‘×'Ñ'¨¸TÐ'ÐBˆØ×Ñ˜˜U×1Ñ1Ó3Õ4r%   c                óÚ   • SSK Jn  U R                  R                  U5      nU R	                  UR
                  UR                  S   R                  S   R                  R                  5        g rò   )	ri   rh   r.   rÔ   ra   rL   r»   r0   rM   rÖ   s      r#   Útest_loadAnythingOnModuleÚ%LoaderTests.test_loadAnythingOnModules  sO   € Ý-à—‘×(Ñ(¨Ó0ˆØ×ÑØ�O‰O˜UŸ\™\¨!™_×3Ñ3°AÑ6×@Ñ@×KÑKõ	
r%   c                óš   • SSK Jn  U R                  R                  UR                  5      nU R                  SUR                  5       5        g )Nr   rg   râ   )ri   rh   r.   rÔ   rå   ra   rÕ   rÖ   s      r#   Útest_loadAnythingOnClassÚ$LoaderTests.test_loadAnythingOnClass{  s6   € Ý-à—‘×(Ñ(¨¯©Ó8ˆØ×Ñ˜˜E×0Ñ0Ó2Õ3r%   c                óÞ   • SS K nU R                  R                  U5      nU R                  [	        X R                  R
                  5      5        U R                  SUR                  5       5        g rÿ   ©rp   r.   rÔ   rž   Ú
isinstanceÚsuiteFactoryra   rÕ   r  s      r#   Útest_loadAnythingOnPackageÚ&LoaderTests.test_loadAnythingOnPackage�  sM   € Ûà—‘×(Ñ(¨Ó5ˆØ�‰œ
 5¯+©+×*BÑ*BÓCÔDØ×Ñ˜˜E×0Ñ0Ó2Õ3r%   c                óÜ   • SS K nU R                  R                  USS9nU R                  [	        X R                  R
                  5      5        U R                  SUR                  5       5        g r  r  r  s      r#   Ú#test_loadAnythingOnPackageRecursiveÚ/LoaderTests.test_loadAnythingOnPackageRecursiveˆ  sR   € Ûà—‘×(Ñ(¨¸dÐ(ÐCˆØ�‰œ
 5¯+©+×*BÑ*BÓCÔDØ×Ñ˜˜U×1Ñ1Ó3Õ4r%   c                óZ   • U R                  [        U R                  R                  S5        g )Nrp   )r3   rí   r.   rÔ   r6   s    r#   Útest_loadAnythingOnStringÚ%LoaderTests.test_loadAnythingOnString�  s    € ð 	×Ñœ) T§[¡[×%=Ñ%=¸}ÕMr%   c                óÆ  • SS K nU R                  R                  USS9n[        R                  " 5       nUR                  U5        U R                  SUR                  5       5        U R                  S[        UR                  5      5        UR                   VVs/ s H  u  pEUR                  5       PM     nnnUR                  5         U R                  USS/5        g s  snnf )Nr   Tr  Frâ   zpackage.test_bad_modulezpackage.test_import_module)Úpackager.   r  r   ÚReporterrÈ   ra   ÚwasSuccessfulrÊ   Úerrorsr   Úsort)r/   r&  rÁ   rÌ   r"   Úerrorr)  s          r#   Útest_importErrorsÚLoaderTests.test_importErrors”  s²   € Ûà—‘×'Ñ'¨¸Ð'Ð>ˆÜ×"Ò"Ó$ˆØ�	‰	�&ÔØ×Ñ˜ × 4Ñ 4Ó 6Ô7Ø×Ñ˜œC §¡Ó.Ô/Ø/5¯}ª}Ô=ª}¡ �$—'‘'–)©}ˆÑ=Ø�‰ŒØ×ÑØÐ.Ð0LÐMõ	
ùó >s   ÂCc                óö   •  " S S[         R                  5      nU R                  R                  U5      n[        R
                  " 5       nUR                  U5        U R                  UR                  5       5        g)zŒ
L{TestLoader.loadClass} returns a suite with each test method
represented by a different instances of the L{TestCase} they are
defined on.
c                  ó(   • \ rS rSrSS jrSS jrSrg)Ú>LoaderTests.test_differentInstances.<locals>.DistinctInstancesi©  c                ó   • SU l         g )NÚtest1Run©Úfirstr6   s    r#   Útest_1ÚELoaderTests.test_differentInstances.<locals>.DistinctInstances.test_1ª  s	   € Ø'�•
r%   c                ó:   • U R                  [        U S5      5        g )Nr4  )ÚassertFalseÚhasattrr6   s    r#   Útest_2ÚELoaderTests.test_differentInstances.<locals>.DistinctInstances.test_2­  s   € Ø× Ñ ¤¨¨wÓ!7Õ8r%   r3  NrI   )rL   rM   rN   rO   r5  r:  rP   r¤   r%   r#   ÚDistinctInstancesr0  ©  s   † ô(÷9r%   r<  N)	ÚpyunitÚTestCaser.   r¹   r   r'  rÈ   rž   r(  )r/   r<  rÁ   rÌ   s       r#   Útest_differentInstancesÚ#LoaderTests.test_differentInstances¢  sX   € ô	9¤§¡ô 	9ð —‘×%Ñ%Ð&7Ó8ˆÜ×"Ò"Ó$ˆØ�	‰	�&ÔØ�‰˜×,Ñ,Ó.Õ/r%   c                óÀ   • SSK Jn  U R                  R                  U5      nU R	                  SUR                  5       5        U R	                  S[        USS5      5        g)zX
Check that C{test_suite} is used when present and other L{TestCase}s are
not included.
r   )ÚmockcustomsuiteÚMyCustomSuiterS   N)ri   rB  r.   rø   ra   rÕ   Úgetattr)r/   rB  rÁ   s      r#   Útest_loadModuleWith_test_suiteÚ*LoaderTests.test_loadModuleWith_test_suiteµ  sM   € õ
 	7à—‘×&Ñ& Ó7ˆØ×Ñ˜˜E×0Ñ0Ó2Ô3Ø×Ñ˜¬'°%¸ÀÓ*FÕGr%   c                óÀ   • SSK Jn  U R                  R                  U5      nU R	                  SUR                  5       5        U R	                  S[        USS5      5        g)zW
Check that C{testSuite} is used when present and other L{TestCase}s are
not included.
r   ©Úmockcustomsuite2rC  rS   N)ri   rI  r.   rø   ra   rÕ   rD  )r/   rI  rÁ   s      r#   Útest_loadModuleWith_testSuiteÚ)LoaderTests.test_loadModuleWith_testSuiteÀ  sN   € õ
 	8à—‘×&Ñ&Ð'7Ó8ˆØ×Ñ˜˜E×0Ñ0Ó2Ô3Ø×Ñ˜¬'°%¸ÀÓ*FÕGr%   c                ó€   • SSK Jn  U R                  R                  U5      nU R	                  S[        USS5      5        g)zl
Check that if C{testSuite} and C{test_suite} are both present in a
module then C{testSuite} gets priority.
r   )Úmockcustomsuite3Ú	testSuiterS   N)ri   rM  r.   rø   ra   rD  )r/   rM  rÁ   s      r#   Útest_loadModuleWithBothCustomÚ)LoaderTests.test_loadModuleWithBothCustomË  s5   € õ
 	8à—‘×&Ñ&Ð'7Ó8ˆØ×Ñ˜¤g¨e°V¸TÓ&BÕCr%   c                óº   • SS jnSSK Jn  XR                  sUl        n U R                  [        U R
                  R                  U5        X2l        g! X2l        f = f)zb
Make sure that any C{AttributeError}s raised by C{testSuite} are not
swallowed by L{TestLoader}.
c                 ó   • [        S5      e)Nzshould be reraised)r4   r¤   r%   r#   rN  ÚBLoaderTests.test_customLoadRaisesAttributeError.<locals>.testSuiteÛ  s   € Ü Ð!5Ó6Ð6r%   r   rH  NrI   )ri   rI  rN  r3   r4   r.   rø   )r/   rN  rI  Úoriginals       r#   Ú#test_customLoadRaisesAttributeErrorÚ/LoaderTests.test_customLoadRaisesAttributeErrorÕ  sO   € ô	7õ 	8à09×;UÑ;UÐ,ÐÔ" Hð	2Ø×Ñœn¨d¯k©k×.DÑ.DÐFVÔWà)1Õ&ø¨Õ&ús    +A ÁAc                ó’   • [        U5      n[        U5      nUR                  5         UR                  5         U R                  X45        g r*   )r$   r*  ra   )r/   Útest1Útest2Únames1Únames2s        r#   ÚassertSuitesEqualÚLoaderTests.assertSuitesEqualç  s8   € ô
 ˜5Ó!ˆÜ˜5Ó!ˆØ�‰ŒØ�‰ŒØ×Ñ˜Õ(r%   c                óœ   • SnU R                   R                  X/S5      nU R                   R                  US5      nU R                  X#5        g)z0
Check that loadByNames ignores duplicate names
útwisted.trial.test.test_logTN)r.   ÚloadByNamesrÆ   r\  )r/   rW   Úsuite1Úsuite2s       r#   Útest_loadByNamesDuplicateÚ%LoaderTests.test_loadByNamesDuplicateò  sF   € ð /ˆØ—‘×(Ñ(¨&Ð)9¸4Ó@ˆØ—‘×'Ñ'¨°Ó5ˆØ×Ñ˜vÕ.r%   c                óò   • / SQnU R                   R                  U5      n[        R                  " [	        U R                   R
                  U5      5      nU R                  [        U5      [        U5      5        g)zH
L{TestLoader.loadByNames} preserves the order of tests provided to it.
)ú$inheritancepackage.test_x.A.test_fooztwisted.trial.test.samplerp   r_  z!twisted.trial.test.sample.FooTestúpackage.test_moduleN)r.   r`  r   Ú	TestSuiteÚmaprÆ   ra   r$   ©r/   r   ra  rb  s       r#   Útest_loadByNamesPreservesOrderÚ*LoaderTests.test_loadByNamesPreservesOrderû  sZ   € ò
ˆð —‘×(Ñ(¨Ó1ˆÜ×!Ò!¤# d§k¡k×&<Ñ&<¸gÓ"FÓGˆØ×Ñœ 6Ó*¬I°fÓ,=Õ>r%   c                óÌ   • SS/nU R                   R                  U5      n[        R                  " [	        U R                   R
                  U5      5      nU R                  X#5        g)z=
Check that loadByNames loads all the names that it is given
rp   rg  N©r.   r`  r   rh  ri  rÆ   r\  rj  s       r#   Útest_loadDifferentNamesÚ#LoaderTests.test_loadDifferentNames  sR   € ð !Ð"7Ð8ˆØ—‘×(Ñ(¨Ó1ˆÜ×!Ò!¤# d§k¡k×&<Ñ&<¸gÓ"FÓGˆØ×Ñ˜vÕ.r%   c                óÌ   • SS/nU R                   R                  U5      n[        R                  " [	        U R                   R
                  U5      5      nU R                  X#5        g)z]
Check that test methods names which are inherited from are all
loaded rather than just one.
rf  z$inheritancepackage.test_x.B.test_fooNrn  )r/   Úmethodsra  rb  s       r#   Útest_loadInheritedMethodsÚ%LoaderTests.test_loadInheritedMethods  sV   € ð 3Ø2ð
ˆð —‘×(Ñ(¨Ó1ˆÜ×!Ò!¤# d§k¡k×&<Ñ&<¸gÓ"FÓGˆØ×Ñ˜vÕ.r%   rH   NrI   )rX  ú"pyunit.TestCase | pyunit.TestSuiterY  ru  rJ   rK   )%rL   rM   rN   rO   r¥   r,   rÃ   rÍ   r×   rÛ   rß   ræ   rï   rô   rù   rü   r  r  r
  r  r  r  r  r   r#  r,  r?  rE  rJ  rO  rU  r\  rc  rk  ro  rs  rP   r¤   r%   r#   r§   r§   â   sË   † ñô1ôTô2ôEô FôIô 
ôLôNô
5ôMô4ôNôFô5ô
ô4ô4ô5ôNô

ô0ô&	Hô	HôDô2ð$	)à1ð	)ð 2ð	)ð 
ô		)ô/ô?ô /÷/r%   r§   c                  ó   • \ rS rSrSS jrSrg)ÚZipLoadingTestsi"  c                óö   • SSK Jn  [        R                  U 5        U" U R                  U R                  S-   5        U =R                  S-  sl        U R                  U R                  U R                  /-   5        g )Nr   )Úzipitz.zip)Ú twisted.python.test.test_zippathry  r§   r,   rv   rr   rs   )r/   ry  s     r#   r,   ÚZipLoadingTests.setUp#  sU   € Ý:ä×Ñ˜$ÔÙˆd�k‰k˜4Ÿ;™;¨Ñ/Ô0Ø�Š�vÑ�Ø×Ñ˜4Ÿ<™<¨4¯;©;¨-Ñ7Õ8r%   r¤   NrI   )rL   rM   rN   rO   r,   rP   r¤   r%   r#   rw  rw  "  s   † ÷9r%   rw  c                  ón   • \ rS rSrS	S jr    S
S jr\R                  4   SS jjrS	S jr	S	S jr
Srg)ÚPackageOrderingTestsi,  c                óâ  • [         R                  " 5       U l        U R                  5       U l        [
        R                  R                  U R                  S5      n[
        R                  " U5        [        [
        R                  R                  US5      S5      R                  5         [        R                  R                  X5        U R                  U R                  U R                  /-   5        g )NÚuberpackager�   Úwb)r   r-   r.   ÚmktempÚtopDirrt   rA   ru   ÚmakedirsÚopenÚcloser   rª   r,   rr   rs   )r/   rv   s     r#   r,   ÚPackageOrderingTests.setUp-  s–   € Ü×'Ò'Ó)ˆŒØ—k‘k“mˆŒÜ—‘—‘˜dŸk™k¨=Ó9ˆÜ
�Š�FÔÜŒR�W‰W�\‰\˜& -Ó0°$Ó7×=Ñ=Ô?Ü×$Ñ$×*Ñ*¨4Ô8Ø×Ñ˜4Ÿ<™<¨4¯;©;¨-Ñ7Õ8r%   c              #  óê  #   • [        S5      n/ nUR                  5        HH  nUR                  R                  S5      S   R	                  S5      (       d  M7  UR                  U5        MJ     [        X1S9nU Hõ  nUR                  S5      nUc  Uv •  M  / nUR                  5        H?  n	[        R                  " U	R                  5       5      (       d  M.  UR                  U	5        MA     [        X�S9n
U
 Ht  n/ nUR                  5        HH  nUR                  R                  S5      S   R	                  S5      (       d  M7  UR                  U5        MJ     [        XÁS9nU Sh  v•N   Mv     M÷     g N7f)aF  
Right now, halfway by accident, trial sorts like this:

    1. all modules are grouped together in one list and sorted.

    2. within each module, the classes are grouped together in one list
       and sorted.

    3. finally within each class, each test method is grouped together
       in a list and sorted.

This attempts to return a sorted list of testable thingies following
those rules, so that we can compare the behavior of loadPackage.

The things that show as 'cases' are errors from modules which failed to
import, and test methods.  Let's gather all those together.
r  Ú.r²   Útest_)ÚkeyNr"   )r   ÚwalkModulesrS   ÚsplitÚ
startswithr   ÚsortedÚloadÚiterAttributesr   Ú
isTestCase)r/   rÀ   ÚpkgÚtestModulesr–   ÚsortedModulesÚmodinforW   ÚtestClassesÚattribÚsortedClassesÚclsinfoÚtestMethodsÚattrÚsortedMethodss                  r#   Ú_trialSortAlgorithmÚ(PackageOrderingTests._trialSortAlgorithm6  s>  é € ô( ˜Ó&ˆØˆØŸ/™/Ö+ˆJØ�‰×$Ñ$ SÓ)¨"Ñ-×8Ñ8¸×AÓAØ×"Ñ" :Ö.ñ ,ô ˜{Ñ7ˆÛ$ˆGà—\‘\ $Ó'ˆFØ‰~Ø”à �Ø%×4Ñ4Ö6�FÜ×(Ò(¨¯©«×7Ó7Ø#×*Ñ*¨6Ö2ñ 7ô !' {Ñ ?�Û,�GØ"$�KØ '× 6Ñ 6Ö 8˜ØŸ9™9Ÿ?™?¨3Ó/°Ñ3×>Ñ>¸v×FÓFØ'×.Ñ.¨tÖ4ñ !9ô %+¨;Ñ$C�MØ,×,Ò,ó  -ò %ñ" -ùs&   ‚AE3ÁA9E3ÃA(E3Å #E3Å#E1Å$E3c           
     ó
  • SSK nXR                  l        U R                  R                  USS9n[        R
                  " U[        5      n[        [        U5      5      n[        U R                  U5      5      n[        [        XT5      5       HP  u  nu  pxU R                  UR                  UR                  5       SXgR                  UR                  5       4-  5        MR     U R                  [        U5      [        U5      5        g)z7
Verify that packages are loaded in the correct order.
r   NTr  z#%d: %s != %s)r  r.   rÀ   r  r   Údecorater   Úlistr   r�  Ú	enumerater¾   ra   rS   r   rÊ   )	r/   rÀ   r  rÁ   ÚresultingTestsÚmanifestÚnumberÚmanifestTestÚ
actualTests	            r#   ÚloadSortedPackagesÚ'PackageOrderingTests.loadSortedPackagesc  s×   € ó 	à#�‰ÔØ—‘×'Ñ'¨¸TÐ'ÐBˆô ×!Ò! %¬Ó3ˆÜœm¨EÓ2Ó3ˆÜ˜×0Ñ0°Ó8Ó9ˆÜ2;Ü�Ó)ö3
Ñ.ˆFÑ.�\ð ×ÑØ×!Ñ!Ø—‘“Ø 6×+<Ñ+<¸j¿m¹m»oÐ"NÑNöñ3
ð 	×Ñœ˜X›¬¨NÓ(;Õ<r%   c                ó$   • U R                  5         g r*   ©r¨  r6   s    r#   Útest_sortPackagesDefaultOrderÚ2PackageOrderingTests.test_sortPackagesDefaultOrder|  s   € Ø×ÑÕ!r%   c                ó0   • SS jnU R                  U5        g )Nc                ó‚   • [         R                  " U 5      n[        UR                  S5      5      R	                  5       nU$ )Nr•   )r   rS   r   r—   Ú	hexdigest)ÚsÚnÚds      r#   ÚsillySorterÚEPackageOrderingTests.test_sortPackagesSillyOrder.<locals>.sillySorter€  s2   € ô
 —’˜A“ˆAÜ�A—H‘H˜VÓ$Ó%×/Ñ/Ó1ˆAØˆHr%   )r±  zrunner._LoadablerJ   rb   r«  )r/   r´  s     r#   Útest_sortPackagesSillyOrderÚ0PackageOrderingTests.test_sortPackagesSillyOrder  s   € ô	ð 	×Ñ Õ,r%   )r.   r‚  NrI   )rÀ   zBCallable[[PythonModule | PythonAttribute], SupportsRichComparison]rJ   z5Generator[PythonModule | PythonAttribute, None, None])rÀ   z4Callable[[runner._Loadable], SupportsRichComparison]rJ   rK   )rL   rM   rN   rO   r,   r�  r   rS   r¨  r¬  r¶  rP   r¤   r%   r#   r}  r}  ,  sG   † ô9ð+-ØXð+-à	>ô+-ð\ NTÏ[É[ð=ØJð=à	õ=ô2"÷
-r%   r}  )r    ru  rJ   z	list[str])rW   r   rJ   zMatcher[ModuleType])5r¥   Ú
__future__r   rt   r~   r   r=  Úhashlibr   Úoperatorr   Útypesr   Útypingr   r   r	   Úhamcrestr
   r   r   Úhamcrest.core.matcherr   Útwisted.pythonr   r   Útwisted.python.modulesr   r   r   Útwisted.python.reflectr   Útwisted.trialr   r   Útwisted.trial._asyncrunnerr   Útwisted.trial.itrialr   ri   r   Úmatchersr   Ú	_typeshedr   r$   rª   r'   rZ   r\   r§   rw  r}  r¤   r%   r#   Ú<module>rÇ     s»   ðñõ #ã 	Û 
Û Ý Ý Ý ß 5Ñ 5ç :Ñ :Ý )ç )ß KÑ KÝ 1ß 4Ñ 4Ý 4Ý *Ý 'Ý æÝ0ôô!
�X×1Ñ1ô !
ôH5ô0x�×,Ñ,ô xôv}/�(×.Ñ.ô }/ô@
9�kô 9ô]-˜8×7Ñ7õ ]-r%   