Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 107

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 234

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 235

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 236

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 237

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 238

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 239
U i_@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlmZmZmZmZmZdZeZdZGdd d eZGd d d eZGd d d eZGdddeZddZgZddZddZ ddZ!ddZ"ddZ#ddZ$ddZ%Gd d!d!Z&Gd"d#d#e&Z'Gd$d%d%e'Z(Gd&d'd'e'Z)e*d(d)d*gZ+Gd+d,d,ej,Z-Gd-d.d.e&Z.Gd/d0d0ej/Z0Gd1d2d2eZ1Gd3d4d4e1Z2Gd5d6d6e1Z3dS)7zTest case implementationN)result)strclass safe_repr_count_diff_all_purpose_count_diff_hashable_common_shorten_reprTz@ Diff is %s characters long. Set self.maxDiff to None to see it.c@seZdZdZdS)SkipTestz Raise this exception in a test to skip it. Usually you can use TestCase.skipTest() or one of the skipping decorators instead of raising this directly. N__name__ __module__ __qualname____doc__rr,/opt/python38/lib/python3.8/unittest/case.pyr sr c@seZdZdZdS) _ShouldStopz The test should stop. Nr rrrrr"src@seZdZdZdS)_UnexpectedSuccessz7 The test was supposed to fail, but it didn't! Nr rrrrr'src@s&eZdZdddZejdddZdS) _OutcomeNcCs4d|_||_t|d|_d|_g|_d|_g|_dS)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessskippedexpectedFailureerrors)selfrrrr__init__.s z_Outcome.__init__Fc cs|j}d|_zz dVWntk r.Yntk rh}zd|_|j|t|fW5d}~XYnjtk rzYnXt}|j r||_ nd|_|j ||fd}YnX|j r|jr|j |dfW5|jo||_XdS)NTF) rKeyboardInterruptr rappendstrrsysexc_inforrrr)r test_caseisTestZ old_successer"rrrtestPartExecutor7s* $  z_Outcome.testPartExecutor)N)F)r r r r contextlibcontextmanagerr&rrrrr-s rcCs|SNr)objrrr_idUsr+cOst|||fdS)znSame as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).N)_module_cleanupsr)functionargskwargsrrraddModuleCleanupZsr0c Csdg}trTt\}}}z|||Wqtk rP}z||W5d}~XYqXq|r`|ddS)zWExecute all module cleanup functions. Normally called for you after tearDownModule.Nr)r,pop Exceptionr) exceptionsr-r.r/excrrrdoModuleCleanups`sr5cs,fdd}ttjr(}d||S|S)z& Unconditionally skip a test. cs4t|ts$t|fdd}|}d|_|_|S)Ncs tdSr)r r.r/reasonrr skip_wrappervsz-skip..decorator..skip_wrapperT) isinstancetype functoolswraps__unittest_skip____unittest_skip_why__) test_itemr:r8rr decoratorts zskip..decorator)r;types FunctionType)r9rBrArr8rskipps  rFcCs|r t|StS)z/ Skip a test if the condition is true. rFr+Z conditionr9rrrskipIfsrIcCs|s t|StS)z3 Skip a test unless the condition is true. rGrHrrr skipUnlesssrJcCs d|_|S)NT)__unittest_expecting_failure__)rArrrrsrcs4t|tr tfdd|DSt|to2t|S)Nc3s|]}t|VqdSr)) _is_subtype).0r%basetyperr sz_is_subtype..)r;tupleallr< issubclass)expectedrOrrNrrLs rLc@seZdZddZddZdS)_BaseTestCaseContextcCs ||_dSr))r#)rr#rrrrsz_BaseTestCaseContext.__init__cCs |j|j|}|j|dSr))r#_formatMessagemsgfailureException)r standardMsgrWrrr _raiseFailuresz"_BaseTestCaseContext._raiseFailureN)r r r rrZrrrrrUsrUc@seZdZdddZddZdS)_AssertRaisesBaseContextNcCs@t||||_||_|dk r*t|}||_d|_d|_dSr)) rUrrTr#recompileexpected_regexobj_namerW)rrTr#r^rrrrs  z!_AssertRaisesBaseContext.__init__c Cszt|j|js"td||jf|sV|dd|_|rNtdtt|f|WTS|^}}z |j |_ Wnt k rt ||_ YnX||||W5QRXW5d}XdS)z If args is empty, assertRaises/Warns is being used as a context manager, so check for a 'msg' kwarg and return self. If args is not empty, call a callable passing positional and keyword arguments. Nz%s() arg 1 must be %srWz3%r is an invalid keyword argument for this function) rLrT _base_type TypeError_base_type_strr1rWnextiterr r_AttributeErrorr )rnamer.r/Z callable_objrrrhandles(  z_AssertRaisesBaseContext.handle)N)r r r rrgrrrrr[s r[c@s(eZdZdZeZdZddZddZdS)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typescCs|Sr)rrrrr __enter__sz_AssertRaisesContext.__enter__cCs|dkrbz |jj}Wntk r2t|j}YnX|jrP|d||jql|d|n t|t ||js|dS| d|_ |j dkrdS|j }| t|s|d|jt|dS)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rTr rer r_rZformat traceback clear_framesrSwith_traceback exceptionr^searchpattern)rexc_type exc_valuetbexc_namer^rrr__exit__s.      z_AssertRaisesContext.__exit__N) r r r r BaseExceptionr`rbrjrwrrrrrhs rhc@s(eZdZdZeZdZddZddZdS)_AssertWarnsContextzBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typescCsRttjD]}t|ddri|_qtjdd|_|j |_t d|j |S)N__warningregistry__T)recordalways) listr!modulesvaluesgetattrrzwarningscatch_warningswarnings_managerrj simplefilterrT)rvrrrrjs  z_AssertWarnsContext.__enter__cCs|j||||dk rdSz |jj}Wntk rFt|j}YnXd}|jD]Z}|j}t||jsjqR|dkrv|}|j dk r|j t|sqR||_ |j |_ |j |_ dS|dk r|d|j jt||jr|d||jn|d|dS)Nrkz{} not triggered by {}z{} not triggered)rrwrTr rer rmessager;r^rqwarningfilenamelinenorZrlrrr_)rrsrtrurvZfirst_matchingmwrrrrws@     z_AssertWarnsContext.__exit__N) r r r rWarningr`rbrjrwrrrrrys  ry_LoggingWatcherrecordsoutputc@s(eZdZdZddZddZddZdS) _CapturingHandlerzM A logging handler capturing all (raw and formatted) logging output. cCstj|tgg|_dSr))loggingHandlerrrwatcherrirrrr3s z_CapturingHandler.__init__cCsdSr)rrirrrflush7sz_CapturingHandler.flushcCs*|jj|||}|jj|dSr))rrrrlr)rr{rWrrremit:s z_CapturingHandler.emitN)r r r rrrrrrrrr.src@s,eZdZdZdZddZddZddZd S) _AssertLogsContextz:A context manager used to implement TestCase.assertLogs().z"%(levelname)s:%(name)s:%(message)scCs:t||||_|r(tj|||_ntj|_d|_dSr)) rUr logger_namer _nameToLevelgetlevelINFOrW)rr#rrrrrrFs  z_AssertLogsContext.__init__cCst|jtjr|j}|_nt|j}|_t|j}t}| ||j |_ |j dd|_ |j |_|j|_|g|_ ||j d|_|j S)NF)r;rrLoggerlogger getLogger FormatterLOGGING_FORMATr setFormatterrhandlers old_handlersr old_level propagate old_propagatesetLevel)rr formatterhandlerrrrrjOs   z_AssertLogsContext.__enter__cCs`|j|j_|j|j_|j|j|dk r.dSt|jj dkr\| d t |j|jjdS)NFrz-no logs of level {} or higher triggered on {})rrrrrrrlenrrrZrlr getLevelNamerrf)rrsrtrurrrrw`s   z_AssertLogsContext.__exit__N)r r r rrrrjrwrrrrrAs  rc@seZdZddZdS)_OrderedChainMapccs8t}|jD]&}|D]}||kr|||Vqq dSr))setmapsadd)rseenmappingkrrr__iter__ns   z_OrderedChainMap.__iter__N)r r r rrrrrrmsrc@seZdZdZeZdZdZdZdZ gZ dddZ d d Z d d Z d e _eddZddZddZeddZeddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zeje fd*d+Z!d,d-Z"d.d/Z#d0d1Z$d2d3Z%d4d5Z&d6d7Z'd8d9Z(dd;d<Z)d=d>Z*ed?d@Z+dAdBZ,dCdDZ-dEdFZ.ddGdHZ/ddIdJZ0ddKdLZ1dMdNZ2dOdPZ3dQdRZ4ddSdTZ5dUdVZ6ddWdXZ7ddYdZZ8dd[d\Z9dd]d^Z:dd_d`Z;ddadbZddgdhZ?ddidjZ@ddkdlZAddmdnZBddodpZCddqdrZDddsdtZEddudvZFddwdxZGddydzZHdd{d|ZIdd}d~ZJdddZKdddZLdddZMdddZNdddZOdddZPddZQddZRdddZSdddZTddZUeUe8ZVZWeUe9ZXZYeUe:ZZZ[eUe;Z\Z]eUe1Z^Z_eUe3Z`eUe0ZaeUeQZbeUeSZceUeTZdd:S)TestCaseaWA class whose instances are single test cases. By default, the test code itself should be placed in a method named 'runTest'. If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute. Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively. If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run. When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when the instance's assertion methods fail; test methods raising this exception will be deemed to have 'failed' rather than 'errored'. * longMessage: determines whether long messages (including repr of objects used in assert methods) will be printed on failure in *addition* to any explicit message passed. * maxDiff: sets the maximum length of a diff in failure messages by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required. TiiFrunTestcCs||_d|_d|_zt||}Wn.tk rN|dkrJtd|j|fYn X|j|_g|_d|_ i|_ | t d| t d| td| td| td| td dS) zCreate an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name. NzNo testrzno such test method in %s: %sassertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocrre ValueError __class__r _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictr}rQr frozensetr )rZ methodName testMethodrrrrs(      zTestCase.__init__cCs||j|<dS)a[Add a type specific assertEqual style function to compare a type. This method is for use by TestCase subclasses that need to register their own type equality functions to provide nicer error messages. Args: typeobj: The data type to call this function on when both values are of the same type in assertEqual(). function: The callable taking two arguments and an optional msg= argument that raises self.failureException with a useful error message when the two arguments are not equal. N)r)rZtypeobjr-rrrrs zTestCase.addTypeEqualityFunccOst|dkr|^}}}nV|s&tdnHd|krZ|d}|^}}ddl}|jdtddntdt|d t|}|j|||fdS) aAdd a function, with arguments, to be called when the test is completed. Functions added are called on a LIFO basis and are called after tearDown on test failure or success. Cleanup items are called even if setUp fails (unlike tearDown).z>descriptor 'addCleanup' of 'TestCase' object needs an argumentr-rNz4Passing 'function' as keyword argument is deprecated) stacklevelz:addCleanup expected at least 1 positional argument, got %dr) rrar1rwarnDeprecationWarningrQrr)r.r/rr-rrrr addCleanups"     zTestCase.addCleanupz%($self, function, /, *args, **kwargs)cOs|j|||fdS)zpSame as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).N)_class_cleanupsr)clsr-r.r/rrraddClassCleanupszTestCase.addClassCleanupcCsdS)zAHook method for setting up the test fixture before exercising it.NrrirrrsetUpszTestCase.setUpcCsdS)zAHook method for deconstructing the test fixture after testing it.NrrirrrtearDownszTestCase.tearDowncCsdS)zKHook method for setting up class fixture before running tests in the class.Nrrrrr setUpClassszTestCase.setUpClasscCsdS)zVHook method for deconstructing the class fixture after running all tests in the class.Nrrrrr tearDownClassszTestCase.tearDownClasscCsdS)NrrrirrrcountTestCasesszTestCase.countTestCasescCstSr))rZ TestResultrirrrdefaultTestResult szTestCase.defaultTestResultcCs$|j}|r |ddSdS)zReturns a one-line description of the test, or None if no description has been provided. The default implementation of this method returns the first line of the specified test method's docstring.  rN)rstripsplitrdocrrrshortDescription szTestCase.shortDescriptioncCsdt|j|jfS)Nz%s.%srrrrirrridsz TestCase.idcCs t|t|k rtS|j|jkSr))r<NotImplementedrrotherrrr__eq__szTestCase.__eq__cCstt||jfSr))hashr<rrirrr__hash__ szTestCase.__hash__cCsd|jt|jfSNz%s (%s))rrrrirrr__str__#szTestCase.__str__cCsdt|j|jfS)Nz<%s testMethod=%s>rrirrr__repr__&szTestCase.__repr__cCs<t|dd}|dk r |||ntdtd||dS)NaddSkipz4TestResult has no addSkip method, skips not reportedr)rrrRuntimeWarning addSuccess)rrr#r9rrrr_addSkip*s  zTestCase._addSkipc ks|jdks|jjsdVdS|j}|dkr4t|}n |j|}t||||_zX|jj|jdd dVW5QRX|jjs|jj }|dk r|j rt n |jj rt W5||_XdS)aPReturn a context manager that will return the enclosed block of code in a subtest identified by the optional message and keyword parameters. A failure in the subtest marks the test case as failed but resumes execution at the end of the enclosed block, allowing further test code to be executed. NTr$) rrrrparams new_child_SubTestr&rrZfailfastrr)rrWrparentZ params_maprrrrsubTest3s$  zTestCase.subTestcCs`|D]V\}}t|tr(||j||q|dk rt|d|jrN|||q|||qdS)Nr)r;rrr#rSrX addFailureZaddError)rrrtestr"rrr_feedErrorsToResultRs  zTestCase._feedErrorsToResultcCsDz |j}Wn*tk r4tdt||Yn X|||dS)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurererrrr)rrr"rrrr_addExpectedFailure\s zTestCase._addExpectedFailurec Cshz |j}WnPtk rZtdtz tdWn$tk rT||tYnXYn X||dS)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrerrrrrr!r")rrrrrr_addUnexpectedSuccessfs  zTestCase._addUnexpectedSuccesscCs |dSr))rrirrr _callSetUpuszTestCase._callSetUpcCs |dSr)r)rmethodrrr_callTestMethodxszTestCase._callTestMethodcCs |dSr))rrirrr _callTearDown{szTestCase._callTearDowncOs|||dSr)rrr-r.r/rrr _callCleanup~szTestCase._callCleanupNc Cs|}|dkr.|}t|dd}|dk r.|||t||j}t|jdds^t|ddrz,t|jddpxt|dd}||||W5||XdSt|dd}t|dd}|p|}t|} z| |_ | || W5QRX| jr@|| _| j |dd ||W5QRXd| _| ||W5QRX|| jD]\} } ||| | qN||| j| jr|r| j r||| j n ||n |||WS|||dkrt|dd} | dk r| | j d| _ d|_ XdS) N startTestRunr?Fr@rCrK stopTestRunTr)rrZ startTestrrZstopTestrrrclearrrr&rrrrr doCleanupsrrrrr) rrZ orig_resultrrZskip_whyZexpecting_failure_methodZexpecting_failure_classroutcomerrr9rrrrunst               z TestCase.runc CsR|jp t}|jrL|j\}}}|||j|f||W5QRXq |jS)zNExecute all cleanup functions. Normally called for you after tearDown.)rrrr1r&rr)rrr-r.r/rrrrs   zTestCase.doCleanupsc Csdg|_|jr`|j\}}}z|||Wqtk r\}z|jtW5d}~XYqXqdS)zYExecute all class cleanup functions. Normally called for you after tearDownClass.N)ZtearDown_exceptionsrr1r2rr!r")rr-r.r/r4rrrdoClassCleanupsszTestCase.doClassCleanupscOs |j||Sr))r)rr.kwdsrrr__call__szTestCase.__call__cCsF|t||j||jrB|jd\}}}|||qdS)z6Run the test without collecting errors in a TestResultN)rrrrrr1rrrrdebugs zTestCase.debugcCs t|dS)zSkip this test.Nr6)rr9rrrskipTestszTestCase.skipTestcCs||dS)z)Fail immediately, with the given message.N)rX)rrWrrrfailsz TestCase.failcCs&|r"||dt|}||dS)z#Check that the expression is false.z%s is not falseNrVrrXrexprrWrrr assertFalseszTestCase.assertFalsecCs&|s"||dt|}||dS)z"Check that the expression is true.z%s is not trueNr r rrr assertTrueszTestCase.assertTruecCsV|js|p |S|dkr|Szd||fWStk rPdt|t|fYSXdS)aHonour the longMessage attribute when generating failure messages. If longMessage is False this means: * Use only an explicit message if it is provided * Otherwise use the standard message for the assert If longMessage is True: * Use the standard message * If an explicit message is provided, plus ' : ' and the explicit message Nz%s : %s) longMessageUnicodeDecodeErrorr)rrWrYrrrrVs zTestCase._formatMessagecOs(t||}z|d||WSd}XdS)a=Fail unless an exception of class expected_exception is raised by the callable when invoked with specified positional and keyword arguments. If a different type of exception is raised, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception. If called with the callable and arguments omitted, will return a context object used like this:: with self.assertRaises(SomeException): do_something() An optional keyword argument 'msg' can be provided when assertRaises is used as a context object. The context manager keeps a reference to the exception as the 'exception' attribute. This allows you to inspect the exception after the assertion:: with self.assertRaises(SomeException) as cm: do_something() the_exception = cm.exception self.assertEqual(the_exception.error_code, 3) N assertRaisesrhrg)rexpected_exceptionr.r/contextrrrrs zTestCase.assertRaisescOst||}|d||S)aFail unless a warning of class warnClass is triggered by the callable when invoked with specified positional and keyword arguments. If a different type of warning is triggered, it will not be handled: depending on the other warning filtering rules in effect, it might be silenced, printed out, or raised as an exception. If called with the callable and arguments omitted, will return a context object used like this:: with self.assertWarns(SomeWarning): do_something() An optional keyword argument 'msg' can be provided when assertWarns is used as a context object. The context manager keeps a reference to the first matching warning as the 'warning' attribute; similarly, the 'filename' and 'lineno' attributes give you information about the line of Python code from which the warning was triggered. This allows you to inspect the warning after the assertion:: with self.assertWarns(SomeWarning) as cm: do_something() the_warning = cm.warning self.assertEqual(the_warning.some_attribute, 147) assertWarnsryrg)rexpected_warningr.r/rrrrr5s zTestCase.assertWarnscCs t|||S)aFail unless a log message of level *level* or higher is emitted on *logger_name* or its children. If omitted, *level* defaults to INFO and *logger* defaults to the root logger. This method must be used as a context manager, and will yield a recording object with two attributes: `output` and `records`. At the end of the context manager, the `output` attribute will be a list of the matching formatted log messages and the `records` attribute will be a list of the corresponding LogRecord objects. Example:: with self.assertLogs('foo', level='INFO') as cm: logging.getLogger('foo').info('first message') logging.getLogger('foo.bar').error('second message') self.assertEqual(cm.output, ['INFO:foo:first message', 'ERROR:foo.bar:second message']) )r)rrrrrr assertLogsTszTestCase.assertLogscCsFt|t|kr@|jt|}|dk r@t|tr}z|d|W5d}~XYn0tk rl}z|d|W5d}~XYnXz||}Wn^tk r}z|d|W5d}~XYn0tk r}z|d|W5d}~XYnX|s|sdSg}|r|d|D]}|t|q|r@|d|D]}|t|q*d|} |||| dS)aA set-specific equality assertion. Args: set1: The first set to compare. set2: The second set to compare. msg: Optional message to use on failure instead of a list of differences. assertSetEqual uses ducktyping to support different types of sets, and is optimized for sets specifically (parameters must support a difference method). z/invalid type when attempting set difference: %sNz2first argument does not support set difference: %sz3second argument does not support set difference: %sz*Items in the first set but not the second:z*Items in the second set but not the first:r) differencerar rerreprr/rV) rZset1Zset2rWZ difference1r%Z difference2linesitemrYrrrrks2      zTestCase.assertSetEqualcCs2||kr.dt|t|f}||||dS)zDJust like self.assertTrue(a in b), but with a nicer default message.z%s not found in %sNrr rVrmember containerrWrYrrrassertIns zTestCase.assertIncCs2||kr.dt|t|f}||||dS)zHJust like self.assertTrue(a not in b), but with a nicer default message.z%s unexpectedly found in %sNrArBrrr assertNotIns zTestCase.assertNotIncCs2||k r.dt|t|f}||||dS)zDJust like self.assertTrue(a is b), but with a nicer default message.z %s is not %sNrArZexpr1Zexpr2rWrYrrrassertIss zTestCase.assertIscCs,||kr(dt|f}||||dS)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: %sNrArGrrr assertIsNotszTestCase.assertIsNotc Cs~||td||td||krzdt||}ddtt|t|}| ||}| | ||dS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr) assertIsInstancerrr/r0r1r2r3r4r5r rV)rZd1Zd2rWrYr'rrrrs    zTestCase.assertDictEqualc Cstdtg}g}|D]L\}}||kr8||q|||kr|dt|t|t||fq|sv|svdSd}|rdddd|D}|r|r|d 7}|d d|7}||||dS) z2Checks whether dictionary is a superset of subset.z&assertDictContainsSubset is deprecatedz%s, expected: %s, actual: %sNrCz Missing: %s,css|]}t|VqdSr))r)rMrrrrrPsz4TestCase.assertDictContainsSubset..z; zMismatched values: %s) rrritemsrrr/r rV) rZsubsetZ dictionaryrWmissingZ mismatchedkeyvaluerYrrrassertDictContainsSubsets4      z!TestCase.assertDictContainsSubsetc Cst|t|}}zt|}t|}Wntk rHt||}YnX||krVdSt||}|rd}dd|D}d|} ||| }|||}| |dS)a[Asserts that two iterables have the same elements, the same number of times, without regard to order. self.assertEqual(Counter(list(first)), Counter(list(second))) Example: - [0, 1, 1] and [1, 0, 1] compare equal. - [0, 0, 1] and [0, 1] compare unequal. NzElement counts were not equal: cSsg|] }d|qS)z First has %d, Second has %d: %rr)rMr'rrr sz-TestCase.assertCountEqual..r) r} collectionsCounterrarrr/r5rVr ) rrrrWZ first_seqZ second_seqZ differencesrYr?r8rrrassertCountEquals      zTestCase.assertCountEqualcCs||td||td||krt||jks@t||jkrN|||||jdd}|jdd}t|dkr|d|kr|dg}|dg}dt||}dd t ||}| ||}| | ||d S) z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringT)keependsrz rrrCN)rJr r_diffThresholdrr4rrr/r0r1r5r rV)rrrrWZ firstlinesZ secondlinesrYr'rrrrs       zTestCase.assertMultiLineEqualcCs2||ks.dt|t|f}||||dS)zCJust like self.assertTrue(a < b), but with a nicer default message.z%s not less than %sNrArabrWrYrrr assertLessszTestCase.assertLesscCs2||ks.dt|t|f}||||dS)zDJust like self.assertTrue(a <= b), but with a nicer default message.z%s not less than or equal to %sNrArWrrrassertLessEqualszTestCase.assertLessEqualcCs2||ks.dt|t|f}||||dS)zCJust like self.assertTrue(a > b), but with a nicer default message.z%s not greater than %sNrArWrrr assertGreaterszTestCase.assertGreatercCs2||ks.dt|t|f}||||dS)zDJust like self.assertTrue(a >= b), but with a nicer default message.z"%s not greater than or equal to %sNrArWrrrassertGreaterEqual szTestCase.assertGreaterEqualcCs,|dk r(dt|f}||||dS)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz%s is not NonerArr*rWrYrrr assertIsNone&szTestCase.assertIsNonecCs"|dkrd}||||dS)z(Included for symmetry with assertIsNone.Nzunexpectedly None)r rVr^rrrassertIsNotNone,szTestCase.assertIsNotNonecCs0t||s,dt||f}||||dS)zTSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.z%s is not an instance of %rNr;rr rVrr*rrWrYrrrrJ2s zTestCase.assertIsInstancecCs0t||r,dt||f}||||dS)z,Included for symmetry with assertIsInstance.z%s is an instance of %rNrarbrrrassertNotIsInstance9s zTestCase.assertNotIsInstancecOst|||}|d||S)aAsserts that the message in a raised exception matches a regex. Args: expected_exception: Exception class expected to be raised. expected_regex: Regex (re.Pattern object or string) expected to be found in error message. args: Function to be called and extra positional args. kwargs: Extra kwargs. msg: Optional message used in case of failure. Can only be used when assertRaisesRegex is used as a context manager. assertRaisesRegexr)rrr^r.r/rrrrrd?s zTestCase.assertRaisesRegexcOst|||}|d||S)aAsserts that the message in a triggered warning matches a regexp. Basic functioning is similar to assertWarns() with the addition that only warnings whose messages also match the regular expression are considered successful matches. Args: expected_warning: Warning class expected to be triggered. expected_regex: Regex (re.Pattern object or string) expected to be found in error message. args: Function to be called and extra positional args. kwargs: Extra kwargs. msg: Optional message used in case of failure. Can only be used when assertWarnsRegex is used as a context manager. assertWarnsRegexr)rrr^r.r/rrrrreOs zTestCase.assertWarnsRegexcCsVt|ttfr$|stdt|}||sRd|j|f}|||}| |dS)z=Fail the test unless the text matches the regular expression.z!expected_regex must not be empty.z&Regex didn't match: %r not found in %rN) r;r bytesAssertionErrorr\r]rqrrrVrX)rtextr^rWrYrrr assertRegexbs    zTestCase.assertRegexcCs`t|ttfrt|}||}|r\d||||j|f}| ||}| |dS)z9Fail the test if the text matches the regular expression.z"Regex matched: %r matches %r in %rN) r;r rfr\r]rqstartendrrrVrX)rrhZunexpected_regexrWmatchrYrrrassertNotRegexns   zTestCase.assertNotRegexcsfdd}|S)Ncs tdjtd||S)NzPlease use {0} instead.r)rrrlr rr7 original_funcrrdeprecated_func~s  z,TestCase._deprecate..deprecated_funcr)rorprrnr _deprecate}s zTestCase._deprecate)r)N)N)N)N)NN)N)N)N)NNN)NNN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)er r r rrgrXrr:rVZ_classSetupFailedrrrr__text_signature__ classmethodrrrrrrrrrrrrrrr'r(_subtest_msg_sentinelrrrrrrrrrrrrrr r rrrVrrrrrrr r(r)r9r5rrrrErFrHrIrrPrTrrZr[r\r]r_r`rJrcrdrerirmrqZfailUnlessEqualZ assertEqualsZ failIfEqualZassertNotEqualsZfailUnlessAlmostEqualZassertAlmostEqualsZfailIfAlmostEqualZassertNotAlmostEqualsZ failUnlessZassert_ZfailUnlessRaisesZfailIfZassertRaisesRegexpZassertRegexpMatchesZassertNotRegexpMatchesrrrrrws          E      !     - # c +                    rcsjeZdZdZdfdd ZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ZS)FunctionTestCaseaIA test case that wraps a test function. This is useful for slipping pre-existing test functions into the unittest framework. Optionally, set-up and tidy-up functions can be supplied. As with TestCase, the tidy-up ('tearDown') function will always be called if the set-up ('setUp') function ran successfully. Ncs*tt|||_||_||_||_dSr))superrur _setUpFunc _tearDownFunc _testFunc _description)rZtestFuncrr descriptionrrrrs zFunctionTestCase.__init__cCs|jdk r|dSr))rwrirrrrs zFunctionTestCase.setUpcCs|jdk r|dSr))rxrirrrrs zFunctionTestCase.tearDowncCs |dSr))ryrirrrrszFunctionTestCase.runTestcCs|jjSr))ryr rirrrrszFunctionTestCase.idcCs@t||jstS|j|jko>|j|jko>|j|jko>|j|jkSr))r;rrrwrxryrzrrrrrs     zFunctionTestCase.__eq__cCstt||j|j|j|jfSr))rr<rwrxryrzrirrrrszFunctionTestCase.__hash__cCsdt|j|jjfSr)rrryr rirrrrs zFunctionTestCase.__str__cCsdt|j|jfS)Nz <%s tec=%s>)rrryrirrrrs zFunctionTestCase.__repr__cCs2|jdk r|jS|jj}|r.|ddp0dS)Nrr)rzryrrrrrrrrs z!FunctionTestCase.shortDescription)NNN)r r r rrrrrrrrrrr __classcell__rrr|rrus rucsDeZdZfddZddZddZddZd d Zd d ZZ S) rcs(t||_||_||_|j|_dSr))rvr_messager#rrX)rr#rrr|rrrs  z_SubTest.__init__cCs tddS)Nzsubtests cannot be run directly)r*rirrrrsz_SubTest.runTestcCs^g}|jtk r |d|j|jrPddd|jD}|d|d|p\dS)Nz[{}]z, css|]\}}d||VqdS)z{}={!r}N)rl)rMrrrrrrPsz+_SubTest._subDescription..z({}) z ())r~rtrrlrr/rL)rpartsZ params_descrrr_subDescriptions  z_SubTest._subDescriptioncCsd|j|SNz{} {})rlr#rrrirrrrsz _SubTest.idcCs |jS)zlReturns a one-line description of the subtest, or None if no description has been provided. )r#rrirrrrsz_SubTest.shortDescriptioncCsd|j|Sr)rlr#rrirrrrsz_SubTest.__str__) r r r rrrrrrr}rrr|rrs   r)4rr!r=r0rr2r\rrRr'rmrDrCrutilrrrrrZ __unittestobjectrtr;r2r rrrr+r,r0r5rFrIrJrrLrUr[rhry namedtuplerrrrChainMaprrrurrrrrsd ( *%5, $: