%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/unittest/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/unittest/__pycache__/loader.cpython-38.pyc

U

qaX@sdZddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZmZm
Z
dZedejZGdd	d	ejZd
dZdd
ZddZddZddZGdddeZeZdddZe
jdfddZde
jejfddZ de
jejfddZ!dS) zLoading unittests.N)fnmatchfnmatchcase)casesuiteutilTz[_a-z]\w*\.py$cs,eZdZdZfddZfddZZS)_FailedTestNcs||_tt||dSN)
_exceptionsuperr__init__)selfZmethod_name	exception	__class__+/usr/local/lib/python3.8/unittest/loader.pyrsz_FailedTest.__init__cs*|jkrtt|Sfdd}|S)Ncs
jdSr	)r
rr
rrtestFailure!sz,_FailedTest.__getattr__.<locals>.testFailure)_testMethodNamerr__getattr__)r
namerrrrrs
z_FailedTest.__getattr__)__name__
__module____qualname__rrr
__classcell__rrrrrsrcCs"d|tf}t|t|||S)Nz#Failed to import test module: %s
%s)	traceback
format_exc_make_failed_testImportError)r
suiteClassmessagerrr_make_failed_import_test&s
r"cCsdtf}t||||S)NzFailed to call load_tests:
%s)rrr)rrr r!rrr_make_failed_load_tests+sr#cCst||}||f|fSr	)r)
methodnamerr r!testrrrr0s
rcCs<tt|dd}||i}tdtjf|}|||fS)NcSsdSr	rrrrrtestSkipped5sz'_make_skipped_test.<locals>.testSkippedZ
ModuleSkipped)rskipstrtypeTestCase)r$rr r&ZattrsZ	TestClassrrr_make_skipped_test4s

r+cCs*|dr|ddStj|dS)Nz	$py.classir)lowerendswithospathsplitext)r/rrr_jython_aware_splitext<sr1cseZdZdZdZeejZdZ	e
jZdZ
fddZddZddd	d
Zd!ddZd"d
dZddZd#ddZddZddZddZddZd$ddZd%dd ZZS)&
TestLoaderz
    This class is responsible for loading tests according to various criteria
    and returning them wrapped in a TestSuite
    r%Ncs tt|g|_t|_dSr	)rr2rerrorsset_loading_packagesrrrrrMszTestLoader.__init__cCsFt|tjrtd||}|s2t|dr2dg}|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?ZrunTest)
issubclassr	TestSuite	TypeErrorgetTestCaseNameshasattrr map)r

testCaseClassZ
testCaseNamesZloaded_suiterrrloadTestsFromTestCaseTs
z TestLoader.loadTestsFromTestCasepatternc

Os:t|dksd|kr,tdt|ddt|dkrRt|d}td|t|dkrxt|d}td|g}t|D]4}t	||}t
|trt|t
jr|||qt	|dd}	||}|	dk	r6z|	|||WStk
r4}
z,t|j|
|j\}}|j||WYSd}
~
XYnX|S)	z>Return a suite of all test cases contained in the given modulerZuse_load_testsz(use_load_tests is deprecated and ignoredNrzCloadTestsFromModule() takes 1 positional argument but {} were givenz=loadTestsFromModule() got an unexpected keyword argument '{}'
load_tests)lenwarningswarnDeprecationWarningpopr8formatsorteddirgetattr
isinstancer)r6rr*appendr=r 	Exceptionr#rr3)
r
moduler?argskwsZ	complainttestsrobjr@e
error_case
error_messagerrrloadTestsFromModulebs<


zTestLoader.loadTestsFromModulecCsX|d}d\}}|dkr|dd}|rzd|}t|}WqWq&tk
r|}t||j\}}|s|j||YSYq&Xq&|dd}|}	|D]}
z|	t	|	|
}}	Wqt
k
rN}zvt	|	dddk	r|dk	r|j||WYDSt|
||jdt
f\}}|j||WY
SW5d}~XYqXqt|	tjrj||	St|	trt|	tjr||	St|	tjrt|trt|tjr|d}||}
tt	|
|tjs||
gSnt|	tjr|	St|	rH|	}t|tjr|St|tjr6||gStd|	|fntd	|	dS)
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:
%sz"calling %s returned %s, not a testz$don't know how to make test from: %s)splitjoin
__import__rrEr"r r3rKrIAttributeErrorrrrrJtypes
ModuleTyperUr)r6rr*r=FunctionTyperr7callabler8)r
rrMpartsrSrTZ
parts_copymodule_nameZnext_attributerQpartparentrRinstr%rrrloadTestsFromNames	

$



zTestLoader.loadTestsFromNamecsfdd|D}|S)zReturn a suite of all test cases found using the given sequence
        of string specifiers. See 'loadTestsFromName()'.
        csg|]}|qSr)rf).0rrMr
