python (3.12.0)

(root)/
lib/
python3.12/
unittest/
__pycache__/
loader.cpython-312.opt-1.pyc

̑ehPdZddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZdZ
ejdejZGdd	e
j"Zd
ZdZdZd
ZdZGddeZeZddZej8dfdZdej8ej<fdZdej8ej<fdZ y)zLoading unittests.N)fnmatchfnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c,eZdZdZfdZfdZxZS)_FailedTestNc:||_tt||yN)
_exceptionsuperr
__init__)selfmethod_name	exception	__class__s   C/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/unittest/loader.pyrz_FailedTest.__init__s#
k4)+6cX|jk7rtt|Sfd}|S)Ncjr)r
rsrtestFailurez,_FailedTest.__getattr__.<locals>.testFailure s
//!r)_testMethodNamerr
__getattr__)rnamerrs`  rrz_FailedTest.__getattr__s.4'''d7==	"r)__name__
__module____qualname__rrr
__classcell__rs@rr
r
sO7rr
cdd|dtj}t|t|||S)NzFailed to import test module: 
)	traceback
format_exc_make_failed_testImportError)r
suiteClassmessages   r_make_failed_import_testr*%s-i""$&GT;w#7WMMrcLdtj}t||||S)NzFailed to call load_tests:
)r$r%r&)rrr(r)s    r_make_failed_load_testsr,*s)2;2F2F2HJGiW..rc0t||}||f|fSr)r
)
methodnamerr(r)tests     rr&r&/s z9-Dtg''rctjt|d}||i}tdtjf|}|||fS)Ncyrrs rtestSkippedz'_make_skipped_test.<locals>.testSkipped4sr
ModuleSkipped)rskipstrtypeTestCase)r.rr(r3attrs	TestClasss      r_make_skipped_testr;3sS	YYs9~


%E_t}}&6>Iy,.//rcFtjj|dS)Nr)ospathsplitext)r>s r	_splitextr@;s
77D!!$$rceZdZdZdZeejZdZ	e
jZdZ
fdZdZdddZddZdd	Zd
ZddZdZd
ZdZdZdZdZxZS)
TestLoaderz
    This class is responsible for loading tests according to various criteria
    and returning them wrapped in a TestSuite
    r/NcVtt|g|_t	|_yr)rrBrerrorsset_loading_packages)rrs rrzTestLoader.__init__Js#
j$(*"%rct|tjrtd|j	|}|st|drdg}|j
t||}|S)z;Return a suite of all test cases contained in testCaseClasszYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?runTest)
issubclassr	TestSuite	TypeErrorgetTestCaseNameshasattrr(map)r
testCaseClass
testCaseNamesloaded_suites    rloadTestsFromTestCasez TestLoader.loadTestsFromTestCaseQsbmU__5()
)--m<
	!B&KMs=-'HIrpatterncg}t|D]Z}t||}t|ts t	|t
js;|j|j|\t|dd}|j|}|	||||S|S#t$rK}t|j||j\}}	|jj|	|cYd}~Sd}~wwxYw)z>Return a suite of all test cases contained in the given module
load_testsN)dirgetattr
isinstancer7rIrr8appendrRr(	Exceptionr,rrD)
rmodulerTtestsrobjrVe
error_case
error_messages
          rloadTestsFromModulezTestLoader.loadTestsFromModule]sK	>D&$'C#t$C)GT77<=	>
V\48
&!
"!$w77
",COOQ-9)
M""=1!!	
"s	B	C,!AC'!C,'C,c
|jd}d\}}|*|dd}|r	dj|}t|}	|dd}|}	|D]}
	|	t|	|
}	}t|	tj r|j#|	St|	t$r+t'|	t(j*r|j-|	St|	tj.rmtt$r]t'|t(j*rC|d}||}
tt|
|tj.s.|j
|
gSt|	t0j2r|	St5|	ra|	}t|t0j2r|St|t(j*r|j
|gSt7d|	d	|d
t7d|	z#t$rM|j	}t||j\}}|s|jj||cYSYnwxYw|r#t$r}t|	dd&|$|jj||cYd}~cSt|
||jdtj\}}|jj||cYd}~cSd}~wwxYw)aSReturn a suite of all test cases given a string specifier.

        The name may resolve either to a module, a test case class, a
        test method within a test case class, or a callable object which
        returns a TestCase or TestSuite instance.

        The method optionally resolves the names relative to a given module.
        .NNNr__path__zFailed to access attribute:
zcalling z
 returned z, not a testz$don't know how to make test from: %s)splitjoin
__import__r'popr*r(rDrZrXAttributeErrorr&r$r%rYtypes
ModuleTyperbr7rIrr8rRFunctionTyperrJcallablerK)rrr\partsr`ra
parts_copymodule_namenext_attributer^partparentr_instr/s               rloadTestsFromNamezTestLoader.loadTestsFromNameqs

3$.!
M>qJ*"%((:"6K'4F!"IE	&D
&!73#5	&.c5++,++C00
T
"z#t}}'E--c22e001&/9D$<DgdD153E3EFv..
U__
-JC=5D$0D$--0v..!$d!,--BSHIIu#*%/^^%5N0H&19-J
%**=9))&*&"
&CT2>".KK&&}5%%1Ba%002516-J
KK&&}5%%%
&s=GH=AH43H4=	K+K
1K9AK
K
Kcl|Dcgc]}|j||}}|j|Scc}w)zReturn a suite of all test cases found using the given sequence
        of string specifiers. See 'loadTestsFromName()'.
        )rxr()rnamesr\rsuitess     rloadTestsFromNameszTestLoader.loadTestsFromNamess;DII4$((v6IIv&&Js1cfd}tt|t}jr/|j	tjj|S)zLReturn a sorted sequence of method names found within testCaseClass
        c|jjsyt|}t|sydjj
|fzjduxstfdjDS)NFz%s.%s.%sc36K|]}t|ywr)r).0rTfullNames  r	<genexpr>zKTestLoader.getTestCaseNames.<locals>.shouldIncludeMethod.<locals>.<genexpr>sXwK'2Xs)
startswithtestMethodPrefixrXrprrtestNamePatternsany)attrnametestFuncrrrOs  @rshouldIncludeMethodz8TestLoader.getTestCaseNames.<locals>.shouldIncludeMethods&&t'<'<=}h7HH%!((-*D*Dh&H((D0YX$BWBWXX
Yr)key)listfilterrWsortTestMethodsUsingsort	functools
cmp_to_key)rrOrtestFnNamess``  rrLzTestLoader.getTestCaseNamessS
	Y6"5s=7IJK$$!5!5d6O6O!PQrcd}||j
|j}n|d}|}tjj|}|tjvr tjjd|||_d}tjj
tjj|rctjj|}||k7rtjjtjj|d}n	t|tj|}|jdd}	tjjtjj|j}|r6|j%||_tjj'|	|rt)d	|zt+|j-||}|j/|S#t$r8|jtj vrt#ddt#d|dwxYw#t($rd}YwxYw)
a%Find and return all test modules from the specified start
        directory, recursing into subdirectories to find them and return all
        tests found within them. Only test files that match the pattern will
        be loaded. (Using shell style pattern matching.)

        All test modules must be importable from the top level of the project.
        If the start directory is not the top level directory then the top
        level directory must be specified separately.

        If a test package name (directory with '__init__.py') matches the
        pattern then the package will be checked for a 'load_tests' function. If
        this exists then it will be called with (loader, tests, pattern) unless
        the package has already had load_tests called from the same discovery
        invocation, in which case the package module object is not scanned for
        tests - this ensures that when a package uses discover to further
        discover child tests that infinite recursion does not happen.

        If load_tests exists then discovery does *not* recurse into the package,
        load_tests is responsible for loading all tests in the package.

        The pattern is deliberately not stored as a loader attribute so that
        packages can continue discovery themselves. top_level_dir is stored so
        load_tests does not need to pass this argument in to loader.discover().

        Paths are sorted before being imported to ensure reproducible execution
        order even on filesystems with non-alphabetical ordering like ext3/4.
        FNTr__init__.pyrdz2Can not use builtin modules as dotted module namesz don't know how to discover from z%Start directory is not importable: %r)_top_level_dirr=r>abspathsysinsertisdirisfilerirjmodulesrhdirname__file__rlrbuiltin_module_namesrK _get_directory_containing_moduleremover'r_find_testsr()	r	start_dirrT
top_level_dirset_implicit_topis_not_importable
the_moduletop_partr]s	         rdiscoverzTestLoader.discovers8! T%8%8%D //M

