选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
U e5d®Xã@sdZddlZddlZddlZddlZddlZddlZddlZddlmZm Z ddl m Z m Z m Z dZe dej¡ZGdd „d e jƒZd d „Zd d „Zdd„Zdd„Zdd„ZGdd„deƒZeƒZddd„Ze jdfdd„Zde je jfdd„Z de je jfdd„Z!dS) zLoading unittests.éN)ÚfnmatchÚ fnmatchcaseé)ÚcaseÚsuiteÚutilTz[_a-z]\w*\.py$cs,eZdZdZ‡fdd„Z‡fdd„Z‡ZS)Ú _FailedTestNcs||_tt|ƒ |¡dS©N)Ú _exceptionÚsuperrÚ__init__)ÚselfZ method_nameÚ exception©Ú __class__©ú'/usr/lib64/python3.8/unittest/loader.pyr sz_FailedTest.__init__cs*|ˆjkrttˆƒ |¡S‡fdd„}|S)Ncs ˆj‚dSr )r r©r rrÚ testFailure!sz,_FailedTest.__getattr__..testFailure)Ú_testMethodNamer rÚ __getattr__)r Únamerrrrrs  z_FailedTest.__getattr__)Ú__name__Ú __module__Ú __qualname__rr rÚ __classcell__rrrrrs rcCs"d|t ¡f}t|t|ƒ||ƒS)Nz#Failed to import test module: %s %s)Ú tracebackÚ format_excÚ_make_failed_testÚ ImportError)rÚ suiteClassÚmessagerrrÚ_make_failed_import_test&s ÿr"cCsdt ¡f}t||||ƒS)NzFailed to call load_tests: %s)rrr)rrr r!rrrÚ_make_failed_load_tests+sÿr#cCst||ƒ}||fƒ|fSr )r)Ú methodnamerr r!Útestrrrr0s rcCs<t t|ƒ¡dd„ƒ}||i}tdtjf|ƒ}|||ƒfƒS)NcSsdSr rrrrrÚ testSkipped5sz'_make_skipped_test..testSkippedZ ModuleSkipped)rÚskipÚstrÚtypeÚTestCase)r$rr r&ÚattrsZ TestClassrrrÚ_make_skipped_test4s   r,cCs*| ¡ d¡r|dd…Stj |¡dS)Nz $py.classi÷ÿÿÿr)ÚlowerÚendswithÚosÚpathÚsplitext)r0rrrÚ_jython_aware_splitext<s r2cs¬eZdZdZdZeejƒZdZ e j Z dZ ‡fdd„Zdd„Zddœd d „Zd!d d „Zd"d d„Zdd„Zd#dd„Zdd„Zdd„Zdd„Zdd„Zd$dd„Zd%dd „Z‡ZS)&Ú 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 )r r3r ÚerrorsÚsetÚ_loading_packagesrrrrr MszTestLoader.__init__cCsFt|tjƒrtdƒ‚| |¡}|s2t|dƒr2dg}| 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Ú TypeErrorÚgetTestCaseNamesÚhasattrr Úmap)r Ú testCaseClassZ testCaseNamesZ loaded_suiterrrÚloadTestsFromTestCaseTs  z TestLoader.loadTestsFromTestCase©Úpatternc Os:t|ƒdksd|kr,t dt¡| dd¡t|ƒdkrRt|ƒd}td |¡ƒ‚t|ƒdkrxt|ƒd}td |¡ƒ‚g}t|ƒD]4}t ||ƒ}t |t ƒr„t |t jƒr„| | |¡¡q„t |ddƒ} | |¡}| dk �r6z| |||ƒWStk �r4} z,t|j| |jƒ\} } |j | ¡| WY¢Sd} ~ 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)ÚlenÚwarningsÚwarnÚDeprecationWarningÚpopr9ÚformatÚsortedÚdirÚgetattrÚ isinstancer)r7rr*Úappendr>r Ú Exceptionr#rr4) r Úmoduler@ÚargsZkwsZ complaintÚtestsrÚobjrAÚeÚ error_caseÚ error_messagerrrÚloadTestsFromModulebs<ÿ          ÿ zTestLoader.loadTestsFromModulec CsX| d¡}d\}}|dkr˜|dd…}|rŒzd |¡}t|ƒ}WqŒWq&tk rˆ| ¡}t||jƒ\}}|s„|j |¡|YSYq&Xq&|dd…}|} |D]°} z| t | | ƒ} } Wq t k �rN} zvt | ddƒdk �r|dk �r|j |¡|WY¢DSt | | |jdt   ¡fƒ\}}|j |¡|WY¢ SW5d} ~ XYq Xq t| tjƒ�rj| | ¡St| tƒ�rŽt| tjƒ�rŽ| | ¡St| tjƒ�rèt| tƒ�rèt| tjƒ�rè|d}| |ƒ} tt | |ƒtjƒ�sú| | g¡Snt| tjƒ�rú| St| ƒ�rH| ƒ}t|tjƒ�r|St|tjƒ�r6| |g¡Std| |fƒ‚n 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: %séÿÿÿÿz"calling %s returned %s, not a testz$don't know how to make test from: %s)ÚsplitÚjoinÚ __import__rrFr"r r4rLrJÚAttributeErrorrrrrKÚtypesÚ ModuleTyperUr)r7rr*r>Ú FunctionTyperr8Úcallabler9)r rrNÚpartsrSrTZ parts_copyÚ module_nameZnext_attributerQÚpartÚparentrRÚinstr%rrrÚloadTestsFromNameŠs€   ÿ  ÿ ÿþ $  ÿ þ  ÿzTestLoader.loadTestsFromNamecs‡‡fdd„|Dƒ}ˆ |¡S)z�Return a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. csg|]}ˆ |ˆ¡‘qSr)rf)Ú.0r©rNr rrÚ Üsz1TestLoader.loadTestsFromNames..)r )r ÚnamesrNZsuitesrrhrÚloadTestsFromNamesØszTestLoader.loadTestsFromNamescs>‡‡fdd„}tt|tˆƒƒƒ}ˆjr:|jt ˆj¡d�|S)zLReturn a sorted sequence of method names found within testCaseClass csZ| ˆj¡sdStˆ|ƒ}t|ƒs&dSdˆjˆj|f‰ˆjdkpXt‡fdd„ˆjDƒƒS)NFz%s.%s.%sc3s|]}tˆ|ƒVqdSr )r)rgr@©ZfullNamerrÚ ìszKTestLoader.getTestCaseNames..shouldIncludeMethod..)Ú startswithÚtestMethodPrefixrJr`rrÚtestNamePatternsÚany)ÚattrnameZtestFunc©r r=rlrÚshouldIncludeMethodâs  ÿ ÿz8TestLoader.getTestCaseNames..shouldIncludeMethod)Úkey)ÚlistÚfilterrIÚsortTestMethodsUsingÚsortÚ functoolsÚ cmp_to_key)r r=rtZ testFnNamesrrsrr:ßs  zTestLoader.getTestCaseNamesútest*.pyc CsJd}|dkr|jdk r|j}n|dkr.d}|}tj |¡}|tjkrRtj d|¡||_d}d}g}tj tj |¡¡r¨tj |¡}||kr¤tj tj |d¡¡ }�npz t |ƒWnt k rÎd}Y�nJXtj |}|  d¡d} ztj tj  |j¡¡}Wnâtk �räz |j} Wntk �r8d} YnX| �r¶| jdk�r¶| jdk �ràd}|jD]P} |�s||  |¡�s|�qb|   |j dtjj¡¡d|_| |j| |dd�¡�qbn*|jtjk�rÐtdƒd‚ntd  |¡ƒd‚YnX|�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/r0ÚabspathÚsysÚinsertÚisdirÚisfilerZr[rÚmodulesrYÚdirnameÚ__file__r\Ú__spec__ÚloaderÚsubmodule_search_locationsrWrnrÚreplaceÚsepÚextendÚ _find_testsÚbuiltin_module_namesr9rGÚ _get_directory_containing_moduleÚremovervr ) r Ú start_dirr@Z top_level_dirZset_implicit_topZis_not_importableÚ is_namespacerPZ the_moduleZtop_partÚspecr0rrrÚdiscoveròs’       ÿ    ÿ ÿÿÿ þÿÿÿþÿ  zTestLoader.discovercCsRtj|}tj |j¡}tj |¡ ¡ d¡rBtj  tj  |¡¡Stj  |¡SdS)Nr}) r�r…r/r0r€r‡Úbasenamer-rnr†)r rbrNÚ full_pathrrrr�`s  z+TestLoader._get_directory_containing_modulecCsh||jkrdSttj |¡ƒ}tj ||j¡}tj |¡rBtdƒ‚| d¡rTtdƒ‚|  tjj d¡}|S)NrVzPath must be within the projectz..) rr2r/r0ÚnormpathÚrelpathÚisabsÚAssertionErrorrnr‹rŒ)r r0Z_relpathrrrrÚ_get_name_from_pathls zTestLoader._get_name_from_pathcCst|ƒtj|Sr )r[r�r…)r rrrrÚ_get_module_from_namexsz TestLoader._get_module_from_namecCs t||ƒSr )r)r r0r—r@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) rœr6Ú_find_test_pathrHr/Úlistdirr0rZÚaddÚdiscardrŽ) r r’r@r~rrPZshould_recurseÚpathsr0r—rrrrŽ€s6 ÿÿ  zTestLoader._find_testsc Csttj |¡}tj |¡�rVt |¡s(dS| |||¡s:dS| |¡}z| |¡}Wnht j k rŒ}zt |||j ƒdfWY¢Sd}~XYnÆt ||j ƒ\}} |j | ¡|dfYSXtj t|d|ƒ¡} ttj | ¡ƒ} ttj |¡ƒ} |  ¡|  ¡k�r@tj | ¡} ttj |¡ƒ}tj |¡}d}t||| |fƒ‚|j||d�dfS�ntj |¡�rl|�s†tj tj |d¡¡�s†dSd}d}| |¡}z| |¡}Wnjt j k �râ}zt |||j ƒdfWY¢Sd}~XYnˆt ||j ƒ\}} |j | ¡|dfYSXt|ddƒ}|j |¡z0|j||d�}|dk �rP|dfW¢S|d fW¢S|j |¡XndSdS) zÉUsed 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). )NFFNr‡zW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?r?r}rAT)r/r0r–r„ÚVALID_MODULE_NAMEÚmatchržrœr�rZSkipTestr,r r"r4rLr€rJr2Úrealpathr-r†rrUrƒrZr6r¡r¢)r r—r@r~r–rrNrRrSrTZmod_filer¦Zfullpath_noextZ module_dirZmod_nameZ expected_dirÚmsgrArPÚpackagerrrrŸ¢s|   & ÿ  ÿ ÿ ÿ  ÿ  ÿÿ & ÿ      zTestLoader._find_test_path)N)N)r|N)F)F)rrrÚ__doc__roÚ staticmethodrÚ three_way_cmprxrprr8r rr r>rUrfrkr:r•r�rœr�ržrŽrŸrrrrrr3Bs&  ( N  n   "r3cCs&tƒ}||_||_||_|r"||_|Sr )r3rxrorpr )ÚprefixÚ sortUsingr rpr‰rrrÚ _makeLoaderñsr®cCst|||d� |¡S)N)rp)r®r:)r=r¬r­rprrrr:úsr:r%cCst|||ƒ |¡Sr )r®r>)r=r¬r­r rrrÚ makeSuiteýs ÿr¯cCst|||ƒ |¡Sr )r®rU)rNr¬r­r rrrÚ findTestCasess ÿr°)NN)"r©r/Úrer�rr]rzrCrrÚrrrZ __unittestÚcompileÚ IGNORECASEr¤r*rr"r#rr,r2Úobjectr3ZdefaultTestLoaderr®r«r:r8r¯r°rrrrÚs</ ÿ ÿ