rr
<listcomp>sz1TestLoader.loadTestsFromNames.<locals>.<listcomp>)r )r
namesrMZsuitesrrhrloadTestsFromNamesszTestLoader.loadTestsFromNamescs>fdd}tt|t}jr:|jtjd|S)zLReturn a sorted sequence of method names found within testCaseClass
        csZ|jsdSt|}t|s&dSdjj|fjdkpXtfddjDS)NFz%s.%s.%sc3s|]}t|VqdSr	)r)rgr?ZfullNamerr	<genexpr>szKTestLoader.getTestCaseNames.<locals>.shouldIncludeMethod.<locals>.<genexpr>)
startswithtestMethodPrefixrIr`rrtestNamePatternsany)attrnameZtestFuncr
r<rlrshouldIncludeMethods

z8TestLoader.getTestCaseNames.<locals>.shouldIncludeMethod)key)listfilterrHsortTestMethodsUsingsort	functools
cmp_to_key)r
r<rtZtestFnNamesrrsrr9s
zTestLoader.getTestCaseNamestest*.pycCsJd}|dkr|jdk	r|j}n|dkr.d}|}tj|}|tjkrRtjd|||_d}d}g}tjtj|rtj|}||krtjtj|d}npzt	|Wnt
k
rd}YnJXtj|}|dd}	ztjtj
|j}Wntk
rz
|j}
Wntk
r8d}
YnX|
r|
jdkr|
jdk	rd}|jD]P}|s|||s|qb||jdtjjd|_||j||ddqbn*|jtjkrtddntd	|dYnX|r|s||	|_tj|ntj||r*t
d
||s@t|||}| |S)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__.pyrV)	namespacez2Can not use builtin modules as dotted module namesz$don't know how to discover from {!r}z%Start directory is not importable: %r)!_top_level_dirr.r/abspathsysinsertisdirisfilerZr[rmodulesrYdirname__file__r\__spec__loadersubmodule_search_locationsrWrnrreplacesepextend_find_testsbuiltin_module_namesr8rF _get_directory_containing_moduleremovervr )r
	start_dirr?Z
top_level_dirZset_implicit_topZis_not_importableis_namespacerPZ
the_moduleZtop_partspecr/rrrdiscovers






zTestLoader.discovercCsRtj|}tj|j}tj|drBtj	tj	|Stj	|SdS)Nr})
rrr.r/rrbasenamer,rnr)r
rbrM	full_pathrrrr`s

z+TestLoader._get_directory_containing_modulecCsh||jkrdSttj|}tj||j}tj|rBtd|drTtd|	tjj
d}|S)NrVzPath must be within the projectz..)rr1r.r/normpathrelpathisabsAssertionErrorrnrr)r
r/Z_relpathrrrr_get_name_from_pathls
zTestLoader._get_name_from_pathcCst|tj|Sr	)r[rr)r
rrrr_get_module_from_namexsz TestLoader._get_module_from_namecCs
t||Sr	)r)r
r/rr?rrr_match_path|szTestLoader._match_pathFc

cs||}|dkrD||jkrD||||\}}|dk	r<|V|sDdStt|}|D]t}tj||}	||	||\}}|dk	r|V|rV||	}|j|z|
|	||EdHW5|j	|XqVdS)z/Used by discovery. Yields test suites it loads.rVN)rr5_find_test_pathrGr.listdirr/rZadddiscardr)
r
rr?r~rrPZshould_recursepathsr/rrrrrs6

zTestLoader._find_testsc
Csttj|}tj|rVt|s(dS||||s:dS||}z||}Wnht	j
k
r}zt|||jdfWYSd}~XYnt
||j\}}	|j|	|dfYSXtjt|d|}
ttj|
}ttj|}||kr@tj|}
ttj|}tj|}d}t|||
|f|j||ddfSntj|rl|stjtj|dsdSd}d}||}z||}Wnjt	j
k
r}zt|||jdfWYSd}~XYnt
||j\}}	|j|	|dfYSXt|dd}|j|z0|j||d}|dk	rP|dfWS|d	fWS|j|XndSdS)
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).
        )NFFNrzW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?r>r}r@T)r.r/rrVALID_MODULE_NAMEmatchrrrrZSkipTestr+r r"r3rKrrIr1realpathr,rrrUrrZr5rr)r
rr?r~rrrMrRrSrTZmod_filerZfullpath_noextZ
module_dirZmod_nameZexpected_dirmsgr@rPpackagerrrrs|

&





&

zTestLoader._find_test_path)N)N)r|N)F)F)rrr__doc__rostaticmethodr
three_way_cmprxrprr7r rrr=rUrfrkr9rrrrrrrrrrrrr2Bs&
(
N

n
"r2cCs&t}||_||_||_|r"||_|Sr	)r2rxrorpr )prefix	sortUsingr rprrrr_makeLoadersrcCst|||d|S)N)rp)rr9)r<rrrprrrr9sr9r%cCst||||Sr	)rr=)r<rrr rrr	makeSuitesrcCst||||Sr	)rrU)rMrrr rrr
findTestCasessr)NN)"rr.rerrr]rzrBrrrrrZ
__unittestcompile
IGNORECASErr*rr"r#rr+r1objectr2ZdefaultTestLoaderrrr9r7rrrrrr<module>s</
	


Zerion Mini Shell 1.0