Your IP : 13.59.36.36


Current Path : /opt/alt/python33/lib64/python3.3/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/unittest/__pycache__/loader.cpython-33.pyc

�
��f;6c@s?dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZeZ
ejdej�Zdd�Zd	d
�Zdd�Zd
d�ZGdd�de�Ze�Zedd�Zejdd�Zdeje
jdd�Zdeje
jdd�ZdS(uLoading unittests.iN(ufnmatchi(ucaseusuiteuutilu[_a-z]\w*\.py$cCs/d|tj�f}td|t|�|�S(Nu#Failed to import test module: %s
%suModuleImportFailure(u	tracebacku
format_excu_make_failed_testuImportError(unameu
suiteClassumessage((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_make_failed_import_testsu_make_failed_import_testcCstd|||�S(NuLoadTestsFailure(u_make_failed_test(unameu	exceptionu
suiteClass((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_make_failed_load_testssu_make_failed_load_testscsJ�fdd�}i||6}t|tjf|�}|||�f�S(Ncs
��dS(N((uself(u	exception(u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyutestFailuresu&_make_failed_test.<locals>.testFailure(utypeucaseuTestCase(u	classnameu
methodnameu	exceptionu
suiteClassutestFailureuattrsu	TestClass((u	exceptionu4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_make_failed_tests
u_make_failed_testcCs7|j�jd�r#|dd�Stjj|�dS(Nu	$py.classi	ii����(uloweruendswithuosupathusplitext(upath((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_jython_aware_splitext%su_jython_aware_splitextcBs�|EeZdZdZdZeej�Ze	j
ZdZ
dd�Zddd�Zddd�Zdd	d
�Zdd�Zd
ddd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS(u
TestLoaderu�
    This class is responsible for loading tests according to various criteria
    and returning them wrapped in a TestSuite
    utestcCsnt|tj�r!td��n|j|�}|rRt|d�rRdg}n|jt||��}|S(u<Return a suite of all tests cases contained in testCaseClassuYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?urunTest(u
issubclassusuiteu	TestSuiteu	TypeErrorugetTestCaseNamesuhasattru
suiteClassumap(uselfu
testCaseClassu
testCaseNamesuloaded_suite((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyuloadTestsFromTestCase5su TestLoader.loadTestsFromTestCasecCs�g}x]t|�D]O}t||�}t|t�rt|tj�r|j|j|��qqWt|dd�}|j
|�}|r�|dk	r�y|||d�SWq�tk
r�}zt|j
||j
�SWYdd}~Xq�Xn|S(u?Return a suite of all tests cases contained in the given moduleu
load_testsN(udirugetattru
isinstanceutypeu
issubclassucaseuTestCaseuappenduloadTestsFromTestCaseuNoneu
suiteClassu	Exceptionu_make_failed_load_testsu__name__(uselfumoduleuuse_load_testsutestsunameuobju
load_testsue((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyuloadTestsFromModule@s! uTestLoader.loadTestsFromModulec
Cs|jd�}|dkr�|dd�}xL|ryytdj|��}PWq.tk
ru|d=|sq�nYq.Xq.W|dd�}n|}x$|D]}|t||�}}q�Wt|tj�r�|j	|�St|t
�rt|tj
�r|j|�St|tj�r~t|t
�r~t|tj
�r~|d}||�}tt||�tj�s�|j|g�Snt|tj�r�|St|�r�|�}	t|	tj�r�|	St|	tj
�r�|j|	g�Std||	f��ntd|��dS(uTReturn a suite of all tests 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.
        u.Niu"calling %s returned %s, not a testu$don't know how to make test from: %si����i����(usplituNoneu
__import__ujoinuImportErrorugetattru
isinstanceutypesu
ModuleTypeuloadTestsFromModuleutypeu
issubclassucaseuTestCaseuloadTestsFromTestCaseuFunctionTypeu
suiteClassusuiteu	TestSuiteucallableu	TypeError(
uselfunameumoduleupartsu
parts_copyuobjupartuparentuinstutest((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyuloadTestsFromNameRsJ		


!

	uTestLoader.loadTestsFromNamecs)��fdd�|D�}�j|�S(u�Return a suite of all tests cases found using the given sequence
        of string specifiers. See 'loadTestsFromName()'.
        cs"g|]}�j|���qS((uloadTestsFromName(u.0uname(umoduleuself(u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu
<listcomp>�s	u1TestLoader.loadTestsFromNames.<locals>.<listcomp>(u
suiteClass(uselfunamesumoduleusuites((umoduleuselfu4/opt/alt/python33/lib64/python3.3/unittest/loader.pyuloadTestsFromNames�suTestLoader.loadTestsFromNamescCs\||jdd�}tt|t|���}|jrX|jdtj|j��n|S(uLReturn a sorted sequence of method names found within testCaseClass
        cSs"|j|�o!tt||��S(N(u
startswithucallableugetattr(uattrnameu
testCaseClassuprefix((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyuisTestMethod�su1TestLoader.getTestCaseNames.<locals>.isTestMethodukey(utestMethodPrefixulistufilterudirusortTestMethodsUsingusortu	functoolsu
cmp_to_key(uselfu
testCaseClassuisTestMethodutestFnNames((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyugetTestCaseNames�s	uTestLoader.getTestCaseNamesutest*.pyc	
Cs�d}|dkr-|jdk	r-|j}n|dkrHd}|}ntjj|�}|tjkrtjjd|�n||_d}tjj	tjj|��r�tjj|�}||kr�tjj
tjj|d��}q�n�yt|�Wnt
k
rd}YnmXtj|}|jd�d}tjjtjj|j��}|r�|j|�|_tjj|�n|r�t
d|��nt|j||��}|j|�S(uRFind 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.

        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().
        iu__init__.pyu.u%Start directory is not importable: %rFNT(uFalseuNoneu_top_level_diruTrueuosupathuabspathusysuinsertuisdiruisfileujoinu
__import__uImportErrorumodulesusplitudirnameu__file__u _get_directory_containing_moduleuremoveulistu_find_testsu
suiteClass(	uselfu	start_dirupatternu
top_level_diruset_implicit_topuis_not_importableu
the_moduleutop_partutests((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyudiscover�s:		(

!uTestLoader.discovercCsstj|}tjj|j�}tjj|�j�jd�r_tjj	tjj	|��Stjj	|�SdS(Nu__init__.py(
usysumodulesuosupathuabspathu__file__ubasenameuloweru
startswithudirname(uselfumodule_nameumoduleu	full_path((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu _get_directory_containing_module�s

!u+TestLoader._get_directory_containing_modulecCs�ttjj|��}tjj||j�}tjj|�sOtd��|jd�sktd��|j	tjj
d�}|S(NuPath must be within the projectu..u.(u_jython_aware_splitextuosupathunormpathurelpathu_top_level_diruisabsuAssertionErroru
startswithureplaceusep(uselfupathu_relpathuname((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_get_name_from_path�suTestLoader._get_name_from_pathcCst|�tj|S(N(u
__import__usysumodules(uselfuname((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_get_module_from_name�s
u TestLoader._get_module_from_namecCs
t||�S(N(ufnmatch(uselfupathu	full_pathupattern((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_match_path�suTestLoader._match_pathccs�tj|�}x�|D]�}tjj||�}tjj|�r�tj|�sXqn|j|||�ssqn|j|�}y|j	|�}Wnt
||j�VYq�Xtjjt
|d|��}ttjj|��}	ttjj|��}
|	j�|
j�krutjj|	�}ttjj|��}tjj|�}
d}t||||
f��n|j|�Vqtjj|�rtjjtjj|d��s�qnd}d}t||�r"|j|�}|j	|�}t
|dd�}|j|dd�}n|dkrg|dk	rB|Vnxv|j||�D]}|VqUWq�y||||�VWq�tk
r�}zt|j||j�VWYdd}~Xq�XqqWdS(u/Used by discovery. Yields test suites it loads.u__file__uW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?u__init__.pyu
load_testsuuse_load_testsNF(uosulistdirupathujoinuisfileuVALID_MODULE_NAMEumatchu_match_pathu_get_name_from_pathu_get_module_from_nameu_make_failed_import_testu
suiteClassuabspathugetattru_jython_aware_splitexturealpathulowerudirnameubasenameuImportErroruloadTestsFromModuleuisdiruNoneufnmatchuFalseu_find_testsu	Exceptionu_make_failed_load_testsu__name__(uselfu	start_dirupatternupathsupathu	full_pathunameumoduleumod_fileurealpathufullpath_noextu
module_dirumod_nameuexpected_dirumsgu
load_testsutestsupackageutestue((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_find_tests�sV
!uTestLoader._find_testsNT(u__name__u
__module__u__qualname__u__doc__utestMethodPrefixustaticmethoduutilu
three_way_cmpusortTestMethodsUsingusuiteu	TestSuiteu
suiteClassuNoneu_top_level_diruloadTestsFromTestCaseuTrueuloadTestsFromModuleuloadTestsFromNameuloadTestsFromNamesugetTestCaseNamesudiscoveru _get_directory_containing_moduleu_get_name_from_pathu_get_module_from_nameu_match_pathu_find_tests(u
__locals__((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu
TestLoader+s 	3@
u
TestLoadercCs1t�}||_||_|r-||_n|S(N(u
TestLoaderusortTestMethodsUsingutestMethodPrefixu
suiteClass(uprefixu	sortUsingu
suiteClassuloader((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu_makeLoader2s			u_makeLoadercCst||�j|�S(N(u_makeLoaderugetTestCaseNames(u
testCaseClassuprefixu	sortUsing((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyugetTestCaseNames:sugetTestCaseNamesutestcCst|||�j|�S(N(u_makeLoaderuloadTestsFromTestCase(u
testCaseClassuprefixu	sortUsingu
suiteClass((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu	makeSuite=su	makeSuitecCst|||�j|�S(N(u_makeLoaderuloadTestsFromModule(umoduleuprefixu	sortUsingu
suiteClass((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu
findTestCasesBsu
findTestCases(u__doc__uosureusysu	tracebackutypesu	functoolsufnmatchuucaseusuiteuutiluTrueu
__unittestucompileu
IGNORECASEuVALID_MODULE_NAMEu_make_failed_import_testu_make_failed_load_testsu_make_failed_testu_jython_aware_splitextuobjectu
TestLoaderudefaultTestLoaderuNoneu_makeLoaderu
three_way_cmpugetTestCaseNamesu	TestSuiteu	makeSuiteu
findTestCases(((u4/opt/alt/python33/lib64/python3.3/unittest/loader.pyu<module>s.�			

?>