"#%M
6
(

HHOOA}-+!
77==34	2IM)(*rww||I}7](^$^!
39%![[3
$??3/2( ")<)<>!@I$*.*O*OPX*YD'HHOOM2E	QRRT%%i9:u%%%&(!**c.F.FF')ABGKL(>znM#'(
(
)$(!
)s IAHAIIIctj|}tjj	|j
}tjj
|jjdr<tjjtjj|Stjj|S)Nr)
rrr=r>rrbasenamelowerrr)rrsr\	full_paths    rrz+TestLoader._get_directory_containing_module,s[)GGOOFOO4	
77I&,,.99-H77??277??9#=>>
77??9--rc||jk(ryttjj	|}tjj||j}|j
tjjd}|S)Nrd)rr@r=r>normpathrelpathreplacesep)rr>_relpathrs    r_get_name_from_pathzTestLoader._get_name_from_path8sg4&&&))$/077??4)<)<=S1rc>t|tj|Sr)rjrr)rrs  r_get_module_from_namez TestLoader._get_module_from_nameDs4{{4  rct||Sr)r)rr>rrTs    r_match_pathzTestLoader._match_pathHstW%%rc#^K|j|}|dk7r,||jvr|j||\}}|||sytt	j
|}|D]}tjj||}|j||\}}|||sA|j|}|jj|	|j||Ed{|jj|y7"#|jj|wxYww)z/Used by discovery. Yields test suites it loads.rdN)rrF_find_test_pathsortedr=listdirr>riaddrdiscard)	rrrTrr]should_recursepathsr>rs	         rrzTestLoader._find_testsLs#''	23;4t'='==%)$8$8G$L!E> !rzz),-	9DY5I$($8$8G$L!E> //	:&&**409#//	7CCC**2248	9D**2248s6B#D-&,D-D
(D)D
-D-D

D**D-cztjj|}tjj|rvtj|sy|j
|||sy|j|}	|j|}tjjt|d|}ttjj|}ttjj|}|j|jk7rytjj|}	ttjj|}
tjj|}d}t||
|	|fz|j!||dfStjj1|rtjjtjj3|dsyd}d}|j|}	|j|}t|dd}|j4j7|	|j!||}||df|j4j9|S|d	f|j4j9|Sy#t"j$$r#}
t'||
|j(dfcYd}
~
Sd}
~
wt+||j(\}}|j,j/||dfcYSxYw#|j4j9|wxYw#t"j$$r#}
t'||
|j(dfcYd}
~
Sd}
~
wt+||j(\}}|j,j/||dfcYSxYw)
zUsed by discovery.

        Loads tests from a single file, or a directories' __init__.py when
        passed the directory.

        Returns a tuple (None_or_tests_from_file, should_recurse).
        )NFrzW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?rSFNrrVT)r=r>rrVALID_MODULE_NAMEmatchrrrrrXr@realpathrrr'rbrSkipTestr;r(r*rDrZrrirFrr)rrrTrrr\mod_filerfullpath_noext
module_dirmod_nameexpected_dirmsgr_r`rarVr]packages                   rrzTestLoader._find_test_pathls%77##I.
77>>)$$**84"##HiA"++I6D
P33D977??FJ	:<$GG$$X.0!*GG$$Y/"1>>#~';';'==!#!:J(((3 5H#%77??9#=LDC%x\BBDD///H%OO
WW]]9
%77>>"'',,y-"HI"JE++I6D
944T:%WlDA
&&**409 44Wg4NE!-$e|**2248!$;**2248k==
K)$4??CUJJ
),T4??C*
M""=1!5((Z**2248%==
K)$4??CUJJ
),T4??C*
M""=1!5((sN<J7)M
#L*L*7L'
K("L'(=L'*M
N:M;5N:;=N:r)ztest*.pyN)rrr__doc__rstaticmethodr
three_way_cmprrrrJr(rrrRrbrxr|rLrrrrrrrr r!s@rrBrB?s'(:(:;JN'
6:(LJ\'&Q&f
.
!&9@HrrBcVt}||_||_||_|r||_|Sr)rBrrrr()prefix	sortUsingr(rloaders     r_makeLoaderrs1
\F"+F$F.F&Mrctddl}|jdtdt|||j	|S)Nrzunittest.getTestCaseNames() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.getTestCaseNames() instead.
stacklevel)r)warningswarnDeprecationWarningrrL)rOrrrrs     rrLrLs?MM	Eq
vy;KL]]^kllrr/crddl}|jdtdt|||j	|S)Nrzunittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.rr)rrrrrR)rOrrr(rs     r	makeSuitersBMM	Jq
vy*5KKrcrddl}|jdtdt|||j	|S)Nrzunittest.findTestCases() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromModule() instead.rr)rrrrrb)r\rrr(rs     r
findTestCasesrsBMM	Hq
vy*5IIrre)!rr=rerr$rmrrrrrr
__unittestcompile
IGNORECASErr8r
r*r,r&r;r@objectrBdefaultTestLoaderrrrLrJrrr2rr<module>rs		
(


BJJ0"--@$--N
.
(0%uupL7;6H6H[_m%+d6H6H	"(43E3E"__	r