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/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
PK!Tү __init__.pynu[""" Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework (used with permission). This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Simple usage: import unittest class IntegerArithmeticTestCase(unittest.TestCase): def testAdd(self): # test method names begin with 'test' self.assertEqual((1 + 2), 3) self.assertEqual(0 + 1, 1) def testMultiply(self): self.assertEqual((0 * 10), 0) self.assertEqual((5 * 8), 40) if __name__ == '__main__': unittest.main() Further information is available in the bundled documentation, and from http://docs.python.org/library/unittest.html Copyright (c) 1999-2003 Steve Purcell Copyright (c) 2003-2010 Python Software Foundation This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. """ __all__ = ['TestResult', 'TestCase', 'IsolatedAsyncioTestCase', 'TestSuite', 'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main', 'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless', 'expectedFailure', 'TextTestResult', 'installHandler', 'registerResult', 'removeResult', 'removeHandler', 'addModuleCleanup', 'doModuleCleanups', 'enterModuleContext'] __unittest = True from .result import TestResult from .case import (addModuleCleanup, TestCase, FunctionTestCase, SkipTest, skip, skipIf, skipUnless, expectedFailure, doModuleCleanups, enterModuleContext) from .suite import BaseTestSuite, TestSuite from .loader import TestLoader, defaultTestLoader from .main import TestProgram, main from .runner import TextTestRunner, TextTestResult from .signals import installHandler, registerResult, removeResult, removeHandler # IsolatedAsyncioTestCase will be imported lazily. # Lazy import of IsolatedAsyncioTestCase from .async_case # It imports asyncio, which is relatively heavy, but most tests # do not need it. def __dir__(): return globals().keys() | {'IsolatedAsyncioTestCase'} def __getattr__(name): if name == 'IsolatedAsyncioTestCase': global IsolatedAsyncioTestCase from .async_case import IsolatedAsyncioTestCase return IsolatedAsyncioTestCase raise AttributeError(f"module {__name__!r} has no attribute {name!r}") PK!b!% __main__.pynu["""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): import os.path # We change sys.argv[0] to make help message more useful # use executable without path, unquoted # (it's just a hint anyway) # (if you have spaces in your executable you get what you deserve!) executable = os.path.basename(sys.executable) sys.argv[0] = executable + " -m unittest" del os __unittest = True from .main import main main(module=None) PK!ڗc c signals.pynu[import signal import weakref from functools import wraps __unittest = True class _InterruptHandler(object): def __init__(self, default_handler): self.called = False self.original_handler = default_handler if isinstance(default_handler, int): if default_handler == signal.SIG_DFL: # Pretend it's signal.default_int_handler instead. default_handler = signal.default_int_handler elif default_handler == signal.SIG_IGN: # Not quite the same thing as SIG_IGN, but the closest we # can make it: do nothing. def default_handler(unused_signum, unused_frame): pass else: raise TypeError("expected SIGINT signal handler to be " "signal.SIG_IGN, signal.SIG_DFL, or a " "callable object") self.default_handler = default_handler def __call__(self, signum, frame): installed_handler = signal.getsignal(signal.SIGINT) if installed_handler is not self: # if we aren't the installed handler, then delegate immediately # to the default handler self.default_handler(signum, frame) if self.called: self.default_handler(signum, frame) self.called = True for result in _results.keys(): result.stop() _results = weakref.WeakKeyDictionary() def registerResult(result): _results[result] = 1 def removeResult(result): return bool(_results.pop(result, None)) _interrupt_handler = None def installHandler(): global _interrupt_handler if _interrupt_handler is None: default_handler = signal.getsignal(signal.SIGINT) _interrupt_handler = _InterruptHandler(default_handler) signal.signal(signal.SIGINT, _interrupt_handler) def removeHandler(method=None): if method is not None: @wraps(method) def inner(*args, **kwargs): initial = signal.getsignal(signal.SIGINT) removeHandler() try: return method(*args, **kwargs) finally: signal.signal(signal.SIGINT, initial) return inner global _interrupt_handler if _interrupt_handler is not None: signal.signal(signal.SIGINT, _interrupt_handler.original_handler) PK!&Ϫ## result.pynu["""Test result object""" import io import sys import traceback from . import util from functools import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): self.stop() return method(self, *args, **kw) return inner STDOUT_LINE = '\nStdout:\n%s' STDERR_LINE = '\nStderr:\n%s' class TestResult(object): """Holder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. """ _previousTestClass = None _testRunEntered = False _moduleSetUpFailed = False def __init__(self, stream=None, descriptions=None, verbosity=None): self.failfast = False self.failures = [] self.errors = [] self.testsRun = 0 self.skipped = [] self.expectedFailures = [] self.unexpectedSuccesses = [] self.collectedDurations = [] self.shouldStop = False self.buffer = False self.tb_locals = False self._stdout_buffer = None self._stderr_buffer = None self._original_stdout = sys.stdout self._original_stderr = sys.stderr self._mirrorOutput = False def printErrors(self): "Called by TestRunner after test run" def startTest(self, test): "Called when the given test is about to be run" self.testsRun += 1 self._mirrorOutput = False self._setupStdout() def _setupStdout(self): if self.buffer: if self._stderr_buffer is None: self._stderr_buffer = io.StringIO() self._stdout_buffer = io.StringIO() sys.stdout = self._stdout_buffer sys.stderr = self._stderr_buffer def startTestRun(self): """Called once before any tests are executed. See startTest for a method called before each test. """ def stopTest(self, test): """Called when the given test has been run""" self._restoreStdout() self._mirrorOutput = False def _restoreStdout(self): if self.buffer: if self._mirrorOutput: output = sys.stdout.getvalue() error = sys.stderr.getvalue() if output: if not output.endswith('\n'): output += '\n' self._original_stdout.write(STDOUT_LINE % output) if error: if not error.endswith('\n'): error += '\n' self._original_stderr.write(STDERR_LINE % error) sys.stdout = self._original_stdout sys.stderr = self._original_stderr self._stdout_buffer.seek(0) self._stdout_buffer.truncate() self._stderr_buffer.seek(0) self._stderr_buffer.truncate() def stopTestRun(self): """Called once after all tests are executed. See stopTest for a method called after each test. """ @failfast def addError(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). """ self.errors.append((test, self._exc_info_to_string(err, test))) self._mirrorOutput = True @failfast def addFailure(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().""" self.failures.append((test, self._exc_info_to_string(err, test))) self._mirrorOutput = True def addSubTest(self, test, subtest, err): """Called at the end of a subtest. 'err' is None if the subtest ended successfully, otherwise it's a tuple of values as returned by sys.exc_info(). """ # By default, we don't do anything with successful subtests, but # more sophisticated test results might want to record them. if err is not None: if getattr(self, 'failfast', False): self.stop() if issubclass(err[0], test.failureException): errors = self.failures else: errors = self.errors errors.append((subtest, self._exc_info_to_string(err, test))) self._mirrorOutput = True def addSuccess(self, test): "Called when a test has completed successfully" pass def addSkip(self, test, reason): """Called when a test is skipped.""" self.skipped.append((test, reason)) def addExpectedFailure(self, test, err): """Called when an expected failure/error occurred.""" self.expectedFailures.append( (test, self._exc_info_to_string(err, test))) @failfast def addUnexpectedSuccess(self, test): """Called when a test was expected to fail, but succeed.""" self.unexpectedSuccesses.append(test) def addDuration(self, test, elapsed): """Called when a test finished to run, regardless of its outcome. *test* is the test case corresponding to the test method. *elapsed* is the time represented in seconds, and it includes the execution of cleanup functions. """ # support for a TextTestRunner using an old TestResult class if hasattr(self, "collectedDurations"): # Pass test repr and not the test object itself to avoid resources leak self.collectedDurations.append((str(test), elapsed)) def wasSuccessful(self): """Tells whether or not this result was a success.""" # The hasattr check is for test_result's OldResult test. That # way this method works on objects that lack the attribute. # (where would such result instances come from? old stored pickles?) return ((len(self.failures) == len(self.errors) == 0) and (not hasattr(self, 'unexpectedSuccesses') or len(self.unexpectedSuccesses) == 0)) def stop(self): """Indicates that the tests should be aborted.""" self.shouldStop = True def _exc_info_to_string(self, err, test): """Converts a sys.exc_info()-style tuple of values into a string.""" exctype, value, tb = err tb = self._clean_tracebacks(exctype, value, tb, test) tb_e = traceback.TracebackException( exctype, value, tb, capture_locals=self.tb_locals, compact=True) msgLines = list(tb_e.format()) if self.buffer: output = sys.stdout.getvalue() error = sys.stderr.getvalue() if output: if not output.endswith('\n'): output += '\n' msgLines.append(STDOUT_LINE % output) if error: if not error.endswith('\n'): error += '\n' msgLines.append(STDERR_LINE % error) return ''.join(msgLines) def _clean_tracebacks(self, exctype, value, tb, test): ret = None first = True excs = [(exctype, value, tb)] seen = {id(value)} # Detect loops in chained exceptions. while excs: (exctype, value, tb) = excs.pop() # Skip test runner traceback levels while tb and self._is_relevant_tb_level(tb): tb = tb.tb_next # Skip assert*() traceback levels if exctype is test.failureException: self._remove_unittest_tb_frames(tb) if first: ret = tb first = False else: value.__traceback__ = tb if value is not None: for c in (value.__cause__, value.__context__): if c is not None and id(c) not in seen: excs.append((type(c), c, c.__traceback__)) seen.add(id(c)) return ret def _is_relevant_tb_level(self, tb): return '__unittest' in tb.tb_frame.f_globals def _remove_unittest_tb_frames(self, tb): '''Truncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified. ''' prev = None while tb and not self._is_relevant_tb_level(tb): prev = tb tb = tb.tb_next if prev is not None: prev.tb_next = None def __repr__(self): return ("<%s run=%i errors=%i failures=%i>" % (util.strclass(self.__class__), self.testsRun, len(self.errors), len(self.failures))) PK!֋44suite.pynu["""TestSuite""" import sys from . import case from . import util __unittest = True def _call_if_exists(parent, attr): func = getattr(parent, attr, lambda: None) func() class BaseTestSuite(object): """A simple test suite that doesn't provide class or module shared fixtures. """ _cleanup = True def __init__(self, tests=()): self._tests = [] self._removed_tests = 0 self.addTests(tests) def __repr__(self): return "<%s tests=%s>" % (util.strclass(self.__class__), list(self)) def __eq__(self, other): if not isinstance(other, self.__class__): return NotImplemented return list(self) == list(other) def __iter__(self): return iter(self._tests) def countTestCases(self): cases = self._removed_tests for test in self: if test: cases += test.countTestCases() return cases def addTest(self, test): # sanity checks if not callable(test): raise TypeError("{} is not callable".format(repr(test))) if isinstance(test, type) and issubclass(test, (case.TestCase, TestSuite)): raise TypeError("TestCases and TestSuites must be instantiated " "before passing them to addTest()") self._tests.append(test) def addTests(self, tests): if isinstance(tests, str): raise TypeError("tests must be an iterable of tests, not a string") for test in tests: self.addTest(test) def run(self, result): for index, test in enumerate(self): if result.shouldStop: break test(result) if self._cleanup: self._removeTestAtIndex(index) return result def _removeTestAtIndex(self, index): """Stop holding a reference to the TestCase at index.""" try: test = self._tests[index] except TypeError: # support for suite implementations that have overridden self._tests pass else: # Some unittest tests add non TestCase/TestSuite objects to # the suite. if hasattr(test, 'countTestCases'): self._removed_tests += test.countTestCases() self._tests[index] = None def __call__(self, *args, **kwds): return self.run(*args, **kwds) def debug(self): """Run the tests without collecting errors in a TestResult""" for test in self: test.debug() class TestSuite(BaseTestSuite): """A test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. """ def run(self, result, debug=False): topLevel = False if getattr(result, '_testRunEntered', False) is False: result._testRunEntered = topLevel = True for index, test in enumerate(self): if result.shouldStop: break if _isnotsuite(test): self._tearDownPreviousClass(test, result) self._handleModuleFixture(test, result) self._handleClassSetUp(test, result) result._previousTestClass = test.__class__ if (getattr(test.__class__, '_classSetupFailed', False) or getattr(result, '_moduleSetUpFailed', False)): continue if not debug: test(result) else: test.debug() if self._cleanup: self._removeTestAtIndex(index) if topLevel: self._tearDownPreviousClass(None, result) self._handleModuleTearDown(result) result._testRunEntered = False return result def debug(self): """Run the tests without collecting errors in a TestResult""" debug = _DebugResult() self.run(debug, True) ################################ def _handleClassSetUp(self, test, result): previousClass = getattr(result, '_previousTestClass', None) currentClass = test.__class__ if currentClass == previousClass: return if result._moduleSetUpFailed: return if getattr(currentClass, "__unittest_skip__", False): return failed = False try: currentClass._classSetupFailed = False except TypeError: # test may actually be a function # so its class will be a builtin-type pass setUpClass = getattr(currentClass, 'setUpClass', None) doClassCleanups = getattr(currentClass, 'doClassCleanups', None) if setUpClass is not None: _call_if_exists(result, '_setupStdout') try: try: setUpClass() except Exception as e: if isinstance(result, _DebugResult): raise failed = True try: currentClass._classSetupFailed = True except TypeError: pass className = util.strclass(currentClass) self._createClassOrModuleLevelException(result, e, 'setUpClass', className) if failed and doClassCleanups is not None: doClassCleanups() for exc_info in currentClass.tearDown_exceptions: self._createClassOrModuleLevelException( result, exc_info[1], 'setUpClass', className, info=exc_info) finally: _call_if_exists(result, '_restoreStdout') def _get_previous_module(self, result): previousModule = None previousClass = getattr(result, '_previousTestClass', None) if previousClass is not None: previousModule = previousClass.__module__ return previousModule def _handleModuleFixture(self, test, result): previousModule = self._get_previous_module(result) currentModule = test.__class__.__module__ if currentModule == previousModule: return self._handleModuleTearDown(result) result._moduleSetUpFailed = False try: module = sys.modules[currentModule] except KeyError: return setUpModule = getattr(module, 'setUpModule', None) if setUpModule is not None: _call_if_exists(result, '_setupStdout') try: try: setUpModule() except Exception as e: if isinstance(result, _DebugResult): raise result._moduleSetUpFailed = True self._createClassOrModuleLevelException(result, e, 'setUpModule', currentModule) if result._moduleSetUpFailed: try: case.doModuleCleanups() except Exception as e: self._createClassOrModuleLevelException(result, e, 'setUpModule', currentModule) finally: _call_if_exists(result, '_restoreStdout') def _createClassOrModuleLevelException(self, result, exc, method_name, parent, info=None): errorName = f'{method_name} ({parent})' self._addClassOrModuleLevelException(result, exc, errorName, info) def _addClassOrModuleLevelException(self, result, exception, errorName, info=None): error = _ErrorHolder(errorName) addSkip = getattr(result, 'addSkip', None) if addSkip is not None and isinstance(exception, case.SkipTest): addSkip(error, str(exception)) else: if not info: result.addError(error, sys.exc_info()) else: result.addError(error, info) def _handleModuleTearDown(self, result): previousModule = self._get_previous_module(result) if previousModule is None: return if result._moduleSetUpFailed: return try: module = sys.modules[previousModule] except KeyError: return _call_if_exists(result, '_setupStdout') try: tearDownModule = getattr(module, 'tearDownModule', None) if tearDownModule is not None: try: tearDownModule() except Exception as e: if isinstance(result, _DebugResult): raise self._createClassOrModuleLevelException(result, e, 'tearDownModule', previousModule) try: case.doModuleCleanups() except Exception as e: if isinstance(result, _DebugResult): raise self._createClassOrModuleLevelException(result, e, 'tearDownModule', previousModule) finally: _call_if_exists(result, '_restoreStdout') def _tearDownPreviousClass(self, test, result): previousClass = getattr(result, '_previousTestClass', None) currentClass = test.__class__ if currentClass == previousClass or previousClass is None: return if getattr(previousClass, '_classSetupFailed', False): return if getattr(result, '_moduleSetUpFailed', False): return if getattr(previousClass, "__unittest_skip__", False): return tearDownClass = getattr(previousClass, 'tearDownClass', None) doClassCleanups = getattr(previousClass, 'doClassCleanups', None) if tearDownClass is None and doClassCleanups is None: return _call_if_exists(result, '_setupStdout') try: if tearDownClass is not None: try: tearDownClass() except Exception as e: if isinstance(result, _DebugResult): raise className = util.strclass(previousClass) self._createClassOrModuleLevelException(result, e, 'tearDownClass', className) if doClassCleanups is not None: doClassCleanups() for exc_info in previousClass.tearDown_exceptions: if isinstance(result, _DebugResult): raise exc_info[1] className = util.strclass(previousClass) self._createClassOrModuleLevelException(result, exc_info[1], 'tearDownClass', className, info=exc_info) finally: _call_if_exists(result, '_restoreStdout') class _ErrorHolder(object): """ Placeholder for a TestCase inside a result. As far as a TestResult is concerned, this looks exactly like a unit test. Used to insert arbitrary errors into a test suite run. """ # Inspired by the ErrorHolder from Twisted: # http://twistedmatrix.com/trac/browser/trunk/twisted/trial/runner.py # attribute used by TestResult._exc_info_to_string failureException = None def __init__(self, description): self.description = description def id(self): return self.description def shortDescription(self): return None def __repr__(self): return "" % (self.description,) def __str__(self): return self.id() def run(self, result): # could call result.addError(...) - but this test-like object # shouldn't be run anyway pass def __call__(self, result): return self.run(result) def countTestCases(self): return 0 def _isnotsuite(test): "A crude way to tell apart testcases and suites with duck-typing" try: iter(test) except TypeError: return True return False class _DebugResult(object): "Used by the TestSuite to hold previous class when running in debug." _previousTestClass = None _moduleSetUpFailed = False shouldStop = False PK!d__util.pynu["""Various utility functions.""" from collections import namedtuple, Counter from os.path import commonprefix __unittest = True _MAX_LENGTH = 80 _PLACEHOLDER_LEN = 12 _MIN_BEGIN_LEN = 5 _MIN_END_LEN = 5 _MIN_COMMON_LEN = 5 _MIN_DIFF_LEN = _MAX_LENGTH - \ (_MIN_BEGIN_LEN + _PLACEHOLDER_LEN + _MIN_COMMON_LEN + _PLACEHOLDER_LEN + _MIN_END_LEN) assert _MIN_DIFF_LEN >= 0 def _shorten(s, prefixlen, suffixlen): skip = len(s) - prefixlen - suffixlen if skip > _PLACEHOLDER_LEN: s = '%s[%d chars]%s' % (s[:prefixlen], skip, s[len(s) - suffixlen:]) return s def _common_shorten_repr(*args): args = tuple(map(safe_repr, args)) maxlen = max(map(len, args)) if maxlen <= _MAX_LENGTH: return args prefix = commonprefix(args) prefixlen = len(prefix) common_len = _MAX_LENGTH - \ (maxlen - prefixlen + _MIN_BEGIN_LEN + _PLACEHOLDER_LEN) if common_len > _MIN_COMMON_LEN: assert _MIN_BEGIN_LEN + _PLACEHOLDER_LEN + _MIN_COMMON_LEN + \ (maxlen - prefixlen) < _MAX_LENGTH prefix = _shorten(prefix, _MIN_BEGIN_LEN, common_len) return tuple(prefix + s[prefixlen:] for s in args) prefix = _shorten(prefix, _MIN_BEGIN_LEN, _MIN_COMMON_LEN) return tuple(prefix + _shorten(s[prefixlen:], _MIN_DIFF_LEN, _MIN_END_LEN) for s in args) def safe_repr(obj, short=False): try: result = repr(obj) except Exception: result = object.__repr__(obj) if not short or len(result) < _MAX_LENGTH: return result return result[:_MAX_LENGTH] + ' [truncated]...' def strclass(cls): return "%s.%s" % (cls.__module__, cls.__qualname__) def sorted_list_difference(expected, actual): """Finds elements in only one or the other of two, sorted input lists. Returns a two-element tuple of lists. The first list contains those elements in the "expected" list but not in the "actual" list, and the second contains those elements in the "actual" list but not in the "expected" list. Duplicate elements in either input list are ignored. """ i = j = 0 missing = [] unexpected = [] while True: try: e = expected[i] a = actual[j] if e < a: missing.append(e) i += 1 while expected[i] == e: i += 1 elif e > a: unexpected.append(a) j += 1 while actual[j] == a: j += 1 else: i += 1 try: while expected[i] == e: i += 1 finally: j += 1 while actual[j] == a: j += 1 except IndexError: missing.extend(expected[i:]) unexpected.extend(actual[j:]) break return missing, unexpected def unorderable_list_difference(expected, actual): """Same behavior as sorted_list_difference but for lists of unorderable items (like dicts). As it does a linear search per item (remove) it has O(n*n) performance.""" missing = [] while expected: item = expected.pop() try: actual.remove(item) except ValueError: missing.append(item) # anything left in actual is unexpected return missing, actual def three_way_cmp(x, y): """Return -1 if x < y, 0 if x == y and 1 if x > y""" return (x > y) - (x < y) _Mismatch = namedtuple('Mismatch', 'actual expected value') def _count_diff_all_purpose(actual, expected): 'Returns list of (cnt_act, cnt_exp, elem) triples where the counts differ' # elements need not be hashable s, t = list(actual), list(expected) m, n = len(s), len(t) NULL = object() result = [] for i, elem in enumerate(s): if elem is NULL: continue cnt_s = cnt_t = 0 for j in range(i, m): if s[j] == elem: cnt_s += 1 s[j] = NULL for j, other_elem in enumerate(t): if other_elem == elem: cnt_t += 1 t[j] = NULL if cnt_s != cnt_t: diff = _Mismatch(cnt_s, cnt_t, elem) result.append(diff) for i, elem in enumerate(t): if elem is NULL: continue cnt_t = 0 for j in range(i, n): if t[j] == elem: cnt_t += 1 t[j] = NULL diff = _Mismatch(0, cnt_t, elem) result.append(diff) return result def _count_diff_hashable(actual, expected): 'Returns list of (cnt_act, cnt_exp, elem) triples where the counts differ' # elements must be hashable s, t = Counter(actual), Counter(expected) result = [] for elem, cnt_s in s.items(): cnt_t = t.get(elem, 0) if cnt_s != cnt_t: diff = _Mismatch(cnt_s, cnt_t, elem) result.append(diff) for elem, cnt_t in t.items(): if elem not in s: diff = _Mismatch(0, cnt_t, elem) result.append(diff) return result PK!n]]"__pycache__/loader.cpython-312.pycnu[ ֦i|RdZddlZddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z dZ ejdejZGdd e j"Zd Zd Zd Zd ZdZGddeZeZddZe j8dfdZde j8e j<fdZde j8e j<fdZ y)zLoading unittests.N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c,eZdZdZfdZfdZxZS) _FailedTestNc:||_tt||yN) _exceptionsuperr __init__)self method_name exception __class__s (/usr/lib64/python3.12/unittest/loader.pyrz_FailedTest.__init__s# k4)+6cX|jk7rtt|Sfd}|S)Ncjr )r rsr testFailurez,_FailedTest.__getattr__..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_test ImportError)r suiteClassmessages r_make_failed_import_testr*%s- i""$&G T;w#7W MMrcLdtj}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 -D tg  ''rctjt|d}||i}tdtjf|}|||fS)Ncyr rs r testSkippedz'_make_skipped_test..testSkipped4s r ModuleSkipped)rskipstrtypeTestCase)r.rr(r3attrs TestClasss r_make_skipped_testr;3sS YYs9~   %E_t}}&6>I y,. //rcFtjj|dS)Nr)ospathsplitext)r>s r _splitextr@;s 77  D !! $$rceZdZdZdZeejZdZ e jZ dZ fdZdZdddZddZdd Zd Zdd Zd 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|tjr td|tj tj fvrg}n"|j|}|st|drdg}|jt||}|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 TypeErrorrr8FunctionTestCasegetTestCaseNameshasattrr(map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCasez TestLoader.loadTestsFromTestCaseQs~ mU__ 5() ) T]]D,A,AB BM 11-@M W]I%F!* s=-'HI rpatternc$g}t|D]}}t||}t|ts t |t j s;|t j t jfvs^|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 isinstancer7rIrr8rLappendrSr( Exceptionr,rrD) rmodulerUtestsrobjrWe error_case error_messages rloadTestsFromModulezTestLoader.loadTestsFromModuleasKD&$'C3%sDMM2 t/D/DEE T77<= V\48 &  ! "!$w77   ",COOQ-9) M ""=1!!  "s/ B;; DAD D Dc |jd}d\}}|*|dd}|r dj|}t|} |dd}|} |D]} | t| | } } t| tj r|j#| St| t$rMt'| t(j*r3| t(j*t(j,fvr|j/| St| tj0rmt t$r]t'| t(j*rC|d}| |} tt| |tj0s.|j | gSt| t2j4r| St7| ra| }t|t2j4r|St|t(j*r|j |gSt9d| d |d t9d | 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(rDr[rYAttributeErrorr&r$r%rZtypes ModuleTypercr7rIrr8rLrS FunctionTyperrJcallablerK)rrr]partsrarb parts_copy module_namenext_attributer_partparentr`instr/s rloadTestsFromNamezTestLoader.loadTestsFromNameys 3$.! M >qJ *"%((:"6K' 4F!"IED &!73#5. c5++ ,++C0 0 sD !3 .DMM4+@+@AA--c2 2e001&/9D$". KK&&}5%%1Ba%002516-J KK&&}5%%% &s=H IAII K4(+K/K4A K/'K4/K4cl|Dcgc]}|j||}}|j|Scc}w)zReturn a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. )ryr()rnamesr]rsuitess rloadTestsFromNameszTestLoader.loadTestsFromNamess<DII54$((v65Iv&&Js1cfd}tt|t}jr/|j t j 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).0rUfullNames r zKTestLoader.getTestCaseNames..shouldIncludeMethod..sXBWwK'2BWs) startswithtestMethodPrefixrYrqrrtestNamePatternsany)attrnametestFuncrrrPs @rshouldIncludeMethodz8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<'<=}h7HH%!((-*D*Dh&H((D0YX$BWBWXX Yr)key)listfilterrXsortTestMethodsUsingsort functools cmp_to_key)rrPr testFnNamess`` rrMzTestLoader.getTestCaseNamessS Y6"5s=7IJK  $ $   !5!5d6O6O!P  Qrc|j}d}||j |j}n|d}|}tjj|}|tjvr tjj d|||_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__.pyrez2Can 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>abspathsysinsertisdirisfilerjrkmodulesridirname__file__rmrbuiltin_module_namesrK _get_directory_containing_moduleremover'r _find_testsr() r start_dirrU top_level_diroriginal_top_level_dirset_implicit_topis_not_importable the_moduletop_partr^s rdiscoverzTestLoader.discovers8"&!4!4   T%8%8%D //M  "# %M 6 ( HHOOA} -+! 77==3 4 2IM)(*rww||I}7](^$^! 39%![[3 $??3/2 ( ")<)<>!@I$*.*O*OPX*YD'HHOOM2 E QR RT%%i9:4u%%'&(!**c.F.FF')ABGKL(>znM#'( ( )$(! )s * I"AHAI" I0/I0ctj|}tjj |j }tjj |jjdrrrbasenamelowerrr)rrtr] full_paths rrz+TestLoader._get_directory_containing_module:s[)GGOOFOO4 77  I & , , . 9 9- H77??277??9#=> > 77??9- -rc||jk(ryttjj |}tjj ||j}tjj |rJd|jdrJd|jtjjd}|S)NrezPath must be within the projectz..) rr@r=r>normpathrelpathisabsrreplacesep)rr>_relpathrs r_get_name_from_pathzTestLoader._get_name_from_pathFs 4&& &))$/077??4)<)<=77==*M,MM*&&t,O.OO, S1 rc>t|tj|Sr )rkrr)rrs r_get_module_from_namez TestLoader._get_module_from_nameRs4{{4  rct||Sr )r)rr>rrUs r _match_pathzTestLoader._match_pathVstW%%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.reN) rrF_find_test_pathsortedr=listdirr>rjaddrdiscard) rrrUrr^should_recursepathsr>rs rrzTestLoader._find_testsZs'' 2 3;4t'='==%)$8$8G$L !E>  !rzz),-D Y5I$($8$8G$L !E>  // :&&**409#// 7CCC**2248D**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?rTFNrrWT)r=r>rrVALID_MODULE_NAMEmatchrrrrrYr@realpathrrr'rcrSkipTestr;r(r*rDr[rrjrFrr)rrrUrrr]mod_filerfullpath_noext module_dirmod_name expected_dirmsgr`rarbrWr^packages rrzTestLoader._find_test_pathzs%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(rrrSrcryr}rMrrrrrrrr r!s@rrBrB?s'(:(:;JN' 6:0PJd'&S&j . !&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)warningswarnDeprecationWarningrrM)rPrrrrs rrMrMs? MM Eq vy;K L ] ]^k llrr/crddl}|jdtdt|||j |S)Nrzunittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.rr)rrrrrS)rPrrr(rs r makeSuitersB MM Jq vy* 5 K K rcrddl}|jdtdt|||j |S)Nrzunittest.findTestCases() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromModule() instead.rr)rrrrrc)r]rrr(rs r findTestCasesrsB MM Hq vy* 5 I I rrf)!rr=rerr$rnrrrrrr __unittestcompile IGNORECASErr8r r*r,r&r;r@objectrBdefaultTestLoaderrrrMrJrrr2rrrs  (  BJJ0"--@ $-- N . (0%CCL L 7;6H6H[_m%+d6H6H "(43E3E"__ rPK!l==(__pycache__/runner.cpython-312.opt-2.pycnu[ ֦i( ddlZddlZddlZddlmZddlmZddlmZdZ Gdde Z Gd d ejZ Gd d e Zy) N)result)_SubTest)registerResultTc"eZdZ dZdZddZy)_WritelnDecoratorc||_yN)stream)selfr s (/usr/lib64/python3.12/unittest/runner.py__init__z_WritelnDecorator.__init__s  cL|dvr t|t|j|S)N)r __getstate__)AttributeErrorgetattrr )r attrs r __getattr__z_WritelnDecorator.__getattr__s' - - & &t{{4((rNcL|r|j||jdyN )write)r args r writelnz_WritelnDecorator.writelns  JJsO 4rr )__name__ __module__ __qualname__rrrrr rrsJ) rrceZdZ dZdZddfd ZdZfdZdZfd Z fd Z fd Z fd Z fd Z fdZfdZdZdZxZS)TextTestResultzF======================================================================zF----------------------------------------------------------------------N durationsc tt| |||||_|dkD|_|dk(|_||_d|_||_y)NrT) superr!rr showAlldots descriptions_newliner#)r r r( verbosityr# __class__s r rzTextTestResult.__init__&sN = nd,V\9M  1} N ( "rc|j}|jr|rdjt||fSt|Sr)shortDescriptionr(joinstr)r testdoc_first_lines r getDescriptionzTextTestResult.getDescription1s=..0   99c$i89 9t9 rctt| ||jrg|jj |j ||jj d|jjd|_yy)N ... F) r%r! startTestr&r rr2flushr)r r0r+s r r5zTextTestResult.startTest8sd nd-d3 << KK  d11$7 8 KK  g & KK   !DM rct|t}|s |jr|js|jj |r|jj d|jj |j ||jj d|jj ||jjd|_y)Nz r4T) isinstancerr)r rrr2r6)r r0status is_subtests r _write_statuszTextTestResult._write_status@sh/ == ##% !!$' KK  d11$7 8 KK  g & F#  rc||jr?t|d|jr|j|dn|j|dnv|jrjt|d|jr|j j dn|j j d|j jtt|+|||y)NrFAILERRORFE) r& issubclassfailureExceptionr<r'r rr6r%r! addSubTest)r r0subtesterrr+s r rDzTextTestResult.addSubTestMs ?||c!fg&>&>?&&w7&&w8c!fg&>&>?KK%%c*KK%%c* !!# nd.tWcBrctt| ||jr|j |dy|j r6|j jd|j jyy)Nok.) r%r! addSuccessr&r<r'r rr6r7s r rJzTextTestResult.addSuccess\sW nd.t4 <<   tT * YY KK  c " KK   rctt| |||jr|j |dy|j r6|j jd|j jyy)Nr?rA) r%r!addErrorr&r<r'r rr6r r0rFr+s r rLzTextTestResult.addErrordsY nd,T37 <<   tW - YY KK  c " KK   rctt| |||jr|j |dy|j r6|j jd|j jyy)Nr>r@) r%r! addFailurer&r<r'r rr6rMs r rOzTextTestResult.addFailurelsY nd.tS9 <<   tV , YY KK  c " KK   rctt| |||jr"|j |dj |y|j r6|jjd|jjyy)Nz skipped {0!r}s) r%r!addSkipr&r<formatr'r rr6)r r0reasonr+s r rRzTextTestResult.addSkiptsd nd+D&9 <<   t_%;%;F%C D YY KK  c " KK   rc6tt| |||jr6|jj d|jj y|jr6|jjd|jj yy)Nzexpected failurex) r%r!addExpectedFailurer&r rr6r'rrMs r rWz!TextTestResult.addExpectedFailure|sl nd6tSA << KK   2 3 KK    YY KK  c " KK   rc4tt| ||jr6|jj d|jj y|jr6|jjd|jj yy)Nzunexpected successu) r%r!addUnexpectedSuccessr&r rr6r'rr7s r rZz#TextTestResult.addUnexpectedSuccesssj nd8> << KK   4 5 KK    YY KK  c " KK   rc|js |jr4|jj|jj |j d|j |j d|jt|dd}|rt|jj|j|D]/}|jjd|j|1|jj yy)Nr?r>unexpectedSuccessesrzUNEXPECTED SUCCESS: ) r'r&r rr6printErrorListerrorsfailuresr separator1r2)r r\r0s r printErrorszTextTestResult.printErrorss 99 KK   ! KK    GT[[1 FDMM2%d,A2F  KK   0+ ##&:4;N;Nt;T:U$VW, KK    rcz|D]\}}|jj|j|jj|d|j||jj|j|jjd|z|jj y)Nz: z%s)r rr`r2 separator2r6)r flavourr^r0rFs r r]zTextTestResult.printErrorListsID# KK   0 KK  GD4G4G4M N O KK   0 KK  s + KK     r)rrrr`rcrr2r5r<rDrJrLrOrRrWrZrar] __classcell__)r+s@r r!r!sYJJEI #"  C         rr!c8eZdZ eZ dddddZdZdZdZy) TextTestRunnerNF) tb_localsr#c |tj}t||_||_||_||_||_||_| |_ ||_ |||_ yyr ) sysstderrrr r(r*failfastbufferrhr#warnings resultclass) r r r(r*rlrmrornrhr#s r rzTextTestRunner.__init__sh >ZZF'/ ("   ""   "*D  #rc |j|j|j|j|jS#t $r4|j|j|j|jcYSwxYw)Nr")ror r(r*r# TypeError)r s r _makeResultzTextTestRunner._makeResultss 4##DKK1B1B$(NNdnn$N N 4##DKK1B1B$(NN4 4 4sz0TextTestRunner._printDurations..sQqTrT)keyreverserzSlowest test durationsrcFgMbP?z%.3fs10 zA (durations < 0.001s were hidden; use -v to show these durations))collectedDurationssortedr#r rhasattrrcr*)r rlshiddenr0elapseds r _printDurationszTextTestRunner._printDurationss((  F--> " >>A OT^^$B 45 6< ( KK   1 1 2MD'~~!go KK  g.? F G   KK  !B C KK   #rc  |j}t||j|_|j|_|j|_t j 5|j rt j|j tj}t|dd}|| ||t|dd}|| tj}dddz }|j|j|j|t|dr%|jj!|j"|j$}|jj!d||dk7xrdxsd|fz|jj!dx} x} } t't(|j*|j,|j.f} | \} } } g} |j2sr|jj5d t)|j6t)|j8}}|r| j;d |z|rS| j;d |zn>|dk(r| s|jj5d n|jj5d | r| j;d| z| r| j;d| z| r| j;d| z| r/|jj!ddj=| dn|jj5d|jj?|S#t|dd}||wwxYw#1swYxYw#t0$rYwxYw)N startTestRun stopTestRunrczRan %d test%s in %.3fsrrQr{rFAILEDz failures=%dz errors=%dz NO TESTS RANOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rrrrlrmrhrncatch_warnings simplefiltertime perf_counterrrar#rr~r rrctestsRunmaplenexpectedFailuresr\skippedr wasSuccessfulrr_r^appendr.r6)r r0r startTimerrstopTime timeTakenrun expectedFailsr\rresultsinfosfailederroreds r rzTextTestRunner.runs 0!!#v--  >>  $ $ &}}%%dmm4))+I"6>4@L' "V %fmTB *M((*H'y(  >> %   ( 6< ( KK   1 1 2oo 4 #("2s"8b)DE F 899 9+g B# 7 7 & : : & 01G ;B 7M.#v##% KK  h '!&//2C 4FGF ]V34 [723 AXg KK  n - KK  d #  LL/ 0  LL/-? @  LL25HH I  KK  499U+; = > KK  d #  e&fmTB *M+' &B   s7$AM3;M+M331NM00M33M= N  N )NTrFFNN) rrrr!rorrrrrrrr rgrgs3 !KABJN+#t+*4$,Drrg)rjrrnr{rcasersignalsr __unittestobjectr TestResultr!rgrrr rsN #     C V&&C L@V@rPK!?jj*__pycache__/__main__.cpython-312.opt-1.pycnu[ ֦idZddlZejdjdrrsc 88A; & !!#..1J~-CHHQK  DrPK!A}} __pycache__/case.cpython-312.pycnu[ ֦idZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlmZmZmZmZmZdZeZdZGdd eZGd d eZGd d eZGddeZdZdZdZdZ gZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)GddZ*Gdde*Z+Gd d!e+Z,Gd"d#e+Z-Gd$d%ej\Z/Gd&d'eZ0Gd(d)e0Z1Gd*d+e0Z2y),zTest 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.ceZdZdZy)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__&/usr/lib64/python3.12/unittest/case.pyr r srr ceZdZdZy) _ShouldStopz The test should stop. Nr rrrrr"rrceZdZdZy)_UnexpectedSuccessz7 The test was supposed to fail, but it didn't! Nr rrrrr'rrrc:eZdZddZej ddZy)_OutcomeNc^d|_||_t|d|_d|_d|_y)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init__z_Outcome.__init__.s/!& (/ (E% #rc#K|j}d|_ d|r4|jr(|jj|j|d |jxr||_y#t$rt $r1}d|_t |j|t|Yd}~Td}~wt$rYbtj}|jr||_ nHd|_|r(|jj|j||nt|j||d}YxYw#|jxr||_wxYww)NTF)r rr test_caseKeyboardInterruptr _addSkipstrrsysexc_inforr! _addError)r"r%subTest old_successer*s rtestPartExecutorz_Outcome.testPartExecutor5sll   8 ,4<< &&y':':ItL<<7KDL1!   5 DL T[[)SV 4 4   ||~H%%'/$$ KK**9+>+> 8Tdkk9h?H  <<7KDLsLEA'6D+E'D(9'B% D+% D(1D+3A3D(&D++EEN)F)r rrr# contextlibcontextmanagerr/rrrrr-s!$88rrct|dd}| |||ytjdtd|j|y)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr%reasonr4s rr'r'VsDfi.G 6" L$a ))$rc|D|At|d|jr|j||y|j||yyy)Nr) issubclassfailureException addFailureaddError)rtestr*s rr+r+_sK h2 hqk4#8#8 9 F  dH - FOOD( + 3rc|Sr0r)objs r_idrDfs Jrct|} |j}|j}||}|||ddd|S#t$r(t d|j d|j ddwxYw)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrRjs r(CO ||2YFtRtT* M O!CNN+1S-=-=,>?CDEJN OOs ;1A,c4tj|||fy)znSame as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).N)_module_cleanupsappend)functionargskwargss raddModuleCleanuprYzsXtV45rc"t|tS)z&Same as enterContext, but module-wide.)rRrY)rMs renterModuleContextr[s ". //rcg}tr(tj\}}} ||i|tr(|r|dy#t$r}|j|Yd}~.d}~wwxYw)zWExecute all module cleanup functions. Normally called for you after tearDownModule.Nr)rTpop ExceptionrU) exceptionsrVrWrXexcs rdoModuleCleanupsrasqJ !1!5!5!7$ # d %f %  m #   c " " #s9 AAAc^fd}ttjr }d||S|S)z& Unconditionally skip a test. ct|tstj|fd}|}d|_|_|S)Nctr0r )rWrXr;s r skip_wrapperz-skip..decorator..skip_wrappersv&&rT) isinstancerH functoolswraps__unittest_skip____unittest_skip_why__) test_itemrfr;s r decoratorzskip..decoratorsC)T* __Y ' '( '$I&* #*0 'r)rgtypes FunctionType)r;rmrls` rskiprqs5 &%,,- ## rc(|r t|StS)z/ Skip a test if the condition is true. rqrD conditionr;s rskipIfrvsF| Jrc(|s t|StS)z3 Skip a test unless the condition is true. rsrts r skipUnlessrxs F| Jrcd|_|S)NT)__unittest_expecting_failure__)rls rr!r!s/3I, rct|trtfd|DSt|txr t |S)Nc36K|]}t|ywr0) _is_subtype).0r.basetypes r z_is_subtype..s>X;q(+Xs)rgtupleallrHr=)expectedrs `rr}r}s7(E">X>>> h % H*Xx*HHrceZdZdZdZy)_BaseTestCaseContextc||_yr0)r%)r"r%s rr#z_BaseTestCaseContext.__init__s "rc|jj|j|}|jj|r0)r%_formatMessagemsgr>)r" standardMsgrs r _raiseFailurez"_BaseTestCaseContext._raiseFailures1nn++DHHkBnn--c22rN)r rrr#rrrrrrs #3rrceZdZddZdZy)_AssertRaisesBaseContextNctj||||_||_|t j |}||_d|_d|_yr0) rr#rr%recompileexpected_regexobj_namer)r"rr%rs rr#z!_AssertRaisesBaseContext.__init__sJ%%dI6  "  %ZZ7N, rc t|j|jst|d|j|s=|j dd|_|r ttt|d|d}S|^}} |j|_ |5||i|dddd}y#t$rt||_ Y1wxYw#1swYd}yxYw#d}wxYw)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. z() arg 1 must be rNz1 is an invalid keyword argument for this function) r}r _base_typerL_base_type_strr]rnextiterr rrKr()r"namerWrX callable_objs rhandlez_AssertRaisesBaseContext.handles t}}doo>!%t':':!<==!::eT2#7;DL7I%LMMD#' L4 2 , 5 5 d-f-D " 2 #L 1  2D4DsTA6C;CB'C CC'CCCCC CCCr0)r rrr#rrrrrrs rrcHeZdZdZeZdZdZdZe e jZ y)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typesc|Sr0rr"s rrIz_AssertRaisesContext.__enter__s rc|p |jj}|jr,|j dj ||jn6|j dj |ntj|t||jsy|jd|_ |jy|j}|jt|s4|j dj |jt|y#t$rt|j}Y$wxYw)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rr rKr(rrformat traceback clear_framesr=with_traceback exceptionrsearchpattern)r"exc_type exc_valuetbexc_namers rrJz_AssertRaisesContext.__exit__s   .==11}}""#8#?#?@D $OP""?#9#9(#CD  " "2 &(DMM2"11$7    &,,$$S^4   9@@#++S^ = >+" .t}}- .sDD?>D?N) r rrr BaseExceptionrrrIrJ classmethodro GenericAlias__class_getitem__rrrrrs,MJDN6$E$6$67rrc$eZdZdZeZdZdZdZy)_AssertWarnsContextzBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typesc<ttjjD]}t |ddsi|_t jd|_|jj|_t jd|j|S)N__warningregistry__T)recordalways) listr)modulesvaluesr6rr7catch_warningswarnings_managerrI simplefilterr)r"vs rrIz_AssertWarnsContext.__enter__!syckk((*+Aq/6(*%,!) 7 7t D--779 h 6 rc|jj||||y |jj}d}|j D]}|j}t||js&||}|j%|jjt |s[||_ |j|_ |j|_ y|>|jdj|jj t ||j"r,|jdj||j"y|jdj|y#t$rt |j}YOwxYw)Nrz{} not triggered by {}z{} not triggered)rrJrr rKr(r7messagergrrwarningfilenamelinenorrrr)r"rrrrfirst_matchingmws rrJz_AssertWarnsContext.__exit__,s] &&xB?    *}}--HA Aa/%!"##/''..s1v6DLJJDM((DK   %   9@@((00#n2E G H ==   7>>x?C}} N O   188B C3 *4==)H *sE&&FFN) r rrrWarningrrrIrJrrrrrsLJ?N  DrrceZdZdZy)_OrderedChainMapc#Kt}|jD]#}|D]}||vs|j||%ywr0)setmapsadd)r"seenmappingks r__iter__z_OrderedChainMap.__iter__Ps<uyyGD=HHQKG!s #AAN)r rrrrrrrrOsrrcteZdZdZeZdZdZdZfdZ dLdZ dZ dZ d Z ed Zed Zd Zd ZedZedZdZdZdZdZdZdZdZdZej<efdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dMd Z(d!Z)ed"Z*d#Z+d$Z,d%Z-dMd&Z.dMd'Z/dMd(Z0d)Z1d*Z2d+Z3dNd,Z4dNd-Z5d.Z6dMd/Z7dMd0Z8dMd1Z9 dOd2Z: dOd3Z;dNd4ZdMd7Z?dMd8Z@dMd9ZAdMd:ZBdMd;ZCdMd<ZDdMd=ZEdMd>ZFdMd?ZGdMd@ZHdMdAZIdMdBZJdMdCZKdMdDZLdMdEZMdMdFZNdMdGZOdHZPdIZQdMdJZRdMdKZSxZTS)PTestCaseaWA 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. Tiic@d|_g|_t| |i|y)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rOrWrX __class__s rrzTestCase.__init_subclass__s% %  !4262rc||_d|_d|_ t||}|j|_g|_d|_ i|_ |jtd|jtd|jtd|jtd |jt d |jt"d y#t $r#|dk7rt d|jd|YwxYw) 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 testrunTestzno such test method in : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr6rrK ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr()r" methodName testMethods rr#zTestCase.__init__s * ' 5 z2J#-"4"4D  %'!   '89   '89   (:;   &67   ,<=   &<=) 4Y&!~~z"344' 4s C)C:9C:c"||j|<y)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)r"typeobjrVs rrzTestCase.addTypeEqualityFuncs.6!!'*rc@|jj|||fy)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).N)rrUr"rVrWrXs r addCleanupzTestCase.addCleanups xv67rc.t||jS)zEnters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method. )rRr)r"rMs r enterContextzTestCase.enterContexts b$//22rc@|jj|||fy)zpSame as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).N)rrUrOrVrWrXs raddClassCleanupzTestCase.addClassCleanups ""HdF#;>2D4H4HIIrclt|t|urtS|j|jk(Sr0)rHNotImplementedrr"others r__eq__zTestCase.__eq__s/ :T%[ (! !##u'<'<<rrs r__repr__zTestCase.__repr__s"($*>*>@ @rc+HK|j|jjsdy|j}| t|}n|jj |}t ||||_ |jj|jd5dddd|jjs*|jj}|.|jr"t|jjrt||_y#1swYmxYw#||_wxYww)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. NT)r,) rrrrparams new_child_SubTestr/r rfailfastrr!)r"rr#parent params_maprs rr,zTestCase.subTests ==  (N(N   >)&1J008J sJ7  #// t/LM==((--%&//%%.."!"DMML#DMs7A/D"2'DD A$DD" DD DD"c |j}|||y#t$r/tjdt|j |YywxYw)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerKr7r8r9r:)r"rr*r*s r_addExpectedFailurezTestCase._addExpectedFailure'sR /!'!:!:  tX .  $ MM\( * F  d # $s 5AAc |j}||y#t$rXtjdt t d#t $r)|j |tjYYywxYwwxYw)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrKr7r8r9rr?r)r*)r"rr-s r_addUnexpectedSuccesszTestCase._addUnexpectedSuccess1st '#)#>#>  ! & 8 MM_( * 8(d2% 8!!!$ 7 8 8s& #A8A.A40A83A44A8c |j}|||y#t$rtjdtYywxYw)Nz$TestResult has no addDuration method) addDurationrKr7r8r9)r"relapsedr0s r _addDurationzTestCase._addDuration@sA ' ,,K g &  * MM@( * *s #>>c$|jyr0)rrs r _callSetUpzTestCase._callSetUpIs  rcT|!tjd|dtdyy)NzFIt is deprecated to return a value that is not None from a test case (r) stacklevel)r7r8DeprecationWarning)r"methods r_callTestMethodzTestCase._callTestMethodLs3 8  MM((.xq23ERS U rc$|jyr0)rrs r _callTearDownzTestCase._callTearDownQs  rc||i|yr0rrs r _callCleanupzTestCase._callCleanupTs$!&!rc|4|j}t|dd}t|dd}| |nd}|j| t||j}t|jdds t|ddrQt|jddxs t|dd}t |||||j |||SSt|ddxs t|dd}t|}tj} ||_ |j|5|jddd|jrc||_|j|5|j|dddd|_|j|5|j!ddd|j#|j%|tj|z |jrO|r;|j&r|j)||j&n$|j+|n|j,||d|_d}d|_ |j |||SS#1swY9xYw#1swYxYw#1swYxYw#d|_d}d|_ wxYw#|j |||wwxYw)N startTestRun stopTestRunrjFrkrnrz)rr6 startTestrrr'stopTestrtime perf_counterrr/r4r rr:r< doCleanupsr2r!r+r.r:) r"rr@rArskip_whyroutcome start_times rrunz TestCase.runWs >++-F"6>4@L!&->K'K4  t';';FM $DeL v&G**,J % ' --d3OO%4??0AG- 11$7,,Z8805G- 11$7**,8!!!&4+<+<+>+KM??("22 44VW=T=TU 66v>)))$/+/'!%  FOOD !& 'A438787"+/'!%  FOOD !& 'st A.J.;J.J+I3<,J(J: JJ +BJJ.3I=8JJ J JJJ++J..K c0|jxs t}|jr[|jj\}}}|j |5|j |g|i|ddd|jr[|j S#1swY"xYw)zNExecute all cleanup functions. Normally called for you after tearDown.N)rrrr]r/r>r )r"rHrVrWrXs rrFzTestCase.doCleanupss---8:nn%)^^%7%7%9 "HdF))$/!!!( "HdF ?$)&)!! ?''..s||~> ?sA 6BBc&|j|i|Sr0)rJ)r"rWkwdss r__call__zTestCase.__call__stxx&&&rct||j}t|jdds t|ddr1t|jddxs t|dd}t||j |j ||j |jrB|jj\}}}|j|g|i||jrAyy)z6Run the test without collecting errors in a TestResultrjFrkrnN) r6rrr r4r:r<rr]r>)r"rrGrVrWrXs rdebugzTestCase.debugsT4#7#78 DNN$7 ? J 3U ;0GLL":/FK 8$ $  Z( nn%)^^%7%7%9 "HdF D  h 8 8 8nnrct|)zSkip this test.re)r"r;s rskipTestzTestCase.skipTests vrc$|j|)z)Fail immediately, with the given message.)r>)r"rs rfailz TestCase.fails##C((rcf|r/|j|dt|z}|j|y)z#Check that the expression is false.z%s is not falseNrrr>r"exprrs r assertFalsezTestCase.assertFalses7 %%c+>.$?GdGs#'c@t||}|jd||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) assertWarnsrr)r"expected_warningrWrXrfs rrhzTestCase.assertWarnss$8&&6=~~mT6::rc&ddlm}||||dS)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_AssertLogsContextFno_logs_logrmr"loggerlevelrms r assertLogszTestCase.assertLogs.s* -!$uEErc&ddlm}||||dS)z Fail unless no log messages of level *level* or higher are emitted on *logger_name* or its children. This method must be used as a context manager. rrlTrnrprrs r assertNoLogszTestCase.assertNoLogsFs -!$tDDrct|t|urD|jjt|}|t|tr t ||}|S|j S)aGet a detailed comparison function for the types of the two args. Returns: A callable accepting (first, second, msg=None) that will raise a failure exception if first != second with a useful human readable error message for those types. )rHrgetrgr(r6_baseAssertEqual)r"firstsecondasserters r_getAssertEqualityFunczTestCase._getAssertEqualityFuncOs[" ;$v, &0044T%[AH#h,&tX6H$$$rcr||k(s2dt||z}|j||}|j|y)z:The default assertEqual implementation, not type specific.%s != %sN)r rr>)r"r{r|rrs rrzzTestCase._baseAssertEqualisC$';E6'JJK%%c;7C'', ,rc>|j||}||||y)z[Fail if the two objects are unequal as determined by the '==' operator. )rN)r~)r"r{r|rassertion_funcs r assertEqualzTestCase.assertEqualps"44UFCuf#.rc||k7s:|j|t|dt|}|j|y)zYFail if the two objects are equal as determined by the '!=' operator.  == NrY)r"r{r|rs rassertNotEqualzTestCase.assertNotEqualwsI%%c59I:CF:K,MNC'', ,rc ~||k(ry| | tdt||z }|9||kryt|dt|dt|dt|d}n=|d}t||dk(ryt|dt|d|d t|d}|j ||}|j |) a'Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). If the two objects compare equal then they will automatically compare almost equal. N specify delta or places not bothz !=  within  delta ( difference)rz places (rLabsrroundrr>r"r{r|placesrdeltadiffrs rassertAlmostEqualzTestCase.assertAlmostEquals F?   !3>? ?56>"  u}% &!% $ !K ~T6"a'% &!$ !K !!#{3##C((rc n| | tdt||z }|>||k(s||kDryt|dt|dt|dt|d}n6|d}||k(st||dk7ryt|dt|d|d }|j ||}|j |) aFail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). Objects that are equal automatically fail. Nrrrrrrrz placesrrs rassertNotAlmostEqualzTestCase.assertNotAlmostEquals  !3>? ?56>"  VO% &!% $ !K ~VOtV)<)A9B59I9B69J9?AK!!#{3##C((rc |d|j}t||s |jd|dt|t||s"|jd|dt|d}d} t |}| t |}|||k(ryd|jft||zz}ttD]+} || } || } | | k7s|d | ft| | zzz }n ||k(r|t|t|k7ry||kDr%|d |||z fzz } |d |t||fzz }n)||kr$|d|||z fzz } |d |t||fzz }|} ddjtjt!j"|j%t!j"|j%z} |j'| | } |j)|| }|j+|y#t t f$r d|z}YwxYw#t t f$r d|z}YwxYw#t tt f$r|d | |fzz }YMwxYw#t tt f$r|d | |fzz }YswxYw#t tt f$r|d||fzz }YEwxYw#t tt f$r|d||fzz }YjwxYw)aAAn equality assertion for ordered sequences (like lists and tuples). For the purposes of this function, a valid ordered sequence type is one which can be indexed, has a length, and has an equality operator. Args: seq1: The first sequence to compare. seq2: The second sequence to compare. seq_type: The expected datatype of the sequences, or None if no datatype should be enforced. msg: Optional message to use on failure instead of a list of differences. NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r )r rgr>rlenrLNotImplementedError capitalizer rangemin IndexErrorrHjoindifflibndiffpprintpformat splitlines_truncateMessagerrW)r"seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualzTestCase.assertSequenceEquals  $--MdH-+++8)D/-KLLdH-+++8)D/-KLL'M  #t9D   '4y  t|0"--/1(t456I3tT?+ GE  GE E>"K#$$)=eU)K"K#MNI%,(DLX%5J$t*,d{+.;TD[-IJK K"A#'4:)>"?#@AI +.;TD[-IJK L"A#'4:)>"?#@AI   MM&...99; ...99; =>>++KA !!#{3 #K./ #B!#I #23 'G%'  '":/BC"N"#]!3#45I":/BC"O"#]!3#45I*":/BCK#259=4I#JKIK":/BCL#36:M5J#KLILsl, H: H H; I!#J J,HH H87H8;II!JJJ)(J),K Kcn|j}|t||kr||zS|tt|zzSr0)maxDiffr DIFF_OMITTED)r"rrmax_diffs rrzTestCase._truncateMessage3s:<<  s4yH4T> !,T233rc6|j|||ty)aA list-specific equality assertion. Args: list1: The first list to compare. list2: The second list to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r"list1list2rs rrzTestCase.assertListEqual9s   sT Brc6|j|||ty)aA tuple-specific equality assertion. Args: tuple1: The first tuple to compare. tuple2: The second tuple to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r"tuple1tuple2rs rrzTestCase.assertTupleEqualEs   u Erc |j|} |j|}ssyg}|r2|j d|D]}|j t |r2|j d|D]}|j t |dj |} |j|j|| y#t$r}|jd|zYd}~d}~wt$r}|jd|zYd}~d}~wwxYw#t$r}|jd|zYd}~d}~wt$r}|jd|zYd}~:d}~wwxYw)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 ) differencerLrWrKrUreprrr) r"set1set2r difference1r. difference2linesitemrs rrzTestCase.assertSetEqualPsE P//$/K  Q//$/K {   LLE F# T$Z($  LLE F# T$Z($ii&  $%%c;785 M IIG!K L L P IIJQN O O P  M IIG!K L L Q IIKaO P P QsFCD DC)) D5DD E$D99 E$EE$c||vr;t|dt|}|j|j||yy)zDJust like self.assertTrue(a in b), but with a nicer default message. not found in NrrWrr"member containerrrs rassertInzTestCase.assertIn{s@  "2;F2C2;I2FHK IId))#{; < #rc||vr;t|dt|}|j|j||yy)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nrrs r assertNotInzTestCase.assertNotIns@ Y ;DV;L8A)8LNK IId))#{; < rc||ur;t|dt|}|j|j||yy)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nrr"expr1expr2rrs rassertIszTestCase.assertIss?  ,5e,<-6u-=?K IId))#{; < rcl||ur0dt|}|j|j||yy)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nrrs r assertIsNotzTestCase.assertIsNots4 E>:CE:JLK IId))#{; < rc |j|td|j|td||k7rdt||z}ddjt j t j|jt j|jz}|j||}|j|j||yy)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr ) assertIsInstancerr rrrrrrrrWr)r"d1d2rrrs rrzTestCase.assertDictEquals b$(LM b$(MN 8$';B'CCK499W]]!>>"-88:!>>"-88:&<==D// TBK IId))#{; < rct|t|}} tj|}tj|}||k(ryt||}|r[d}|Dcgc]}d|z } }dj | } |j|| }|j||}|j|yy#t$rt ||}YuwxYwcc}w)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: z First has %d, Second has %d: %rr ) r collectionsCounterrrLrrrrrW) r"r{r|r first_seq second_seq differencesrrrrs rassertCountEqualzTestCase.assertCountEquals!%U T&\:  F'' 2E ((4F .y*EK ;EWii&G// WEK%%c;7C IIcN  I1)ZHK IXs*B2 C 2C  C c|j|td|j|td||k7rt||jkDst||jkDr|j ||||}|}|r|r|ddk7s|ddk7r*|dz }|dz }n|r|ddk7r|dz }n|r |ddk7r|dz }|j d}|j d}dt ||z}ddjtj||z} |j|| }|j|j||y y ) z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringr T)keependsrrnN) rr(r_diffThresholdrzrr rrrrrWr) r"r{r|rfirst_presplitsecond_presplit firstlines secondlinesrrs rrzTestCase.assertMultiLineEqualsY eS*JK fc+LM F?E T000F d111%%eVS9 #N$O9$r d(:"d*N#t+OF2J$.4'59,$&'22D2AJ)44d4CK%';E6'JJK"'''-- K"HIID// TBK IId))#{; <9 rc||ks;t|dt|}|j|j||yy)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nrr"abrrs r assertLesszTestCase.assertLesss91u3 b), but with a nicer default message.z not greater than Nrrs r assertGreaterzTestCase.assertGreaters91u6?lIaLQK IId))#{; <rc||k\s;t|dt|}|j|j||yy)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to Nrrs rassertGreaterEqualzTestCase.assertGreaterEquals<AvBKA,PYZ[P\]K IId))#{; <rch|0t|d}|j|j||yy)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Nonerr"rCrrs r assertIsNonezTestCase.assertIsNones1 ?.7n>K IId))#{; < rcP|$d}|j|j||yy)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rWrrs rassertIsNotNonezTestCase.assertIsNotNones* ;-K IId))#{; < rct||s2t|d|}|j|j||yy)zTSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.z is not an instance of NrgrrWrr"rCrOrrs rrzTestCase.assertIsInstance s:#s#;DS>3OK IId))#{; <$rct||r2t|d|}|j|j||yy)z,Included for symmetry with assertIsInstance.z is an instance of Nrrs rassertNotIsInstancezTestCase.assertNotIsInstances8 c3 7@~sKK IId))#{; < rcBt|||}|jd||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. assertRaisesRegexrd)r"rerrWrXrfs rrzTestCase.assertRaisesRegexs'''94P~~14@@rcBt|||}|jd||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. assertWarnsRegexri)r"rjrrWrXrfs rrzTestCase.assertWarnsRegex&s' &&6nM~~0$??rct|ttfr|sJdtj|}|j |s5d|j d|}|j||}|j|y)z=Fail the test unless the text matches the regular expression.z!expected_regex must not be empty.zRegex didn't match: rN) rgr(bytesrrrrrr>)r"textrrrs r assertRegexzTestCase.assertRegex9sv nsEl 3! F#F F>ZZ7N$$T*&&.K%%c;7C'', , +rc.t|ttfrtj|}|j |}|rWd||j |jd|jd|}|j||}|j|y)z9Fail the test if the text matches the regular expression.zRegex matched: z matches z in N) rgr(rrrrstartendrrr>)r"runexpected_regexrmatchrs rassertNotRegexzTestCase.assertNotRegexEs &e 5!zz*:;  ''- U[[]UYY[1 ((K %%c;7C'', , r)rr0)NNNNN)Ur rrrAssertionErrorr>r`rrrr#rrrrrrrrrrrrrrrrrr!r1r2_subtest_msg_sentinelr,r+r.r2r4r:r<r>rJrFrNrQrSrUrWr\r^rrcrhrurwr~rzrrrrrrrrrrrrrrrrrrrrrrrrrrrr  __classcell__rs@rrrYs@&KGN3 >@ 683== 77  VVaa#CJ= 8e@/##</ ''U "?B  ? ?'9")- - I*B;>F0E%4-/-AE $+)ZDH#'!)FaF4 C F)9V==== =@!=F= = = = = = == A @& - -rrcZeZdZdZd fd ZdZdZdZdZdZ dZ d Z d Z d Z xZS) 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. cbtt| ||_||_||_||_yr0)rrr# _setUpFunc _tearDownFunc _testFunc _description)r"testFuncrr descriptionrs rr#zFunctionTestCase.__init__^s/ .0%!'rc>|j|jyyr0)rrs rrzFunctionTestCase.setUpes ?? & OO  'rc>|j|jyyr0)rrs rrzFunctionTestCase.tearDownis    )     *rc$|jyr0)rrs rrzFunctionTestCase.runTestms  rc.|jjSr0)rr rs rrzFunctionTestCase.idps~~&&&rct||jstS|j|jk(xrO|j|jk(xr4|j |j k(xr|j |j k(Sr0)rgrrrrrrrs rrzFunctionTestCase.__eq__ssv%0! !%"2"227!!U%8%887~~07  E$6$66 7rctt||j|j|j|j fSr0)rrHrrrrrs rrzFunctionTestCase.__hash__|s7T$Z$2D2D^^T%6%689 9rc`t|jd|jjdS)Nrr)rrrr rs rrzFunctionTestCase.__str__s%$T^^4 NN335 5rcNdt|jd|jdS)Nrz tec=r )rrrrs rr!zFunctionTestCase.__repr__s ( 8%)^^5 5rc|j |jS|jj}|xr"|jddj xsdS)Nr r)rrrr r r s rrz!FunctionTestCase.shortDescriptionsO    ($$ $nn$$1syyq)//19T9rr )r rrrr#rrrrrrrr!rrrs@rrrUs:(!'7955:rrc<eZdZfdZdZdZdZdZdZxZ S)r%cnt|||_||_||_|j |_yr0)rr#_messager%r#r>)r"r%rr#rs rr#z_SubTest.__init__s1  " ) : :rctd)Nzsubtests cannot be run directly)rrs rrz_SubTest.runTests!"CDDrc`g}|jtur*|jdj|j|jrPdj d|jj D}|jdj|dj |xsdS)Nz[{}]z, c3FK|]\}}dj||yw)z{}={!r}N)r)r~rrs rrz+_SubTest._subDescription..s)$31FQ  A&1s!z({}) z ())r%rrUrr#ritems)r"parts params_descs r_subDescriptionz_SubTest._subDescriptions == 5 5 LLt}}5 6 ;;))$3"kk//1$33K LL{3 4xx/-/rcrdj|jj|jSNz{} {})rr%rr-rs rrz _SubTest.ids)~~dnn//143G3G3IJJrc6|jjS)zlReturns a one-line description of the subtest, or None if no description has been provided. )r%rrs rrz_SubTest.shortDescriptions~~..00rcVdj|j|jSr/)rr%r-rs rrz_SubTest.__str__s ~~dnnd.B.B.DEEr) r rrr#rr-rrrrrs@rr%r%s$;E 0K1 Frr%)3rr)rhrrrr7rr1rrDrornrutilrrrrr __unittestobjectrrr^r rrrr'r+rDrRrTrYr[rarqrvrxr!r}rrrrChainMaprrrr%rrrr6s4   ?? 7 y)  &8v&8R%, 6 0  (I 33'3'T$83$8N1D21Dh{++x-vx-x7:x7:t!Fx!FrPK!>ET kk&__pycache__/mock.cpython-312.opt-2.pycnu[ ֦iMdZddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZGdd eZeeDchc]}|j1d r|c}Zd ZeZd Zd ZdZdZ dZ!dZ"dydZ#dZ$dZ%dZ&dZ'dydZ(dZ)dZ*dZ+Gdde,Z-Gdde,Z.e.Z/e/j`Z0e/jbZ2e/jfZ4hd Z5d!Z6Gd"d#e7Z8d$Z9Gd%d&e,Z:Gd'd(e,Z;Gd)d*e;Z<e=ee<Dchc]$}|j1d+r|j}d+&c}Z?Gd,d-e7Z@d.ZAGd/d0e;ZBGd1d2eBe<ZCd3ZDGd4d5e,ZEd6ZFe0dddddfdd7d8ZG dzd9ZHe0dddddfdd7d:ZIGd;dZLeGeI_,eJeI_MeHeI_NeLeI_Od?eI_Pd@ZQdAZRdBjdCeRjDZUdBjdDeRjDZVhdEZWdFZXdBjeQeReUeVgjDchc]}dG|z c}ZYhdHZZdIhZ[eZe[zZ\eYeWzZ]e]e\zZ^hdJZ_dKdLdMdNdOZ`eaeaeaeadPddddQdRd dPddS ZbdTZcdUZddVZedWZfecedeeefdXZgdYZhGdZd[e;ZiGd\d]eie<ZjGd^d_eiZkGd`daeieCZlGdbdce;Zm ejee jdZpee ZqGdddee;ZsGdfdgesekeCZtGdhdie,ZueuZvdjZwGdkdlexZyeydmZz d{dd7dnZ{doZ|Gdpdqe,Z}e~e{e~evjfZdadadrZd|dsZGdtdueCZdvZGdwdxZycc}wcc}wcc}w#er$rdZpYwxYw)})Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockc eZdZy)InvalidSpecErrorN__name__ __module__ __qualname__&/usr/lib64/python3.12/unittest/mock.pyrr)sBr!r_Tct|rt|tsyt|dr t |d}t |xst j|S)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r" _is_async_objr.5sGji&@sJc:& s # ?w':':3'??r!c4t|ddr t|Sy)N__code__F)r)r)funcs r"_is_async_funcr2=stZ&"4((r!c4tt|tSN) issubclasstyper r,s r"r&r&Ds d3i 11r!cjt|txs"t|txrt|tSr4)r' BaseExceptionr6r5r,s r" _is_exceptionr9Js-3 & A3@*S-"@r!cVt|trt|dr |jS|SNmock)r' FunctionTypesr(r<r,s r" _extract_mockr>Qs%#}%'#v*>xx r!cx t|tr|s|j}d}nRt|ttfrt|trd}|j }nt|t s |j}|r t|d}n|} |tj|fS#t$rYywxYw#t$rYywxYwNT) r'r6__init__ classmethod staticmethodr%r=__call__AttributeErrorrr* signature ValueError)r1 as_instanceeat_selfsig_funcs r"_get_signature_objectrKZs $k}} D; 5 6 dK (H}} m , ==D4&W&&x000   s$) BB- B*)B*- B98B9Fct|||y\}fd}t|||t|_t|_y)Nc*j|i|yr4bind)selfargskwargssigs r"checksigz"_check_signature..checksig$!&!r!)rK_copy_func_detailsr6_mock_check_sig __signature__)r1r< skipfirstinstancerTrSs @r"_check_signaturer[}sI h :C {ID#"tX&!)DJ"DJr!c `dD]} t||t||y#t$rY)wxYw)N)r__doc____text_signature__r __defaults____kwdefaults__)setattrr)rE)r1funcopy attributes r"rVrVs:   GYi(@ A     s ! --ct|tryt|tttfrt |j St|ddyy)NTrDF)r'r6rCrBr _callabler%r)r,s r"reresD#t# k:>?&&sJ%1 r!c0t|ttfvSr4)r6listtupler,s r"_is_listris 9u %%r!c t|tst|ddduS|f|jzD]}|jj dyy)NrDTF)r'r6r)__mro____dict__get)r-bases r"_instance_callablerosZ@ c4 sJ-T99$ ==  Z ( 4% r!c t|t}t|||}||S|\} fd}t|||j}|j sd}||d}d|z} t | |||} t| | | S)Nc*j|i|yr4rN)rQrRrSs r"rTz _set_signature..checksigrUr!rb) _checksig_r<zYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r'r6rKrVr isidentifierexec _setup_func) r<originalrZrYresultr1rTnamecontextsrcrbrSs @r"_set_signaturer{s 8T*I "8Xy AF ~ ID#"tX&   D    %t4G $&* +C #wdmGs# Nr!c_fd}fd}fd}fd}fd}fd}fd} fd} d _d _d_t _t _t _j_j_ j_ |_ |_ |_ | _| _|_|_|_|__y) Nc(j|i|Sr4)assert_called_withrQrRr<s r"r~z'_setup_func..assert_called_with&t&&777r!c(j|i|Sr4) assert_calledrs r"rz"_setup_func..assert_calleds!t!!42622r!c(j|i|Sr4)assert_not_calledrs r"rz&_setup_func..assert_not_calleds%t%%t6v66r!c(j|i|Sr4)assert_called_oncers r"rz'_setup_func..assert_called_oncerr!c(j|i|Sr4)assert_called_once_withrs r"rz,_setup_func..assert_called_once_withs+t++T.assert_has_callss$t$$d5f55r!c(j|i|Sr4)assert_any_callrs r"rz$_setup_func..assert_any_calls#t##T4V44r!ct_t_jj}t |r|ur|jyyyr4) _CallList method_calls mock_calls reset_mock return_valuer&)retrbr<s r"rz_setup_func..reset_mocksL({&[ "" S !#+ NN +6 !r!Fr)r<called call_count call_argsrcall_args_listrrr side_effect_mock_childrenr~rrrrrrrrX_mock_delegate) rbr<rSr~rrrrrrrs `` r"rurusGL8378=65GNGG&[G$;G"G,,G**G!00G!3G&=G#/G-G#G)G 1G!3GG!Dr!c tjj_d_d_t _fd}dD]}t|t||y)Nrc<tj||i|Sr4)r)r<)attrrQrRr<s r"wrapperz"_setup_async_mock..wrapper s 'wtyy$'888r!)assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listrar)r<rrcs` r"_setup_async_mockrsV ++99DDDO$;D 9,  i)!<=,r!cd|ddz|k(S)N__%s__r rxs r" _is_magicrs d1Rj D ((r!c eZdZ dZdZdZy)_SentinelObjectc||_yr4rrPrxs r"rAz_SentinelObject.__init__"s  r!c d|jzSNz sentinel.%srrPs r"__repr__z_SentinelObject.__repr__%tyy((r!c d|jzSrrrs r" __reduce__z_SentinelObject.__reduce__(rr!N)rrrrArrr r!r"rr s'))r!rc eZdZ dZdZdZy) _Sentinelci|_yr4) _sentinelsrs r"rAz_Sentinel.__init__.s r!cb|dk(rt|jj|t|S)N __bases__)rEr setdefaultrrs r" __getattr__z_Sentinel.__getattr__1s, ;  ))$0EFFr!cy)Nrr rs r"rz_Sentinel.__reduce__7sr!N)rrrrArrr r!r"rr,sKG r!r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecftj|d|z}||fd}||fd}t||S)N_mock_cN|j}| t||St||Sr4)rr))rPrx _the_namerSs r"_getz"_delegating_property.._getLs,!! ;4+ +sD!!r!cZ|j}|||j|<yt|||yr4)rrlra)rPvaluerxrrSs r"_setz"_delegating_property.._setQs,!! ;',DMM) $ Cu %r!)_allowed_namesaddproperty)rxrrrs r"_delegating_propertyrIs>t4I " $y& D$ r!ceZdZdZdZy)rct|tstj||St|}t|}||kDryt d||z dzD]}||||z}||k(syy)NFrT)r'rg __contains__lenrange)rPr len_valuelen_selfisub_lists r"rz_CallList.__contains__^sw%&$$T51 1J t9 x q(Y.23AAa k*H5 4r!c>tjt|Sr4)pprintpformatrgrs r"rz_CallList.__repr__ls~~d4j))r!N)rrrrrr r!r"rr\s  *r!rct|}t|sy|js$|js|j |j y|}|||ury|j }||r||_||_|r||_||_y)NFT)r>r&rrrr)parentrrxnew_name_parents r"_check_and_set_parentrps % E U #   U11    '    +G   e **  !'' # r!ceZdZdZdZy) _MockIterc$t||_yr4)iterr-)rPr-s r"rAz_MockIter.__init__s 9r!c,t|jSr4)nextr-rs r"__next__z_MockIter.__next__sDHH~r!N)rrrrArr r!r"rrs r!rceZdZeZdZdZy)BaseNcyr4r rPrQrRs r"rAz Base.__init__s r!)rrrrrrrAr r!r"rrs  r!rceZdZ eZ d+dZ d+dZdZd,dZ d-dZ dZ d Z d Z e e e e Ze d Zed Zed ZedZedZedZdZdZe eeZd.ddddedefdZdZdZdZdZdZdZ dZ!dZ"d/dZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d,d'Z+d(Z,d)Z-d0d*Z.y)1r NFc  |f} t|ts|xs|}|t|rt|f} t|j| d|j i}t t|j|}|S)Nr]) r5AsyncMockMixinr.r6rr] _safe_superr __new__)clsspecrrxspec_setr _spec_state _new_name _new_parent_spec_as_instance _eat_selfunsaferRbasesspec_argnewrZs r"rzNonCallableMock.__new__sm#~.'4H# h(?'-3<<CKK(@A4<rrrrra)rPr<rc inner_mocks r" attach_mockzNonCallableMock.attach_mocks@ C#4( "& &* # " $( !i&r!c* |j||yr4)rrPrrs r" mock_add_speczNonCallableMock.mock_add_specs N D(+r!ct|rtd|dd}d}g}|{t|spt|tr|}n t |}t |||}|xr|d}t |} | D]*} tt|| ds|j| ,| }|j} || d<|| d<|| d<|| d<|| d<y) Nz#Cannot spec a Mock object. [object=]r _spec_class _spec_set_spec_signature _mock_methods _spec_asyncs) r&rrir'r6rKdirrr)appendrl) rPrrrrrrr res spec_listrrls r"rzNonCallableMock._mock_add_specs T ""%HPQ#RS S   HTN$%" "4j '(99FC!nc!fOD I!&wtT4'@A ''-"D=="- (&5"#$(!#/ r!c|j}|j|jj}|tur&|j|j |d}||_|S)N()rr)rrrrr _get_child_mock)rPrs r"__get_return_valuez"NonCallableMock.__get_return_valuese%%    *%%22C '>d..6&& D'C!$D  r!cj|j||j_y||_t||ddy)Nr&)rrrr)rPrs r"__set_return_valuez"NonCallableMock.__set_return_value*s2    */4D   ,&+D # !$tT :r!z1The value to be returned when the mock is called.cH|j t|S|jSr4)rr6rs r" __class__zNonCallableMock.__class__6s$    #: r!rrrrrc|j}| |jS|j}|8t|s-t |t st |st |}||_|Sr4)rrrcallabler'rr9)rP delegatedsfs r"__get_side_effectz!NonCallableMock.__get_side_effectCs\''  )) )  " " N8B<"2y1-:K2B$&I ! r!cTt|}|j}|||_y||_yr4) _try_iterrrr)rPrr0s r"__set_side_effectz!NonCallableMock.__set_side_effectNs-% ''  %*D "$)I !r!rrrrc |g}t||vry|jt|d|_d|_d|_t |_t |_t |_|r t|_ |rd|_ |jjD]/}t|ts|t ur|j#|||1|j}t%|r||ur|j#|yyy)NFrr6)idr"rrrrrrrrrrrvaluesr' _SpecState_deletedrr&)rPvisitedrrchildrs r"rzNonCallableMock.reset_mockYs 8 ?G d8w  r$x  #+'k%K &-D # %)D "((//1E%,0A   W<[  Y2 %% S !co NN7 #'6 !r!c t|jdD]H\}}|jd}|j}|}|D]}t ||}t |||Jy)Nc*|djdS)Nr.)count)entrys r"z0NonCallableMock.configure_mock..sq1Dr!)keyr@)sorteditemssplitpopr)ra)rPrRargvalrQfinalr-rBs r"rzNonCallableMock.configure_mockysm ,v||~$E FHC 99S>DHHJECc5) C $Fr!c |dvr t||j$||jvs|tvr$td|zt|r t||jsD|jr||jvr*|j ds|t vrt|d|dtj5|jj|}|tur t||Jd}|jt|j|}|j|||||}||j|<nat|t rQ t#|j$|j&|j(|j*|j,}||j|<ddd|S#t.$r6|j0dxs|}t/d|d |d |d |j$d wxYw#1swYSxYw) N>rrzMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)rrxrrrrCannot autospec attr from target , as it has already been mocked out. [target=, attr=r)rEr _all_magicsrr startswith_ATTRIB_DENY_LISTr _lockrrmr;r r)r(r'r:r rrrZrrxrrl)rPrxrwr target_names r"rzNonCallableMock.__getattr__s  4 4 & &    +4---1D$%F%MNN t_ & &  $*<*<DL^L^@^OPTX\mTm$h''+h.KMNN " "((,,T2F!$T**##/$D$4$4d;E--d%4 $..4##D)FJ/ D, V__foo v{{F.4##D);#> (D"&-- "="EK*/x}&/*##'('&++CDDD/#> s&6B GAFG?GGG(c||jg}|j}|}d}|dgk(rd}|B|}|j|j|zd}|jdk(rd}|j}|Btt |}|j xsd}t |dkDr |ddvr|dz }||d<dj|S)Nr@r&rr<r)r&z().r)rrr"rgreversedrrjoin)rP _name_listrlastdot_firsts r"_extract_mock_namez"NonCallableMock._extract_mock_names))* '' $ C!D   g44s: ;C%%-..G!(:./ *F z?Q !}M1#  1 wwz""r!c|j}d}|dvrd|z}d}|j)d}|jrd}||jjz}dt |j||dt |dS) Nr)r<zmock.z name=%rz spec=%rz spec_set=%r)rbrrrr6r8)rPrx name_string spec_strings r"rzNonCallableMock.__repr__s&&( ( ($t+K    '$K~~, %(8(8(A(AAK J     tH   r!c tstj|S|jxsg}t t |}t |j}|jjDcgc]\}}|tur|}}}|Dcgc]}|jdr|}}|Dcgc] }|jdr t|r|"}}tt||z|z|zScc}}wcc}wcc}w)Nr#)r object__dir__rr!r6rgrlrrFr;rWrrEset)rPextras from_type from_dictm_namem_valuefrom_child_mockses r"rizNonCallableMock.__dir__sF>>$' '##)rT O ' *.*=*=*C*C*E(*Evwh& *E (!*C 1c1BQ C )# 1c1Bq\ #c&9,y8;KKLMM(D#s3C3C9%C9/%C>c`|tvrtj||Sjr6j*|jvr|j vrt d|z|tvrd|z}t ||tvrj|jvrt d|zt|s)tt|t|||fd}n^t|d|tt|||j|<n*|dk(r|_yt|||r|j|<j r/t#|s#j%d|}t d|t'|t(r|j |<ytj||S)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.cg|i|Sr4r )rQkwrvrPs r"rCz-NonCallableMock.__setattr__..sHT,GD,GB,Gr!r-r@z Cannot set )rrh __setattr__rrrlrE_unsupported_magicsrVr&rar6 _get_methodrrrrr(rbr'r)rPrxrmsg mock_namervs` @r"ruzNonCallableMock.__setattr__s > !%%dD%8 8nn!3!3!? ** *  % !Dt!KL L ( (BTIC % % [ !!-$d>P>P2P$%H4%OPP$U+T D+dE*BC G&dE4>T D%0,1##D) [ $D  $T5$=,1##D)   WT4%82245Qtf=I ;yk!:; ; e\ *"'DMM$  !!$e44r!c|tvr;|t|jvr$tt||||jvry|jj |t }||jvr tt|j|n|tur t||t ur |j|=t|j|<yr4) rVr6rldelattrrrm_missingrr __delattr__r;rE)rPrxr-s r"r}zNonCallableMock.__delattr__+s ; 44:+>+>#> DJ %4==(!!%%dH5 4==  . : :4 @ H_ & & h ##D)$,D!r!c<|jxsd}t|||Sr;)r_format_call_signaturerPrQrRrxs r"_format_mock_call_signaturez+NonCallableMock._format_mock_call_signature=s(&%dD&99r!cpd}|j||}|j}|j|}||||fzS)Nz0expected %s not found. Expected: %s Actual: %s)rr)rPrQrRactionmessageexpected_stringr actual_strings r"_format_mock_failure_messagez,NonCallableMock._format_mock_failure_messageBsFF::4HNN 888)D &/=AAAr!c" |s |jSd}|jddjd}|j}|D]K}|j |}|t |t r|St|}|j}|j}M|S)Nr&rr@)rreplacerGrrmr'r:r>)rPrxrSnameschildrenr=s r"_get_call_signature_from_namez-NonCallableMock._get_call_signature_from_nameJs '' ' T2&,,S1&&DLL&E} 5* = &e, //++ r!cx t|tr#t|dkDr|j|d}n |j}|Pt|dk(rd}|\}}n|\}}} |j |i|}t ||j|jS|S#t$r}|jdcYd}~Sd}~wwxYw)Nrrr) r'rhrrrrOrrQrR TypeErrorwith_traceback)rP_callrSrxrQrR bound_callrqs r" _call_matcherzNonCallableMock._call_matcherks  eU #E Q44U1X>C&&C ?5zQ$ f%*"dF .%SXXt6v6 D*//:3D3DEEL .''-- .s 2B B9B4.B94B9c |jdk7r._error_messages33D&ACJr!Ttwo)rrrr_Callr' Exception)rPrQrRexpectedactual error_messagercauses``` r"r~z"NonCallableMock.assert_called_withs 3 >> !77fEH"F)M / / %%eT6N&EF##DNN3 X  *8Y ?HTE !12 = r!c |jdk(sz3NonCallableMock.assert_has_calls..FAZ9-Eac3@K|]}j|ywr4rrcrPs r"rz3NonCallableMock.assert_has_calls..sM_d003_zCalls not found.z+Error processing expected calls. Errors: {} Expected: z Actual)prefixr@r<z does not contain all of z in its call list, found z instead)rrrrformatr'rrrrstriprgremoverGr"rrh) rPcalls any_orderrrr all_callsproblemrq not_foundkalls ` r"rz NonCallableMock.assert_has_callss 14995aD&&q)59FFMMT__MM y(=0G ,-3V-5$7-5*4Ay)AAt$K-5$7.8%i !!*5!1 2''z':AA#FGI  O  D '  &  &*oo&?&?&+I&6 C   7:$7 '  & 'sD,D$D))EEc$ |jt||fd}t|tr|nd}|jDcgc]}|j|}}|s |t |vr!|j ||}td|z|ycc}w)NTrz%s call not found)rrr'rr _AnyComparerrrrPrQrRrrrrrs r"rzNonCallableMock.assert_any_calls , %%eT6N&EF&x;151D1DE1DA$$$Q'1DE HL$88">>tVLO #o5 9FB c L |jr,d|vrd|dnd}|j|z}t||jd}||jdvr t di|St |}t|tr|tvrt }nt|tr0|tvs|jr||jvrt}nTt }nMt|ts.t|trt}n&t|trt }n|j"d}di|S)Nrxr@r&rr rr )rrbrErmrlr r6r5r_async_method_magicsr_all_sync_magicsr CallableMixinr r rrk)rPrtrcryr_typeklasss r"r(zNonCallableMock._get_child_mocks  !   ,2bL!BvJ<(dI//1I=I + +FF;'  n5 5?r? "T  eY 'I9M,ME ~ .--&&98J8J+J!!E=1%!56!E?3MM!$E{r{r!cV |jsyd|dt|jdS)Nr z: r@)rr)rPrs r"rzNonCallableMock._calls_repr's2 F82i89;;r!) NNNNNNrNFNFF)FFr4)r)Calls)/rrrrrYrrArrr"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr-rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrboolrrrrbrrirur}rrrrrrrr~rrrr(rr r!r"r r s`* GE=AEIBEI, 8*Z  #L  !,!;!;c!AN!R&66K-%r!c|j}|Bt|r|t|st|}t|r |||i|}|tur|S|j tur |j S|jr(|jj tur |j S|j|j|i|S|j Sr4) rr9rerrrrrr )rPrQrReffectrws r"rz CallableMixin._execute_mock_calls!!  V$ v&f ( L00W$  " "' 1$$ $   4#6#6#C#C7#R$$ $    '#4##T4V4 4   r!) rrrrrArWrDrrrr r!r"rr[s8 d$d!RT ' 08,7\!r!rc eZdZy)rNrr r!r"rrs7r!rc:d}|D]}||vst|dy)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r"_check_spec_arg_typosrs1 2E ? "(OP r!ceZdZdZgZdddZdZdZdZe jdZ d Z d Z d Zd Zd ZdZdZy)_patchNFrc ~| |tur td| td| s t| t|rt d|d|dt|rt d|d|d||_||_||_||_||_ ||_ d|_ ||_ ||_ | |_g|_d|_y)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=rz? as the spec_set target has already been mocked out. [spec_set=F)rrGrr&rgetterrcr new_callablercreate has_localrautospecrRadditional_patchers is_started) rPrrcrrrrrrrRrs r"rAz_patch.__init__s  #'! B# G !& ) T ""#I=166:XQ@A A X &"#I=1AAI AOP P "(       #% r!c ft|j|j|j|j|j |j |j|j|j }|j|_ |jDcgc]}|jc}|_ |Scc}wr4) rrrcrrrrrrrRattribute_namercopy)rPpatcherps r"rz _patch.copy7s KK499 KK MM4,,dkk  "&!4!4"66' 6AFFH6' #' s B.ct|tr|j|Stj|r|j |S|j |Sr4r'r6decorate_classr*rdecorate_async_callabledecorate_callable)rPr1s r"rDz_patch.__call__DsM dD !&&t, ,  & &t ,//5 5%%d++r!ct|D]^}|jtjs#t ||}t |ds<|j }t||||`|SNrD)r!rWr TEST_PREFIXr)r(rra)rPrr attr_valuers r"r z_patch.decorate_classLsaJD??5#4#45 -J:z2iikG E4!4 5 r!c#RKg}tj5}|jD]U}|j|}|j|j |2|j tusE|j|W|t|z }||fdddy#1swYyxYwwr4) contextlib ExitStack patchings enter_contextrupdaterrr"rh)rPpatchedrQkeywargs extra_args exit_stackpatchingrIs r"decoration_helperz_patch.decoration_helperZs  ! ! #z#-- ..x8**6OOC(\\W,%%c* . E*% %D" "$ # #s#B'AB+'B B'B$ B'ctdrjjStfdg_S)Nrclj||5\}}|i|cdddS#1swYyxYwr4rrQrnewargs newkeywargsr1rrPs r"rz)_patch.decorate_callable..patchedos=''(,(025Kg{W4 4222s *3r(rr"rrPr1rs``@r"r z_patch.decorate_callableisK 4 % NN ! !$ 'K t 5  5 "Fr!ctdrjjStfdg_S)NrcKj||5\}}|i|d{cdddS7 #1swYyxYwwr4rr s r"rz/_patch.decorate_async_callable..patchedsN''(,(025Kg{!7:k::22;22s#A646 A6?Ar#r$s``@r"r z_patch.decorate_async_callablezsK 4 % NN ! !$ 'K t ;  ; "Fr!cH|j}|j}t}d} |j|}d}|tvrt|trd|_ |js|turt |d|||fS#tt f$rt ||t}YiwxYw)NFTz does not have the attribute ) rrcrrlrEKeyErrorr) _builtinsr'rr)rPtargetrxrvlocals r" get_originalz_patch.get_originals~~ t,HE 9 FJ!?DK{{x72 7=tD ) 6vtW5H 6sA>> B! B!c L |jr td|j|j|j}}}|j |j }}|j}|j|_ |durd}|durd}|durd}| | td|||dvr td|j\}}|turl|id} |dur |}|dur|}d}n| |dur |}d}n|dur|}||%|tur tdt|trd} ||} nb|t|rt } nN||D|} ||} t#| rd| v} n t%|  } t| rt } n| rt&} n t(} nt(} i} ||| d <||| d <t| tr+t+| t,r|j.r|j.| d <| j1|| di| }| rFt3|r:|} ||} t#| st5| st&} | j7d | d|d d | |_n||tur td|tur tdt;|}|dur|}t3|jr)t=d|j.d|jd|dt3|rMt?|jd|j}t=d|j.d|d|jd|d tA|f||j.d|}n |r td|}||_!||_"tGjH|_%d|_ tM|j|j.||jNui}|jtur|||jN<|jPD]A}|jJjS|}|jtus1|j1|C|S|S#|jTtWjXsYyxYw)NzPatch is already startedFzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerDrrrxr&r'zBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=TruerRz: as the patch target has already been mocked out. [target=rUrrrSrT)r_namez.Can't pass kwargs to a mock we aren't creatingr )-rrrrrrrRrrr*rr,rr'r6r.r rir/r rr5r rcrr&rorHrrrr)r temp_originalis_localrr _exit_stackrarrr__exit__sysexc_info)rPrrrrrRrrvr+inheritKlass this_spec not_callable_kwargsrZnew_attrrrrIs r" __enter__z_patch.__enter__s ??9: :"hh 4==8T==$++&(( kkm  5=D u H u H   4=> >  !5 L (TU U++-% '>h.Gt|t#'HD!t##HDT!#8#7w&#$GHHh-"G'$-"9!!X%9 ' (II&#-Y#>L'/ ':#:L +%E!0E%E!G"&#&. #5$'5/2t~~"&.. NN6 ""'"C,S1! ' (I +&y10E F##($4SD$4+2$4  !'!(7" GHHH~H4# -&+DNN+=>#{{oWXLCDD!*%dkk:t{{K &+DNN+=]"o&#{{oWXLCDD "(BX(,B:@BC LM M% %//1  DKK :"". 88w&7:Jt223 $ 8 8H**88BC||w."))#.!9"!J  4==#,,.12sB O=&O=;O==$P#c |jsy|jr>|jtur,t |j |j |jnt|j |j |jsYt|j |j r|j dvr+t |j |j |j|`|`|`|j}|` d|_|j|S)N)r]rr___annotations__r`F) rr0r/rrar*rcr{rr(r1r2)rPr4rs r"r2z_patch.__exit__=s  ==T//w> DKK1C1C D DKK 0;; T^^(L+== T^^T5G5GH   M K%%  "z""H--r!c^ |j}|jj||Sr4)r;_active_patchesr"rPrws r"startz _patch.startVs*;! ##D) r!c |jj||jdddS#t$rYywxYwr4)r?rrGr2rs r"stopz _patch.stop]sG#   ' ' - }}T4..   s 1 ==)rrrrr?rArrDr rcontextmanagerrr r r,r;r2rArCr r!r"rr sgNOAF# L ,  # #""0Xt.2/r!rc |jdd\}}t t j ||fS#tttf$rtd|wxYw)Nr@rz,Need a valid target to patch. You supplied: )rsplitrrGrErpkgutil resolve_name)r*rcs r" _get_targetrIisjG"MM#q1  7'' 0) ;; z> 2G:6* EG GGs 3#Arc x tturtdfd} t| |||||||| | S)Nz3 must be the actual object to be patched, not a strcSr4r r*sr"rCz_patch_object..sVr!r)r6strrr) r*rcrrrrrrrrRrs ` r" _patch_objectrNrsX  F|sjK L  F  3f(L& r!c  tturttj}nfd}|s t dt |j}|d\} } t|| | |||||i } | | _ |ddD]:\} } t|| | |||||i } | | _ | jj| <| S)NcSr4r rLsr"rCz!_patch_multiple..sr!z=Must supply at least one keyword argument with patch.multiplerr) r6rMrrGrHrGrgrFrrrr") r*rrrrrrRrrFrcrr this_patchers ` r"_patch_multiplerRs( F|s--v6  K    E1XNIs 3fh,G'G) 3 IsD&( lB '0 ###**<8 $ Nr!c J t|\} } t| | |||||||| S)Nr)rIr) r*rrrrrrrrRrrcs r"rrs=FN$F+FI  3f(L& r!cReZdZ d dZdZdZdZdZdZdZ dZ d Z d Z d Z y ) _patch_dictc ||_t||_|jj|||_d|_yr4)in_dictdictr9rclear _original)rPrWr9rYrRs r"rAz_patch_dict.__init__/s4 6l  6" r!ct|tr|j|Stj|r|j |S|j |Sr4r )rPfs r"rDz_patch_dict.__call__8sM a &&q) )  & &q )//2 2%%a((r!c2tfd}|S)Ncj |i|jS#jwxYwr4rU _unpatch_dictrQrtr\rPs r"_innerz-_patch_dict.decorate_callable.._innerAs8     %$~"~""$""$s+=rrPr\rbs`` r"r z_patch_dict.decorate_callable@ q %  % r!c2tfd}|S)NcKj |i|d{jS7#jwxYwwr4r_ras r"rbz3_patch_dict.decorate_async_callable.._innerMsD     %^^+""$,""$s%A  757A 7A  A rcrds`` r"r z#_patch_dict.decorate_async_callableLrer!ct|D]{}t||}|jtjs/t |ds>G - NN8 $ -'}   -s7AAc> |j|jyNF)rZr`)rPrQs r"r2z_patch_dict.__exit__s >> %    r!cf |j}tjj||Sr4)r;rr?r"r@s r"rAz_patch_dict.starts*;!%%d+ r!c tjj||j dddS#t$rYywxYwr4)rr?rrGr2rs r"rCz_patch_dict.stopsG#   " " ) )$ / }}T4..   s5 AAN)r F)rrrrArDr r r r;rUr`r2rArCr r!r"rUrUs>8)   +8 -/r!rUcn |jy#t$rt|}|D]}||=YywxYwr4)rYrErg)rWkeysrDs r"rmrms9  G}C s 44cb ttjD]}|jyr4)r\rr?rC)rs r"_patch_stopallrvs#A&001 2r!testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c#&K|] }d|z yw)zi%sNr rns r"rrs7&6519&6c#&K|] }d|z yw)zr%sNr rzs r"rrs5$4q$4r|>ri__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c" fd}||_|S)Nc|g|i|Sr4r )rPrQrtr1s r"methodz_get_method..methodsD&4&2&&r!)r)rxr1rs ` r"rwrws@'FO Mr!r> __aexit__ __anext__ __aenter__ __aiter__>__del__rrAr __prepare__ru__instancecheck____subclasscheck__c,tj|Sr4)rh__hash__rs r"rCrCs V__T2r!c,tj|Sr4)rh__str__rs r"rCrCs FNN40r!c,tj|Sr4)rh __sizeof__rs r"rCrCsv006r!cjt|jd|jdt|S)N/)r6rrbr8rs r"rCrCs3$t*"5"5!6a8O8O8Q7RRSTVW[T\S]^r!)rrr __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r2 __complex__ __float____bool__ __index__rcfd}|S)NcZjj}|tur|S|urytSr@)__eq__rrNotImplemented)otherret_valrPs r"rz_get_eq..__eq__s/++00 ' !N 5=r!r )rPrs` r"_get_eqrs Mr!cfd}|S)Nc^jjturtS|urytSrp)__ne__rrr)rrPs r"rz_get_ne..__ne__#s* ;; ) ) 8N 5=r!r )rPrs` r"_get_ner"s Mr!cfd}|S)Ncljj}|tur tgSt|Sr4)__iter__rrrrrPs r"rz_get_iter..__iter__,s/--22 g 8OG}r!r )rPrs` r" _get_iterr+s Or!cfd}|S)Ncjj}|turtt gStt |Sr4)rrr_AsyncIteratorrrs r"rz"_get_async_iter..__aiter__6s8..33 g !$r(+ +d7m,,r!r )rPrs` r"_get_async_iterr5s- r!)rrrrctj|t}|tur||_ytj|}|||}||_yt j|}||||_yyr4)_return_valuesrmrr_calculate_return_value_side_effect_methodsr)r<rrxfixedreturn_calculatorr side_effectors r"_set_return_valuerFs{   tW -E G#/33D9$(. *(,,T2M *40!r!ceZdZdZdZy) MagicMixinc|jtt|j|i||jyr4)_mock_set_magicsrrrA)rPrQrts r"rAzMagicMixin.__init__Ys6 . J%..;; r!c zttz}|}t|ddU|j|j}t }||z }|D]&}|t |jvst||(|t t |jz }t |}|D]}t||t||y)Nr) _magicsrr) intersectionrrjr6rlr{ra MagicProxy)rP orig_magics these_magics remove_magicsrBrs r"rzMagicMixin._mock_set_magics_s 44 " 4$ / ;&33D4F4FGLEM',6M&DJ///D%(' $c$t**=*=&>> T !E E5*UD"9 :"r!N)rrrrArr r!r"rrXs  ;r!rceZdZ ddZy)r cJ |j|||jyr4rrrs r"rz"NonCallableMagicMock.mock_add_specy& N D(+ r!Nr)rrrrr r!r"r r ws 7 r!r c eZdZy)AsyncMagicMixinNrr r!r"rrsr!rc4eZdZ ddZdddeffdZxZS)rFcJ |j|||jyr4rrs r"rzMagicMock.mock_add_specrr!)rrc|r#|jrt|jrd}tj|d|i|y)NFr)rrsuperr)rPrrQrRr-s r"rzMagicMock.reset_mocks< $//* !LDF|FvFr!r)rrrrrr __classcell__r-s@r"rrs&  9> G G Gr!rc eZdZdZdZddZy)rc ||_||_yr4rxr)rPrxrs r"rAzMagicProxy.__init__s  r!c|j}|j}|j|||}t|||t ||||S)N)rxrr)rxrr(rar)rPrBrms r" create_mockzMagicProxy.create_mocksM   " "/5 # 7q!&!U+r!Nc"|jSr4)r)rPr-rs r"r~zMagicProxy.__get__s!!r!r4)rrrrArr~r r!r"rrs"r!rceZdZedZedZedZfdZdZdZ dZ dZ d Z d Z dd Zd Zfd ZxZS)rrrrctj|i|tjj|j d<d|j d<d|j d<t |j d<tr7tt}t|j d<t|j d<ntt}tjtjztjz|_d|_d |_d|_d|_||j d <d |j d <t)|j d <i|j d<d|j d<y)Nrr_mock_await_count_mock_await_args_mock_await_args_listrrr)rQrRr0r rr_r`r=)rrArrrrlr _CODE_SIGr _CODE_ATTRSrr* CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountrh)rPrQrR code_mockr-s r"rAzAsyncMockMixin.__init__s6$)&)*1););)I)I o&-. )*,0 ()1: -. '=I08I  } -4=I  0 1':I     !$$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(r!cKt||fd}|xjdz c_||_|jj ||j }|_t |r|t|s t|}t |r&|t|r||i|d{}n||i|}|tur|S|jtur |jS|jAt|jr|j|i|d{S|j|i|S|jS#t$rtwxYw777w)NTrr)rrrrr"rr9rer StopIterationStopAsyncIterationrrrrr )rPrQrRrrrws r"rz!AsyncMockMixin._execute_mock_callsTtVn$/ A ##E*!!  V$ v&-!&\F !( L$V,%t6v6600W$  " "' 1$$ $    '"4#3#34-T--t>v>>>#4##T4V4 4   -%--,-7?s=A-E0 D-;#EEA+E E "E-D==EEcb |jdk(rd|jxsdd}t|y)Nr Expected r<z to have been awaited.rrrrs r"rzAsyncMockMixin.assert_awaited s@    q doo788NOC % % !r!c| |jdk(s,d|jxsdd|jd}t|yNrrr<z$ to have been awaited once. Awaited rrrs r"rz"AsyncMockMixin.assert_awaited_once sR 1$t8&9:#//09C % %%r!c: j!j}td|dfd}jt fd}jj}||k7r%t |t r|nd}t||y)NzExpected await: z Not awaitedc0jd}|S)Nawait)rrrs r"rz:AsyncMockMixin.assert_awaited_with.._error_message( s33D&3QCJr!Tr)rrrrrr'r)rPrQrRrrrrs``` r"rz"AsyncMockMixin.assert_awaited_with s  ?? "77fEH #3H:]!KL L %%eT6N&EF##DOO4 X  *8Y ?HTE !12 = r!c |jdk(s,d|jxsdd|jd}t||j|i|Sr)rrrrrs r"rz'AsyncMockMixin.assert_awaited_once_with2 se 1$t8&9:#//09C % %'t''888r!c$ |jt||fd}t|tr|nd}|jDcgc]}|j|}}|s |t |vr!|j ||}td|z|ycc}w)NTrz%s await not found)rrr'rrrrrrs r"rzAsyncMockMixin.assert_any_await= s %%eT6N&EF&x;151E1EF1EA$$$Q'1EF HL$88">>tVLO $6 9Grc B |Dcgc]}j|}}td|Dd}tfdjD}|sb||vr]|d}n1dj |Dcgc]}t |t r|ndc}}t|dt|dj|yt|}g} |D]} |j| | rtt| d|ycc}wcc}w#t$r| j| YXwxYw)Nc3BK|]}t|ts|ywr4rrs r"rz3AsyncMockMixin.assert_has_awaits..W rrc3@K|]}j|ywr4rrs r"rz3AsyncMockMixin.assert_has_awaits..X sS>Rt11!4>RrzAwaits not found.z,Error processing expected awaits. Errors: {}rz Actual: z not all found in await list) rrrrrr'rrrgrrGr"rh) rPrrrrr all_awaitsrrqrrs ` r"rz AsyncMockMixin.assert_has_awaitsJ sa 4995aD&&q)59FFMSd>R>RSS z)=1G ,-3V-5$7-5*4Ay)AAt$K-5$7.8%i !!*5!1 23#3346  *%  D '!!$'  49)4DF  7:$7 '  & 'sC7,C< DDDc| |jdk7r,d|jxsdd|jd}t|y)Nrrr<z# to not have been awaited. Awaited rrrs r"rz!AsyncMockMixin.assert_not_awaitedv sR    q t8&9:#//09C % % !r!cv tj|i|d|_d|_t |_yNr)rrrrrr)rPrQrRr-s r"rzAsyncMockMixin.reset_mock s:  D+F+({r!r)rrrrrrrrArrrrrrrrrrrs@r"rrs\&}5K%l3J*+<=O0B&!P&&>$ 9 *X&++r!rc eZdZy)r Nrr r!r"r r s'r!r c eZdZ dZdZdZy)_ANYcyr@r rPrs r"rz _ANY.__eq__ sr!cyrpr r s r"rz _ANY.__ne__ sr!cy)Nzr rs r"rz _ANY.__repr__ sr!N)rrrrrrr r!r"r r  s8r!r c d|z}d}dj|Dcgc] }t|c}}dj|jDcgc] \}}|d|c}}} |r|}| r |r|dz }|| z }||zScc}wcc}}w)Nz%s(%%s)rz, =)r]reprrF) rxrQrRrformatted_argsrI args_stringrDr kwargs_strings r"rr s$GN))$7$3T#Y$78KII171?:33M$  d "N-' ^ ##8s A>B ceZdZ d dZ ddZdZejZdZdZ dZ dZ e d Z e d Zd Zd Zy)rNcnd}i}t|}|dk(r|\}}}nh|dk(r2|\} } t| tr| }t| tr| }n9| }n6| | }}n1|dk(r,|\}t|tr|}nt|tr|}n|}|rtj |||fStj ||||fS)Nr rr)rr'rMrhr) rrrxrr from_kallrQrR_lenfirstseconds r"rz _Call.__new__ s5z 19!& D$ QY!ME6%%fe,!D#F$ff QYFE%%E5) ==tVn5 5}}S4v"677r!c.||_||_||_yr4)rr_mock_from_kall)rPrrxrrrs r"rAz_Call.__init__ s"(r!c" t|}d}t|dk(r|\}}n|\}}}t|ddr't|ddr|j|jk7ryd}|dk(rdi}}n|dk(r|\}}}nv|dk(r5|\} t | t r| }i}nXt | tr| }di}}nAd}| }n<|dk(r6|\} } t | tr| }t | t r| i}}n d| }}n| | }}ny|r||k7ry||f||fk(S#t$r tcYSwxYw) NrrrFrr rr)rrrr)rr'rhrM) rPr len_other self_name self_args self_kwargs other_name other_args other_kwargsrrrs r"rz _Call.__eq__ sV "E I t9>%) "I{04 -Iy+ D.$ /GE>SW4X%%););; >')2 J !^38 0J L !^FE%'" ! E3'" +-rL  $ !^!ME6%%" fe,/5r J/16 J+0&L  y0L)i-EEE_ "! ! "s C<<D Dc|jtd||fdS|jdz}t|j||f||S)Nrr&rrrrrs r"rDz_Call.__call__H sH ?? ""dF+$7 7%dootV44MMr!cr|j t|dS|jd|}t||dS)NF)rxrr@)rxrrr()rPrrxs r"rz_Call.__getattr__P s6 ?? "de4 4//40$tu==r!c^|tjvrttj||Sr4)rhrlrE__getattribute__)rPrs r"r+z_Call.__getattribute__W s' 5>> ! %%dD11r!cDt|dk(r |\}}||fS|\}}}||fS)Nr)rrs r"_get_call_argumentsz_Call._get_call_arguments] s: t9>LD&V|"& D$V|r!c(|jdSrr-rs r"rQz _Call.argse '')!,,r!c(|jdS)Nrr/rs r"rRz _Call.kwargsi r0r!c|js(|jxsd}|jdrd|z}|St|dk(rd}|\}}n'|\}}}|sd}n|jdsd|z}nd|z}t |||S)Nrr&zcall%srzcall.%s)rrrWrr)rPrxrQrRs r"rz_Call.__repr__m s##??,fDt$$K t9>DLD&!% D$__T* 4'$%dD&99r!c g}|}|,|jr|j||j}|,tt |Sr4)rr"rrr\)rPvalsthings r" call_listz_Call.call_list sR $$ E"&&E$((r!)r rNFT)r NNFT)rrrrrArrhrrDrr+r-rrQrRrr6r r!r"rr s|$:?8@>C)2Fj]]FN>2 ----:* )r!r)rc  t|r t|}t|t}t|rt d|dt |}d|i} |rd|i} n|i} | r|rd| d<|s t ||jd|}|} |d} | j|t} tj|ri} n=|r|r td t} n't|st} n|r|rt!|st} | d||| |d | } t|t"rt%| |} |rt'| nt)|| ||||s| |j*|<|jd d} |r|sd |vrt-||dd | | | _t1|D]}t3|r t5||}d|i}| rt9| |r|j||rd|i}t|t"st;||| ||}|| j*|<n~| }t|t"r | j<}t?|||}||d<tA|rt}nt}|d||||d|}|| j*|<||_t)|||t|t"stC| ||t| r|r| jDdi|| S#t6$rYCwxYw)Nz'Cannot autospec a Mock object. [object=rrrTrrxrzJInstance can not be True when create_autospec is mocking an async function)rrrrxrrr&)rZr.rrrcr)rrxrr)rYr )#rir6r'r&rr2rrHrrr*isdatadescriptorrr rer ror=r{rr[rr rr!rr)rEr(r:r< _must_skiprrar)rrrZrr.rrRis_type is_async_funcr9rr6r<wrappedrBrv child_kwargsrrrY child_klasss r"r r s",*~Dzt$G"**. 45 5"4(MtnGt$ 8'+#$ f% JJvu %EI  NN6 E%   >? ? t_$ X&8&>$  (W  (& (D$ &dD)  d #tWh78(,u%jj$'GxN&$@+D(T2629;T U   tU+H) ww.   h  / &1L(M2XxuhGC),D   &F$ ."48I(1L %"8,' ' BV%5*0B4@BC),D   &*}C  Xsi @ c= ) D% %gn6%f% KU   s K K  K c. t|ts|t|divry|j}|jD]X}|j j |t}|tur,t|ttfryt|tr|cSy|S)NrlF) r'r6r)r-rkrlrmrrCrBr=)rrBr:rrws r"r9r9( s dD ! GD*b1 1~~##E73 W   f|[9 :  .N Nr!ceZdZ ddZy)r:NcX||_||_||_||_||_||_yr4)ridsrrrZrx)rPrrrrxrBrZs r"rAz_SpecState.__init__F s,       r!)FNNNF)rrrrAr r!r"r:r:D s 48/4r!r:cvt|trtj|Stj|Sr4)r'bytesioBytesIOStringIO) read_datas r" _to_streamrI\ s*)U#zz)$${{9%%r!c f t}|dg fd} fd} fd fd fd}tVddl}tt t |j jt t |jat+ddl}tt t |ja |tdt}tt  j_ d j_ d j_ d j _ d j"_ | j_ d < d  j _| j"_ j&_| j(_ fd }||_ |_ |S) NcjjjjSdj|i|Sr) readlinesrrQrR_statehandles r"_readlines_side_effectz)mock_open.._readlines_side_effectr sC    ( ( 4##00 0"vay""D3F33r!cjjjjSdj|i|Sr)readrrMs r"_read_side_effectz$mock_open.._read_side_effectw s= ;; # # /;;++ +vay~~t.v..r!c?`KEd{ dj|i|7wr)readline)rQrR_iter_side_effectrNs r"_readline_side_effectz(mock_open.._readline_side_effect| s<$&&&$&)$$d5f5 5 's .,.c3Kjj jjdD]}|ywr)rUr)linerNrOs r"rVz$mock_open.._iter_side_effect sB ?? ' ' 3oo2221IDJsAAcxjjjjStdSr)rUrr)rNrOsr"_next_side_effectz$mock_open.._next_side_effect s1 ?? ' ' 3??// /F1Ir!ropen)rxr)rrctd<jjdk(rd<dj_tS)Nrr)rIrUrr)rQrRrWrNrOrHs r" reset_datazmock_open..reset_data sHy)q ?? & &&) 3-/F1I*0)FOO 'r!)rI file_spec_iorgrjr! TextIOWrapperunionrF open_specr\rr;rwriterRrUrLrrr) r<rH _read_datarPrSr[r`r^rVrWrNrOs ` @@@@r"rrc s\ I&J$ F4 / 6  S!2!234::3s3;;?O;PQR S]+,  |f95 I &F$*F! $FLL#FKK#'FOO $(F!/FKK%'F1I"()FOO#9F "3FOO"3FOO"DD Kr!c"eZdZ dZddZdZy)rc tdi|S)Nr )r)rPrRs r"r(zPropertyMock._get_child_mock s"6""r!Nc|Sr4r )rPr-obj_types r"r~zPropertyMock.__get__ s v r!c||yr4r )rPr-rJs r"rzPropertyMock.__set__ s  S r!r4)rrrr(r~rr r!r"rr s#r!rc d|_t|D]d} t||}t |t s!t |j j|trK|j|usZt|fy#t$rYswxYwr@) rr!r)rEr'r rrmr:rr)r<rrs r"rr sDD  d#A!_-  a&&**40* =    % G   s A<< BBceZdZ dZdZy)rcz||_tt}tj|_||j d<y)Nrr0)iteratorr rr*CO_ITERABLE_COROUTINErrl)rPrnrs r"rAz_AsyncIterator.__init__ s/  #X6 $:: $- j!r!c^K t|jS#t$rYtwxYwwr4)rrnrrrs r"rz_AsyncIterator.__anext__ s1  & &     s-- *-*-N)rrrrArr r!r"rr s. !r!rr)NFNNN)FFNNr)__all__rrrEr*rr3builtinsrGrtypesrrr unittest.utilr functoolsrr threadingrrrr!rWr)r rrr.r2r&r9r>rKr[rVreriror{rurrrhrrrrMISSINGr|DELETEDr;rrrgrrrrr frozenset removeprefixrXrr4rrrrrIrNrRrrUrmrvrXmultiplestopallr magic_methodsnumericsr]rGinplaceright _non_defaultsrwrr_sync_async_magics _async_magicsrrVrvrrrrrrrrrrr rrrrFrArrrGrr r rrrhrrr r9r:r6rr=r_rcrIrrrr)rxrs00r"rs &  '22#$CyC"(m Hmd4??33GTm H   @2  F # & 6."b>6) )f )   ;          &**(6  6 X   :   j G DGB""$!!!'(*;*;T"BCIh-K E+TE+P((V 6  f$$v)Ev)r uCGS*/Sl8        &Od4$0!!e] IP l dIs*N;3N;0)O& O:+O OOPK!?_ __pycache__/mock.cpython-312.pycnu[ ֦iMdZddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZGdd eZeeDchc]}|j1d r|c}Zd ZeZd Zd ZdZdZ dZ!dZ"dydZ#dZ$dZ%dZ&dZ'dydZ(dZ)dZ*dZ+Gdde,Z-Gdde,Z.e.Z/e/j`Z0e/jbZ2e/jfZ4hd Z5d!Z6Gd"d#e7Z8d$Z9Gd%d&e,Z:Gd'd(e,Z;Gd)d*e;Z<e=ee<Dchc]$}|j1d+r|j}d+&c}Z?Gd,d-e7Z@d.ZAGd/d0e;ZBGd1d2eBe<ZCd3ZDGd4d5e,ZEd6ZFe0dddddfdd7d8ZG dzd9ZHe0dddddfdd7d:ZIGd;dZLeGeI_,eJeI_MeHeI_NeLeI_Od?eI_Pd@ZQdAZRdBjdCeRjDZUdBjdDeRjDZVhdEZWdFZXdBjeQeReUeVgjDchc]}dG|z c}ZYhdHZZdIhZ[eZe[zZ\eYeWzZ]e]e\zZ^hdJZ_dKdLdMdNdOZ`eaeaeaeadPddddQdRd dPddS ZbdTZcdUZddVZedWZfecedeeefdXZgdYZhGdZd[e;ZiGd\d]eie<ZjGd^d_eiZkGd`daeieCZlGdbdce;Zm ejee jdZpee ZqGdddee;ZsGdfdgesekeCZtGdhdie,ZueuZvdjZwGdkdlexZyeydmZz d{dd7dnZ{doZ|Gdpdqe,Z}e~e{e~evjfZdadadrZd|dsZGdtdueCZdvZGdwdxZycc}wcc}wcc}w#er$rdZpYwxYw)})Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockceZdZdZy)InvalidSpecErrorz8Indicates that an invalid value was used as a mock spec.N__name__ __module__ __qualname____doc__&/usr/lib64/python3.12/unittest/mock.pyrr)sBr"r_Tct|rt|tsyt|dr t |d}t |xst j|S)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r# _is_async_objr/5sGji&@sJc:& s # ?w':':3'??r"c4t|ddr t|Sy)N__code__F)r*r)funcs r#_is_async_funcr3=stZ&"4((r"c4tt|tSN) issubclasstyper r-s r#r'r'Ds d3i 11r"cjt|txs"t|txrt|tSr5)r( BaseExceptionr7r6r-s r# _is_exceptionr:Js-3 & A3@*S-"@r"cVt|trt|dr |jS|SNmock)r( FunctionTypesr)r=r-s r# _extract_mockr?Qs%#}%'#v*>xx r"cvt|tr|s|j}d}nRt|ttfrt|trd}|j }nt|t s |j}|r t|d}n|} |tj|fS#t$rYywxYw#t$rYywxYw)z Given an arbitrary, possibly callable object, try to create a suitable signature object. Return a (reduced func, signature) tuple, or None. TN) r(r7__init__ classmethod staticmethodr&r>__call__AttributeErrorrr+ signature ValueError)r2 as_instanceeat_selfsig_funcs r#_get_signature_objectrKZs $k}} D; 5 6 dK (H}} m , ==D4&W&&x000   s$( BB, B)(B), B87B8Fct|||y\}fd}t|||t|_t|_y)Nc*j|i|yr5bind)selfargskwargssigs r#checksigz"_check_signature..checksig$!&!r")rK_copy_func_detailsr7_mock_check_sig __signature__)r2r= skipfirstinstancerTrSs @r#_check_signaturer[}sI h :C {ID#"tX&!)DJ"DJr"c `dD]} t||t||y#t$rY)wxYw)N)rr __text_signature__r __defaults____kwdefaults__)setattrr*rE)r2funcopy attributes r#rVrVs:   GYi(@ A     s ! --ct|tryt|tttfrt |j St|ddyy)NTrDF)r(r7rCrBr _callabler&r*r-s r#rdrdsD#t# k:>?&&sJ%1 r"c0t|ttfvSr5)r7listtupler-s r#_is_listrhs 9u %%r"ct|tst|ddduS|f|jzD]}|jj dyy)ztGiven an object, return True if the object is callable. For classes, return True if instances would be callable.rDNTF)r(r7r*__mro____dict__get)r.bases r#_instance_callablernsV c4 sJ-T99$ ==  Z ( 4% r"c t|t}t|||}||S|\} fd}t|||j}|j sd}||d}d|z} t | |||} t| | | S)Nc*j|i|yr5rN)rQrRrSs r#rTz _set_signature..checksigrUr"ra) _checksig_r=zYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r(r7rKrVr isidentifierexec _setup_func) r=originalrZrYresultr2rTnamecontextsrcrarSs @r#_set_signaturerzs 8T*I "8Xy AF ~ ID#"tX&   D    %t4G $&* +C #wdmGs# Nr"c_fd}fd}fd}fd}fd}fd}fd} fd} d _d _d_t _t _t _j_j_ j_ |_ |_ |_ | _| _|_|_|_|__y) Nc(j|i|Sr5)assert_called_withrQrRr=s r#r}z'_setup_func..assert_called_with&t&&777r"c(j|i|Sr5) assert_calledr~s r#rz"_setup_func..assert_calleds!t!!42622r"c(j|i|Sr5)assert_not_calledr~s r#rz&_setup_func..assert_not_calleds%t%%t6v66r"c(j|i|Sr5)assert_called_oncer~s r#rz'_setup_func..assert_called_oncerr"c(j|i|Sr5)assert_called_once_withr~s r#rz,_setup_func..assert_called_once_withs+t++T.assert_has_callss$t$$d5f55r"c(j|i|Sr5)assert_any_callr~s r#rz$_setup_func..assert_any_calls#t##T4V44r"ct_t_jj}t |r|ur|jyyyr5) _CallList method_calls mock_calls reset_mock return_valuer')retrar=s r#rz_setup_func..reset_mocksL({&[ "" S !#+ NN +6 !r"Fr)r=called call_count call_argsrcall_args_listrrr side_effect_mock_childrenr}rrrrrrrrX_mock_delegate) rar=rSr}rrrrrrrs `` r#rtrtsGL8378=65GNGG&[G$;G"G,,G**G!00G!3G&=G#/G-G#G)G 1G!3GG!Dr"c tjj_d_d_t _fd}dD]}t|t||y)Nrc<tj||i|Sr5)r*r=)attrrQrRr=s r#wrapperz"_setup_async_mock..wrapper s 'wtyy$'888r")assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listr`r)r=rrbs` r#_setup_async_mockrsV ++99DDDO$;D 9,  i)!<=,r"cd|ddz|k(S)N__%s__r!rws r# _is_magicrs d1Rj D ((r"c"eZdZdZdZdZdZy)_SentinelObjectz!A unique, named, sentinel object.c||_yr5rrPrws r#rAz_SentinelObject.__init__"s  r"c d|jzSNz sentinel.%srrPs r#__repr__z_SentinelObject.__repr__%tyy((r"c d|jzSrrrs r# __reduce__z_SentinelObject.__reduce__(rr"N)rrrr rArrr!r"r#rr s'))r"rc"eZdZdZdZdZdZy) _SentinelzAAccess attributes to return a named object, usable as a sentinel.ci|_yr5) _sentinelsrs r#rAz_Sentinel.__init__.s r"cb|dk(rt|jj|t|S)N __bases__)rEr setdefaultrrs r# __getattr__z_Sentinel.__getattr__1s, ;  ))$0EFFr"cy)Nrr!rs r#rz_Sentinel.__reduce__7sr"N)rrrr rArrr!r"r#rr,sKG r"r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecftj|d|z}||fd}||fd}t||S)N_mock_cN|j}| t||St||Sr5)rr*)rPrw _the_namerSs r#_getz"_delegating_property.._getLs,!! ;4+ +sD!!r"cZ|j}|||j|<yt|||yr5)rrkr`)rPvaluerwrrSs r#_setz"_delegating_property.._setQs,!! ;',DMM) $ Cu %r")_allowed_namesaddproperty)rwrrrs r#_delegating_propertyrIs>t4I " $y& D$ r"ceZdZdZdZy)rct|tstj||St|}t|}||kDryt d||z dzD]}||||z}||k(syy)NFrT)r(rf __contains__lenrange)rPr len_valuelen_selfisub_lists r#rz_CallList.__contains__^sw%&$$T51 1J t9 x q(Y.23AAa k*H5 4r"c>tjt|Sr5)pprintpformatrfrs r#rz_CallList.__repr__ls~~d4j))r"N)rrrrrr!r"r#rr\s  *r"rct|}t|sy|js$|js|j |j y|}|||ury|j }||r||_||_|r||_||_y)NFT)r?r'rrrr)parentrrwnew_name_parents r#_check_and_set_parentrps % E U #   U11    '    +G   e **  !'' # r"ceZdZdZdZy) _MockIterc$t||_yr5)iterr.)rPr.s r#rAz_MockIter.__init__s 9r"c,t|jSr5)nextr.rs r#__next__z_MockIter.__next__sDHH~r"N)rrrrArr!r"r#rrs r"rceZdZeZdZdZy)BaseNcyr5r!rPrQrRs r#rAz Base.__init__s r")rrrrrrrAr!r"r#rrs  r"rceZdZdZeZ d,dZ d,dZdZd-dZ d.dZ d Z d Z d Z ee e e Zed Zed ZedZedZedZedZdZdZeeeZd/ddddedefdZdZdZdZdZdZ dZ!dZ"dZ#d0d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d-d(Z,d)Z-d*Z.d1d+Z/y)2r z A non-callable version of `Mock`NFc  |f} t|ts|xs|}|t|rt|f} t|j| d|j i}t t|j|}|S)Nr ) r6AsyncMockMixinr/r7rr _safe_superr __new__)clsspecrrwspec_setr _spec_state _new_name _new_parent_spec_as_instance _eat_selfunsaferRbasesspec_argnewrZs r#rzNonCallableMock.__new__sm#~.'4H# h(?'-3<<CKK(@A4<d..6&& D'C!$D  r"cj|j||j_y||_t||ddy)Nr%)rrrr)rPrs r#__set_return_valuez"NonCallableMock.__set_return_value*s2    */4D   ,&+D # !$tT :r"z1The value to be returned when the mock is called.cH|j t|S|jSr5)rr7rs r# __class__zNonCallableMock.__class__6s$    #: r"rrrrrc|j}| |jS|j}|8t|s-t |t st |st |}||_|Sr5)rrrcallabler(rr:)rP delegatedsfs r#__get_side_effectz!NonCallableMock.__get_side_effectCs\''  )) )  " " N8B<"2y1-:K2B$&I ! r"cTt|}|j}|||_y||_yr5) _try_iterrrr)rPrr/s r#__set_side_effectz!NonCallableMock.__set_side_effectNs-% ''  %*D "$)I !r"rrrrc|g}t||vry|jt|d|_d|_d|_t |_t |_t |_|r t|_ |rd|_ |jjD]/}t|ts|t ur|j#|||1|j}t%|r||ur|j#|yyy)z-Restore the mock object to its initial state.NFrr5)idr!rrrrrrrrrrrvaluesr( _SpecState_deletedrr')rPvisitedrrchildrs r#rzNonCallableMock.reset_mockYs ?G d8w  r$x  #+'k%K &-D # %)D "((//1E%,0A   W<[  Y2 %% S !co NN7 #'6 !r"c t|jdD]H\}}|jd}|j}|}|D]}t ||}t |||Jy)aZSet attributes on the mock through keyword arguments. Attributes plus return values and side effects can be set on child mocks using standard dot notation and unpacking a dictionary in the method call: >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError} >>> mock.configure_mock(**attrs)c*|djdS)Nr.)count)entrys r#z0NonCallableMock.configure_mock..sq1Dr")keyr?N)sorteditemssplitpopr*r`)rPrRargvalrQfinalr.rAs r#rzNonCallableMock.configure_mockyshv||~$E FHC 99S>DHHJECc5) C $Fr"c |dvr t||j$||jvs|tvr$td|zt|r t||jsD|jr||jvr*|j ds|t vrt|d|dtj5|jj|}|tur t||Jd}|jt|j|}|j|||||}||j|<nat|t rQ t#|j$|j&|j(|j*|j,}||j|<ddd|S#t.$r6|j0dxs|}t/d|d |d |d |j$d wxYw#1swYSxYw) N>rrzMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)rrwrrrrCannot autospec attr from target , as it has already been mocked out. [target=, attr=r)rEr _all_magicsrr startswith_ATTRIB_DENY_LISTr _lockrrlr:rr*r'r(r9r rrrZrrwrrk)rPrwrvr target_names r#rzNonCallableMock.__getattr__s  4 4 & &    +4---1D$%F%MNN t_ & &  $*<*<DL^L^@^OPTX\mTm$h''+h.KMNN " "((,,T2F!$T**##/$D$4$4d;E--d%4 $..4##D)FJ/ D, V__foo v{{F.4##D);#> (D"&-- "="EK*/x}&/*##'('&++CDDD/#> s&6B GAFG?GGG(c||jg}|j}|}d}|dgk(rd}|B|}|j|j|zd}|jdk(rd}|j}|Btt |}|j xsd}t |dkDr |ddvr|dz }||d<dj|S)Nr?r%rr=r)r%z().r)rrr!rfreversedrrjoin)rP _name_listrlastdot_firsts r#_extract_mock_namez"NonCallableMock._extract_mock_names))* '' $ C!D   g44s: ;C%%-..G!(:./ *F z?Q !}M1#  1 wwz""r"c|j}d}|dvrd|z}d}|j)d}|jrd}||jjz}dt |j||dt |dS) Nr)r=zmock.z name=%rz spec=%rz spec_set=%r)rarrrr7r7)rPrw name_string spec_strings r#rzNonCallableMock.__repr__s&&( ( ($t+K    '$K~~, %(8(8(A(AAK J     tH   r"ctstj|S|jxsg}t t |}t |j}|jjDcgc]\}}|tur|}}}|Dcgc]}|jdr|}}|Dcgc] }|jdr t|r|"}}tt||z|z|zScc}}wcc}wcc}w)z8Filter the output of `dir(mock)` to only useful members.r$)r object__dir__rr r7rfrkrrEr:rVrrDset)rPextras from_type from_dictm_namem_valuefrom_child_mockses r#rhzNonCallableMock.__dir__s>>$' '##)rT O ' *.*=*=*C*C*E(*Evwh& *E (!*C 1c1BQ C )# 1c1Bq\ #c&9,y8;KKLMM(D#s2C2 C8$C8.%C=c`|tvrtj||Sjr6j*|jvr|j vrt d|z|tvrd|z}t ||tvrj|jvrt d|zt|s)tt|t|||fd}n^t|d|tt|||j|<n*|dk(r|_yt|||r|j|<j r/t#|s#j%d|}t d|t'|t(r|j |<ytj||S)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.cg|i|Sr5r!)rQkwrurPs r#rBz-NonCallableMock.__setattr__..sHT,GD,GB,Gr"r,r?z Cannot set )rrg __setattr__rrrkrE_unsupported_magicsrUr'r`r7 _get_methodrrrrr)rar(r)rPrwrmsg mock_namerus` @r#rtzNonCallableMock.__setattr__s > !%%dD%8 8nn!3!3!? ** *  % !Dt!KL L ( (BTIC % % [ !!-$d>P>P2P$%H4%OPP$U+T D+dE*BC G&dE4>T D%0,1##D) [ $D  $T5$=,1##D)   WT4%82245Qtf=I ;yk!:; ; e\ *"'DMM$  !!$e44r"c|tvr;|t|jvr$tt||||jvry|jj |t }||jvr tt|j|n|tur t||t ur |j|=t|j|<yr5) rUr7rkdelattrrrl_missingrr __delattr__r:rE)rPrwr.s r#r|zNonCallableMock.__delattr__+s ; 44:+>+>#> DJ %4==(!!%%dH5 4==  . : :4 @ H_ & & h ##D)$,D!r"c<|jxsd}t|||Sr<)r_format_call_signaturerPrQrRrws r#_format_mock_call_signaturez+NonCallableMock._format_mock_call_signature=s(&%dD&99r"cpd}|j||}|j}|j|}||||fzS)Nz0expected %s not found. Expected: %s Actual: %s)rr)rPrQrRactionmessageexpected_stringr actual_strings r#_format_mock_failure_messagez,NonCallableMock._format_mock_failure_messageBsFF::4HNN 888)D &/=AAAr"c |s |jSd}|jddjd}|j}|D]K}|j |}|t |t r|St|}|j}|j}M|S)aH * If call objects are asserted against a method/function like obj.meth1 then there could be no name for the call object to lookup. Hence just return the spec_signature of the method/function being asserted against. * If the name is not empty then remove () and split by '.' to get list of names to iterate through the children until a potential match is found. A child mock is created only during attribute access so if we get a _SpecState then no attributes of the spec were accessed and can be safely exited. Nr%rr?)rreplacerFrrlr(r9r?)rPrwrSnameschildrenr<s r#_get_call_signature_from_namez-NonCallableMock._get_call_signature_from_nameJs'' ' T2&,,S1&&DLL&E} 5* = &e, //++ r"cvt|tr#t|dkDr|j|d}n |j}|Pt|dk(rd}|\}}n|\}}} |j |i|}t ||j|jS|S#t$r}|jdcYd}~Sd}~wwxYw)a Given a call (or simply an (args, kwargs) tuple), return a comparison key suitable for matching with other calls. This is a best effort method which relies on the spec's signature, if available, or falls back on the arguments themselves. rrNr) r(rgrrrrOrrQrR TypeErrorwith_traceback)rP_callrSrwrQrR bound_callrps r# _call_matcherzNonCallableMock._call_matcherks eU #E Q44U1X>C&&C ?5zQ$ f%*"dF .%SXXt6v6 D*//:3D3DEEL .''-- .s2B B8B3-B83B8c|jdk7r._error_messages33D&ACJr"Ttwo)rrrr_Callr( Exception)rPrQrRexpectedactual error_messagercauses``` r#r}z"NonCallableMock.assert_called_withs >> !77fEH"F)M / / %%eT6N&EF##DNN3 X  *8Y ?HTE !12 = r"c|jdk(sz3NonCallableMock.assert_has_calls..FAZ9-EaNc3@K|]}j|ywr5rrcrPs r#rz3NonCallableMock.assert_has_calls..sM_d003_zCalls not found.z+Error processing expected calls. Errors: {} Expected: z Actual)prefixr?r=z does not contain all of z in its call list, found z instead)rrrrformatr(rrrrstriprfremoverGr!rrg) rPcalls any_orderrrr all_callsproblemrp not_foundkalls ` r#rz NonCallableMock.assert_has_callss~4995aD&&q)59FFMMT__MM y(=0G ,-3V-5$7-5*4Ay)AAt$K-5$7.8%i !!*5!1 2''z':AA#FGI  O  D '  &  &*oo&?&?&+I&6 C   7:$7 '  & 'sD+D#D((EEc"|jt||fd}t|tr|nd}|jDcgc]}|j|}}|s |t |vr!|j ||}td|z|ycc}w)zassert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if the call is the most recent one.TrNz%s call not found)rrr(rr _AnyComparerrrrPrQrRrrrrrs r#rzNonCallableMock.assert_any_calls %%eT6N&EF&x;151D1DE1DA$$$Q'1DE HL$88">>tVLO #o5 9FB c J|jr,d|vrd|dnd}|j|z}t||jd}||jdvr t di|St |}t|tr|tvrt }nt|tr0|tvs|jr||jvrt}nTt }nMt|ts.t|trt}n&t|trt }n|j"d}di|S)aPCreate the child mocks for attributes and return value. By default child mocks will be the same type as the parent. Subclasses of Mock may want to override this to customize the way child mocks are made. For non-callable mocks the callable variant will be used (rather than any custom subclass).rwr?r%rrrr!)rrarErlrkr r7r6r_async_method_magicsr_all_sync_magicsr CallableMixinr r rrj)rPrsrbrxr_typeklasss r#r'zNonCallableMock._get_child_mocks   ,2bL!BvJ<(dI//1I=I + +FF;'  n5 5?r? "T  eY 'I9M,ME ~ .--&&98J8J+J!!E=1%!56!E?3MM!$E{r{r"cT|jsyd|dt|jdS)zRenders self.mock_calls as a string. Example: " Calls: [call(1), call(2)]." If self.mock_calls is empty, an empty string is returned. The output will be truncated if very long. r z: r?)rr)rPrs r#rzNonCallableMock._calls_repr's-F82i89;;r") NNNNNNrNFNFF)FFr5)r)Calls)0rrrr rrXrrArrr"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr,rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrboolrrrrarrhrtr|rrrrrrrr}rrrr'rr!r"r#r r s`* GE=AEIBEI, 8*Z  #L  !,!;!;c!AN!R&66K-%r"c|j}|Bt|r|t|st|}t|r |||i|}|tur|S|j tur |j S|jr(|jj tur |j S|j|j|i|S|j Sr5) rr:rdrrrrrr)rPrQrReffectrvs r#rz CallableMixin._execute_mock_calls!!  V$ v&f ( L00W$  " "' 1$$ $   4#6#6#C#C7#R$$ $    '#4##T4V4 4   r") rrrrrArWrDrrrr!r"r#rr[s8 d$d!RT ' 08,7\!r"rceZdZdZy)ra Create a new `Mock` object. `Mock` takes several optional arguments that specify the behaviour of the Mock object: * `spec`: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an `AttributeError`. If `spec` is an object (rather than a list of strings) then `mock.__class__` returns the class of the spec object. This allows mocks to pass `isinstance` tests. * `spec_set`: A stricter variant of `spec`. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as `spec_set` will raise an `AttributeError`. * `side_effect`: A function to be called whenever the Mock is called. See the `side_effect` attribute. Useful for raising exceptions or dynamically changing return values. The function is called with the same arguments as the mock, and unless it returns `DEFAULT`, the return value of this function is used as the return value. If `side_effect` is an iterable then each call to the mock will return the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. * `unsafe`: By default, accessing any attribute whose name starts with *assert*, *assret*, *asert*, *aseert*, or *assrt* raises an AttributeError. Additionally, an AttributeError is raised when accessing attributes that match the name of an assertion method without the prefix `assert_`, e.g. accessing `called_once` instead of `assert_called_once`. Passing `unsafe=True` will allow access to these attributes. * `wraps`: Item for the mock object to wrap. If `wraps` is not None then calling the Mock will pass the call through to the wrapped object (returning the real result). Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist will raise an `AttributeError`). If the mock has an explicit `return_value` set then calls are not passed to the wrapped object and the `return_value` is returned instead. * `name`: If the mock has a name then it will be used in the repr of the mock. This can be useful for debugging. The name is propagated to child mocks. Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. Nrr!r"r#rrs7r"rc:d}|D]}||vst|dy)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r#_check_spec_arg_typosrs1 2E ? "(OP r"ceZdZdZgZdddZdZdZdZe jdZ d Z d Z d Zd Zd ZdZdZy)_patchNFrc ~| |tur td| td| s t| t|rt d|d|dt|rt d|d|d||_||_||_||_||_ ||_ d|_ ||_ ||_ | |_g|_d|_y)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=rz? as the spec_set target has already been mocked out. [spec_set=F)rrGrr'rgetterrbr new_callablercreate has_localrautospecrRadditional_patchers is_started) rPrrbrrrrrrrRrs r#rAz_patch.__init__s  #'! B# G !& ) T ""#I=166:XQ@A A X &"#I=1AAI AOP P "(       #% r"c ft|j|j|j|j|j |j |j|j|j }|j|_ |jDcgc]}|jc}|_ |Scc}wr5) rrrbrrrrrrrRattribute_namercopy)rPpatcherps r#rz _patch.copy7s KK499 KK MM4,,dkk  "&!4!4"66' 6AFFH6' #' s B.ct|tr|j|Stj|r|j |S|j |Sr5r(r7decorate_classr+rdecorate_async_callabledecorate_callable)rPr2s r#rDz_patch.__call__DsM dD !&&t, ,  & &t ,//5 5%%d++r"ct|D]^}|jtjs#t ||}t |ds<|j }t||||`|SNrD)r rVr TEST_PREFIXr*r)rr`)rPrr attr_valuers r#r z_patch.decorate_classLsaJD??5#4#45 -J:z2iikG E4!4 5 r"c#RKg}tj5}|jD]U}|j|}|j|j |2|j tusE|j|W|t|z }||fdddy#1swYyxYwwr5) contextlib ExitStack patchings enter_contextrupdaterrr!rg)rPpatchedrQkeywargs extra_args exit_stackpatchingrHs r#decoration_helperz_patch.decoration_helperZs  ! ! #z#-- ..x8**6OOC(\\W,%%c* . E*% %D" "$ # #s#B'AB+'B B'B$ B'ctdrjjStfdg_S)Nrclj||5\}}|i|cdddS#1swYyxYwr5rrQrnewargs newkeywargsr2rrPs r#rz)_patch.decorate_callable..patchedos=''(,(025Kg{W4 4222s *3r)rr!rrPr2rs``@r#r z_patch.decorate_callableisK 4 % NN ! !$ 'K t 5  5 "Fr"ctdrjjStfdg_S)NrcKj||5\}}|i|d{cdddS7 #1swYyxYwwr5rrs r#rz/_patch.decorate_async_callable..patchedsN''(,(025Kg{!7:k::22;22s#A646 A6?Ar"r#s``@r#r z_patch.decorate_async_callablezsK 4 % NN ! !$ 'K t ;  ; "Fr"cH|j}|j}t}d} |j|}d}|tvrt|trd|_ |js|turt |d|||fS#tt f$rt ||t}YiwxYw)NFTz does not have the attribute ) rrbrrkrEKeyErrorr* _builtinsr(rr)rPtargetrwrulocals r# get_originalz_patch.get_originals~~ t,HE 9 FJ!?DK{{x72 7=tD ) 6vtW5H 6sA>> B! B!c J|jr td|j|j|j}}}|j |j }}|j}|j|_ |durd}|durd}|durd}| | td|||dvr td|j\}}|turl|id} |dur |}|dur|}d}n| |dur |}d}n|dur|}||%|tur tdt|trd} ||} nb|t|rt } nN||D|} ||} t#| rd | v} n t%|  } t| rt } n| rt&} n t(} nt(} i} ||| d <||| d <t| tr+t+| t,r|j.r|j.| d <| j1|| di| }| rFt3|r:|} ||} t#| st5| st&} | j7d | d|d d| |_n||tur td|tur tdt;|}|dur|}t3|jr)t=d|j.d|jd|dt3|rMt?|jd|j}t=d|j.d|d|jd|d tA|f||j.d|}n |r td|}||_!||_"tGjH|_%d|_ tM|j|j.||jNui}|jtur|||jN<|jPD]A}|jJjS|}|jtus1|j1|C|S|S#|jTtWjXsYyxYw)zPerform the patch.zPatch is already startedFNzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerDrrrwr%r&zBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=TruerQz: as the patch target has already been mocked out. [target=rTrrrRrS)r_namez.Can't pass kwargs to a mock we aren't creatingr!)-rrrrrrrRrrr)rr+rr(r7r/r rhr.r rr6r rbrr'rnrGrrrr*r temp_originalis_localrr _exit_stackr`rrr__exit__sysexc_info)rPrrrrrRrrur*inheritKlass this_spec not_callable_kwargsrYnew_attrrrrHs r# __enter__z_patch.__enter__s ??9: :"hh 4==8T==$++&(( kkm  5=D u H u H   4=> >  !5 L (TU U++-% '>h.Gt|t#'HD!t##HDT!#8#7w&#$GHHh-"G'$-"9!!X%9 ' (II&#-Y#>L'/ ':#:L +%E!0E%E!G"&#&. #5$'5/2t~~"&.. NN6 ""'"C,S1! ' (I +&y10E F##($4SD$4+2$4  !'!(7" GHHH~H4# -&+DNN+=>#{{oWXLCDD!*%dkk:t{{K &+DNN+=]"o&#{{oWXLCDD "(BX(,B:@BC LM M% %//1  DKK :"". 88w&7:Jt223 $ 8 8H**88BC||w."))#.!9"!J  4==#,,.12sB O<%O<:O<<$P"c|jsy|jr>|jtur,t |j |j |jnt|j |j |jsYt|j |j r|j dvr+t |j |j |j|`|`|`|j}|` d|_|j|S)zUndo the patch.N)r rr^__annotations__r_F) rr/r.rr`r)rbrzrr)r0r1)rPr3rs r#r1z_patch.__exit__=s  ==T//w> DKK1C1C D DKK 0;; T^^(L+== T^^T5G5GH   M K%%  "z""H--r"c\|j}|jj||Sz-Activate a patch, returning any created mock.)r:_active_patchesr!rPrvs r#startz _patch.startVs'! ##D) r"c~ |jj||jdddS#t$rYywxYwzStop an active patch.N)r?rrGr1rs r#stopz _patch.stop]sD   ' ' - }}T4..   s 0 <<)rrrrr?rArrDr rcontextmanagerrr r r+r:r1rArDr!r"r#rr sgNOAF# L ,  # #""0Xt.2/r"rc |jdd\}}t t j ||fS#tttf$rtd|wxYw)Nr?rz,Need a valid target to patch. You supplied: )rsplitrrGrErpkgutil resolve_name)r)rbs r# _get_targetrJisjG"MM#q1  7'' 0) ;; z> 2G:6* EG GGs 3#Arc vtturtdfd} t| |||||||| | S)a patch the named member (`attribute`) on an object (`target`) with a mock object. `patch.object` can be used as a decorator, class decorator or a context manager. Arguments `new`, `spec`, `create`, `spec_set`, `autospec` and `new_callable` have the same meaning as for `patch`. Like `patch`, `patch.object` takes arbitrary keyword arguments for configuring the mock object it creates. When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. z3 must be the actual object to be patched, not a strcSr5r!r)sr#rBz_patch_object..sVr"r)r7strrr) r)rbrrrrrrrrRrs ` r# _patch_objectrOrsS$ F|sjK L  F  3f(L& r"c ~tturttj}nfd}|s t dt |j}|d\} } t|| | |||||i } | | _ |ddD]:\} } t|| | |||||i } | | _ | jj| <| S)aPerform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the patches:: with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): ... Use `DEFAULT` as the value if you want `patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, and a dictionary is returned when `patch.multiple` is used as a context manager. `patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments `spec`, `spec_set`, `create`, `autospec` and `new_callable` have the same meaning as for `patch`. These arguments will be applied to *all* patches done by `patch.multiple`. When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX` for choosing which methods to wrap. cSr5r!rMsr#rBz!_patch_multiple..sr"z=Must supply at least one keyword argument with patch.multiplerrN) r7rNrrHrIrGrfrErrrr!) r)rrrrrrRrrErbrr this_patchers ` r#_patch_multiplerSs, F|s--v6  K    E1XNIs 3fh,G'G) 3 IsD&( lB '0 ###**<8 $ Nr"c Ht|\} } t| | |||||||| S)a: `patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the `target` is patched with a `new` object. When the function/with statement exits the patch is undone. If `new` is omitted, then the target is replaced with an `AsyncMock if the patched object is an async function or a `MagicMock` otherwise. If `patch` is used as a decorator and `new` is omitted, the created mock is passed in as an extra argument to the decorated function. If `patch` is used as a context manager the created mock is returned by the context manager. `target` should be a string in the form `'package.module.ClassName'`. The `target` is imported and the specified object replaced with the `new` object, so the `target` must be importable from the environment you are calling `patch` from. The target is imported when the decorated function is executed, not at decoration time. The `spec` and `spec_set` keyword arguments are passed to the `MagicMock` if patch is creating one for you. In addition you can pass `spec=True` or `spec_set=True`, which causes patch to pass in the object being mocked as the spec/spec_set object. `new_callable` allows you to specify a different class, or callable object, that will be called to create the `new` object. By default `AsyncMock` is used for async functions and `MagicMock` for the rest. A more powerful form of `spec` is `autospec`. If you set `autospec=True` then the mock will be created with a spec from the object being replaced. All attributes of the mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise a `TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. Instead of `autospec=True` you can pass `autospec=some_object` to use an arbitrary object as the spec instead of the one being replaced. By default `patch` will fail to replace attributes that don't exist. If you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! Patch can be used as a `TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods share a common patchings set. `patch` finds tests by looking for method names that start with `patch.TEST_PREFIX`. By default this is `test`, which matches the way `unittest` finds tests. You can specify an alternative prefix by setting `patch.TEST_PREFIX`. Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use "as" then the patched object will be bound to the name after the "as"; very useful if `patch` is creating a mock object for you. Patch will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `patch` takes arbitrary keyword arguments. These will be passed to `AsyncMock` if the patched object is asynchronous, to `MagicMock` otherwise or to `new_callable` if specified. `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are available for alternate use-cases. r)rJr) r)rrrrrrrrRrrbs r#rrs7V$F+FI  3f(L& r"cTeZdZdZddZdZdZdZdZdZ dZ d Z d Z d Z d Zy ) _patch_dicta# Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test. `in_dict` can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys. `in_dict` can also be a string specifying the name of the dictionary, which will then be fetched by importing it. `values` can be a dictionary of values to set in the dictionary. `values` can also be an iterable of `(key, value)` pairs. If `clear` is True then the dictionary will be cleared before the new values are set. `patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary:: with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()): ... `patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator `patch.dict` honours `patch.TEST_PREFIX` for choosing which methods to wrap. c ||_t||_|jj|||_d|_yr5)in_dictdictr8rclear _original)rPrXr8rZrRs r#rAz_patch_dict.__init__/s4 6l  6" r"ct|tr|j|Stj|r|j |S|j |Sr5r)rPfs r#rDz_patch_dict.__call__8sM a &&q) )  & &q )//2 2%%a((r"c2tfd}|S)Ncj |i|jS#jwxYwr5rV _unpatch_dictrQrsr]rPs r#_innerz-_patch_dict.decorate_callable.._innerAs8     %$~"~""$""$s+=rrPr]rcs`` r#r z_patch_dict.decorate_callable@ q %  % r"c2tfd}|S)NcKj |i|d{jS7#jwxYwwr5r`rbs r#rcz3_patch_dict.decorate_async_callable.._innerMsD     %^^+""$,""$s%A  757A 7A  A rdres`` r#r z#_patch_dict.decorate_async_callableLrfr"ct|D]{}t||}|jtjs/t |ds>G - NN8 $ -'}   -s7AAc<|j|jy)zUnpatch the dict.F)r[ra)rPrQs r#r1z_patch_dict.__exit__s >> %    r"cd|j}tjj||Sr>)r:rr?r!r@s r#rAz_patch_dict.starts'!%%d+ r"c tjj||j dddS#t$rYywxYwrC)rr?rrGr1rs r#rDz_patch_dict.stopsD   " " ) )$ / }}T4..   s4 AAN)r!F)rrrr rArDr r r r:rVrar1rArDr!r"r#rVrVs>8)   +8 -/r"rVcn |jy#t$rt|}|D]}||=YywxYwr5)rZrErf)rXkeysrCs r#rnrns9  G}C s 44c`ttjD]}|jy)z7Stop all active patches. LIFO to unroll nested patches.N)r[rr?rD)rs r#_patch_stopallrvs &001 2r"testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c#&K|] }d|z yw)zi%sNr!rns r#rrs7&6519&6c#&K|] }d|z yw)zr%sNr!rzs r#rrs5$4q$4r|>rh__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c fd}||_|S)z:Turns a callable object (like a mock) into a real functionc|g|i|Sr5r!)rPrQrsr2s r#methodz_get_method..methodsD&4&2&&r")r)rwr2rs ` r#rvrvs'FO Mr"r> __aexit__ __anext__ __aenter__ __aiter__>__del__rrAr __prepare__rt__instancecheck____subclasscheck__c,tj|Sr5)rg__hash__rs r#rBrBs V__T2r"c,tj|Sr5)rg__str__rs r#rBrBs FNN40r"c,tj|Sr5)rg __sizeof__rs r#rBrBsv006r"cjt|jd|jdt|S)N/)r7rrar7rs r#rBrBs3$t*"5"5!6a8O8O8Q7RRSTVW[T\S]^r")rrr __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r1 __complex__ __float____bool__ __index__rcfd}|S)NcZjj}|tur|S|urytSNT)__eq__rrNotImplemented)otherret_valrPs r#rz_get_eq..__eq__s/++00 ' !N 5=r"r!)rPrs` r#_get_eqrs Mr"cfd}|S)Nc^jjturtS|urytSNF)__ne__rrr)rrPs r#rz_get_ne..__ne__#s* ;; ) ) 8N 5=r"r!)rPrs` r#_get_ner"s Mr"cfd}|S)Ncljj}|tur tgSt|Sr5)__iter__rrrrrPs r#rz_get_iter..__iter__,s/--22 g 8OG}r"r!)rPrs` r# _get_iterr+s Or"cfd}|S)Ncjj}|turtt gStt |Sr5)rrr_AsyncIteratorrrs r#rz"_get_async_iter..__aiter__6s8..33 g !$r(+ +d7m,,r"r!)rPrs` r#_get_async_iterr5s- r")rrrrctj|t}|tur||_ytj|}|||}||_yt j|}||||_yyr5)_return_valuesrlrr_calculate_return_value_side_effect_methodsr)r=rrwfixedreturn_calculatorr side_effectors r#_set_return_valuerFs{   tW -E G#/33D9$(. *(,,T2M *40!r"ceZdZdZdZy) MagicMixinc|jtt|j|i||jyr5)_mock_set_magicsrrrA)rPrQrss r#rAzMagicMixin.__init__Ys6 . J%..;; r"c zttz}|}t|ddU|j|j}t }||z }|D]&}|t |jvst||(|t t |jz }t |}|D]}t||t||y)Nr) _magicsrr* intersectionrrir7rkrzr` MagicProxy)rP orig_magics these_magics remove_magicsrArs r#rzMagicMixin._mock_set_magics_s 44 " 4$ / ;&33D4F4FGLEM',6M&DJ///D%(' $c$t**=*=&>> T !E E5*UD"9 :"r"N)rrrrArr!r"r#rrXs  ;r"rceZdZdZddZy)r z-A version of `MagicMock` that isn't callable.cH|j|||jyrrrrs r#rz"NonCallableMagicMock.mock_add_specy D(+ r"Nr)rrrr rr!r"r#r r ws 7 r"r c eZdZy)AsyncMagicMixinN)rrrr!r"r#rrsr"rc6eZdZdZddZdddeffdZxZS)ra MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself. If you use the `spec` or `spec_set` arguments then *only* magic methods that exist in the spec will be created. Attributes and the return value of a `MagicMock` will also be `MagicMocks`. FcH|j|||jyrrrs r#rzMagicMock.mock_add_specrr")rrc|r#|jrt|jrd}tj|d|i|y)NFr)rrsuperr)rPrrQrRr,s r#rzMagicMock.reset_mocks< $//* !LDF|FvFr"r)rrrr rrr __classcell__r,s@r#rrs&  9> G G Gr"rc eZdZdZdZddZy)rc ||_||_yr5rwr)rPrwrs r#rAzMagicProxy.__init__s  r"c|j}|j}|j|||}t|||t ||||S)N)rwrr)rwrr'r`r)rPrArms r# create_mockzMagicProxy.create_mocksM   " "/5 # 7q!&!U+r"Nc"|jSr5)r)rPr.rs r#r~zMagicProxy.__get__s!!r"r5)rrrrArr~r!r"r#rrs"r"rceZdZedZedZedZfdZdZdZ dZ dZ d Z d Z dd Zd Zfd ZxZS)rrrrctj|i|tjj|j d<d|j d<d|j d<t |j d<tr7tt}t|j d<t|j d<ntt}tjtjztjz|_d|_d |_d|_d|_||j d <d |j d <t)|j d <i|j d<d|j d<y)Nrr_mock_await_count_mock_await_args_mock_await_args_listrrr)rQrRr1r rr^r_r<)rrArrrrkr _CODE_SIGr _CODE_ATTRSrr+ CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountrg)rPrQrR code_mockr,s r#rAzAsyncMockMixin.__init__s6$)&)*1););)I)I o&-. )*,0 ()1: -. '=I08I  } -4=I  0 1':I     !$$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(r"cKt||fd}|xjdz c_||_|jj ||j }|_t |r|t|s t|}t |r&|t|r||i|d{}n||i|}|tur|S|jtur |jS|jAt|jr|j|i|d{S|j|i|S|jS#t$rtwxYw777w)NTrr)rrrrr!rr:rdr StopIterationStopAsyncIterationrrrrr)rPrQrRrrrvs r#rz!AsyncMockMixin._execute_mock_callsTtVn$/ A ##E*!!  V$ v&-!&\F !( L$V,%t6v6600W$  " "' 1$$ $    '"4#3#34-T--t>v>>>#4##T4V4 4   -%--,-7?s=A-E0 D-;#EEA+E E "E-D==EEc`|jdk(rd|jxsdd}t|y)zA Assert that the mock was awaited at least once. r Expected r=z to have been awaited.Nrrrrs r#rzAsyncMockMixin.assert_awaited s;   q doo788NOC % % !r"cz|jdk(s,d|jxsdd|jd}t|y)z@ Assert that the mock was awaited exactly once. rrr=$ to have been awaited once. Awaited rNrrs r#rz"AsyncMockMixin.assert_awaited_once sM1$t8&9:#//09C % %%r"c8j!j}td|dfd}jt fd}jj}||k7r%t |t r|nd}t||y)zN Assert that the last await was with the specified arguments. NzExpected await: z Not awaitedc0jd}|S)Nawait)rrrs r#rz:AsyncMockMixin.assert_awaited_with.._error_message( s33D&3QCJr"Tr)rrrrrr(r)rPrQrRrrrrs``` r#rz"AsyncMockMixin.assert_awaited_with s ?? "77fEH #3H:]!KL L %%eT6N&EF##DOO4 X  *8Y ?HTE !12 = r"c|jdk(s,d|jxsdd|jd}t||j|i|S)zi Assert that the mock was awaited exactly once and with the specified arguments. rrr=rr)rrrrrs r#rz'AsyncMockMixin.assert_awaited_once_with2 s` 1$t8&9:#//09C % %'t''888r"c"|jt||fd}t|tr|nd}|jDcgc]}|j|}}|s |t |vr!|j ||}td|z|ycc}w)zU Assert the mock has ever been awaited with the specified arguments. TrNz%s await not found)rrr(rrrrrrs r#rzAsyncMockMixin.assert_any_await= s%%eT6N&EF&x;151E1EF1EA$$$Q'1EF HL$88">>tVLO $6 9Grc @|Dcgc]}j|}}td|Dd}tfdjD}|sb||vr]|d}n1dj |Dcgc]}t |t r|ndc}}t|dt|dj|yt|}g} |D]} |j| | rtt| d|ycc}wcc}w#t$r| j| YXwxYw) a Assert the mock has been awaited with the specified calls. The :attr:`await_args_list` list is checked for the awaits. If `any_order` is False (the default) then the awaits must be sequential. There can be extra calls before or after the specified awaits. If `any_order` is True then the awaits can be in any order, but they must all appear in :attr:`await_args_list`. c3BK|]}t|ts|ywr5rrs r#rz3AsyncMockMixin.assert_has_awaits..W rrNc3@K|]}j|ywr5rrs r#rz3AsyncMockMixin.assert_has_awaits..X sS>Rt11!4>RrzAwaits not found.z,Error processing expected awaits. Errors: {}rz Actual: z not all found in await list) rrrrrr(rrrfrrGr!rg) rPrrrrr all_awaitsrrprrs ` r#rz AsyncMockMixin.assert_has_awaitsJ s\4995aD&&q)59FFMSd>R>RSS z)=1G ,-3V-5$7-5*4Ay)AAt$K-5$7.8%i !!*5!1 23#3346  *%  D '!!$'  49)4DF  7:$7 '  & 'sC6+C;DDDcz|jdk7r,d|jxsdd|jd}t|y)z9 Assert that the mock was never awaited. rrr=z# to not have been awaited. Awaited rNrrs r#rz!AsyncMockMixin.assert_not_awaitedv sM   q t8&9:#//09C % % !r"cttj|i|d|_d|_t |_y)z0 See :func:`.Mock.reset_mock()` rN)rrrrrr)rPrQrRr,s r#rzAsyncMockMixin.reset_mock s5 D+F+({r"r)rrrrrrrrArrrrrrrrrrrs@r#rrs\&}5K%l3J*+<=O0B&!P&&>$ 9 *X&++r"rceZdZdZy)r aY Enhance :class:`Mock` with features allowing to mock an async function. The :class:`AsyncMock` object will behave so the object is recognized as an async function, and the result of a call is an awaitable: >>> mock = AsyncMock() >>> iscoroutinefunction(mock) True >>> inspect.isawaitable(mock()) True The result of ``mock()`` is an async function which will have the outcome of ``side_effect`` or ``return_value``: - if ``side_effect`` is a function, the async function will return the result of that function, - if ``side_effect`` is an exception, the async function will raise the exception, - if ``side_effect`` is an iterable, the async function will return the next value of the iterable, however, if the sequence of result is exhausted, ``StopIteration`` is raised immediately, - if ``side_effect`` is not defined, the async function will return the value defined by ``return_value``, hence, by default, the async function returns a new :class:`AsyncMock` object. If the outcome of ``side_effect`` or ``return_value`` is an async function, the mock async function obtained when the mock object is called will be this async function itself (and not an async function returning an async function). The test author can also specify a wrapped object with ``wraps``. In this case, the :class:`Mock` object behavior is the same as with an :class:`.Mock` object: the wrapped object may have methods defined as async function functions. Based on Martin Richard's asynctest project. Nrr!r"r#r r s'r"r c"eZdZdZdZdZdZy)_ANYz2A helper object that compares equal to everything.cyrr!rPrs r#rz _ANY.__eq__ sr"cyrr!rs r#rz _ANY.__ne__ sr"cy)Nzr!rs r#rz _ANY.__repr__ sr"N)rrrr rrrr!r"r#r r  s8r"r c d|z}d}dj|Dcgc] }t|c}}dj|jDcgc] \}}|d|c}}} |r|}| r |r|dz }|| z }||zScc}wcc}}w)Nz%s(%%s)rz, =)r\reprrE) rwrQrRrformatted_argsrH args_stringrCr kwargs_strings r#r~r~ s$GN))$7$3T#Y$78KII171?:33M$  d "N-' ^ ##8s A>B ceZdZdZ ddZ ddZdZejZdZ dZ dZ d Z e d Ze d Zd Zd Zy)ra A tuple for holding the results of a call to a mock, either in the form `(args, kwargs)` or `(name, args, kwargs)`. If args or kwargs are empty then a call tuple will compare equal to a tuple without those values. This makes comparisons less verbose:: _Call(('name', (), {})) == ('name',) _Call(('name', (1,), {})) == ('name', (1,)) _Call(((), {'a': 'b'})) == ({'a': 'b'},) The `_Call` object provides a useful shortcut for comparing with call:: _Call(((1, 2), {'a': 3})) == call(1, 2, a=3) _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3) If the _Call has no name then it will match any name. Ncnd}i}t|}|dk(r|\}}}nh|dk(r2|\} } t| tr| }t| tr| }n9| }n6| | }}n1|dk(r,|\}t|tr|}nt|tr|}n|}|rtj |||fStj ||||fS)Nr!rr)rr(rNrgr) rrrwrr from_kallrQrR_lenfirstseconds r#rz _Call.__new__ s5z 19!& D$ QY!ME6%%fe,!D#F$ff QYFE%%E5) ==tVn5 5}}S4v"677r"c.||_||_||_yr5)rr_mock_from_kall)rPrrwrrrs r#rAz_Call.__init__ s"(r"c" t|}d}t|dk(r|\}}n|\}}}t|ddr't|ddr|j|jk7ryd}|dk(rdi}}n|dk(r|\}}}nv|dk(r5|\} t | t r| }i}nXt | tr| }di}}nAd}| }n<|dk(r6|\} } t | tr| }t | t r| i}}n d| }}n| | }}ny|r||k7ry||f||fk(S#t$r tcYSwxYw) NrrrFrr!rr)rrrr*rr(rgrN) rPr len_other self_name self_args self_kwargs other_name other_args other_kwargsrrrs r#rz _Call.__eq__ sV "E I t9>%) "I{04 -Iy+ D.$ /GE>SW4X%%););; >')2 J !^38 0J L !^FE%'" ! E3'" +-rL  $ !^!ME6%%" fe,/5r J/16 J+0&L  y0L)i-EEE_ "! ! "s C<<D Dc|jtd||fdS|jdz}t|j||f||S)Nrr%rrrrrs r#rDz_Call.__call__H sH ?? ""dF+$7 7%dootV44MMr"cr|j t|dS|jd|}t||dS)NF)rwrr?)rwrrr))rPrrws r#rz_Call.__getattr__P s6 ?? "de4 4//40$tu==r"c^|tjvrttj||Sr5)rgrkrE__getattribute__)rPrs r#r,z_Call.__getattribute__W s' 5>> ! %%dD11r"cDt|dk(r |\}}||fS|\}}}||fS)Nr)rrs r#_get_call_argumentsz_Call._get_call_arguments] s: t9>LD&V|"& D$V|r"c(|jdSNrr.rs r#rQz _Call.argse '')!,,r"c(|jdS)Nrr1rs r#rRz _Call.kwargsi r2r"c|js(|jxsd}|jdrd|z}|St|dk(rd}|\}}n'|\}}}|sd}n|jdsd|z}nd|z}t |||S)Nrr%zcall%srzcall.%s)rrrVrr~)rPrwrQrRs r#rz_Call.__repr__m s##??,fDt$$K t9>DLD&!% D$__T* 4'$%dD&99r"cg}|}|,|jr|j||j}|,tt |S)zFor a call object that represents multiple calls, `call_list` returns a list of all the intermediate calls as well as the final call.)rr!rrr[)rPvalsthings r# call_listz_Call.call_list sM$$ E"&&E$((r")r!rNFT)r!NNFT)rrrr rrArrgrrDrr,r.rrQrRrr8r!r"r#rr s|$:?8@>C)2Fj]]FN>2 ----:* )r"r)rc t|r t|}t|t}t|rt d|dt |}d|i} |rd|i} n|i} | r|rd| d<|s t ||jd|}|} |d } | j|t} tj|ri} n=|r|r td t} n't|st} n|r|rt!|st} | d||| |d | } t|t"rt%| |} |rt'| nt)|| ||||s| |j*|<|jd d} |r|sd |vrt-||dd| | | _t1|D]}t3|r t5||}d|i}| rt9| |r|j||rd|i}t|t"st;||| ||}|| j*|<n~| }t|t"r | j<}t?|||}||d<tA|rt}nt}|d||||d|}|| j*|<||_t)|||t|t"stC| ||t| r|r| jDdi|| S#t6$rYCwxYw)aCreate a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the `spec` object as their spec. Functions or methods being mocked will have their arguments checked to check that they are called with the correct signature. If `spec_set` is True then attempting to set attributes that don't exist on the spec object will raise an `AttributeError`. If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by passing `instance=True`. The returned mock will only be callable if instances of the mock are callable. `create_autospec` will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock.z'Cannot autospec a Mock object. [object=rrrNTrrwrzJInstance can not be True when create_autospec is mocking an async function)rrrrwrrr%)rZr-rrrdr)rrwrr)rYr!)#rhr7r(r'rr3rrGrrr+isdatadescriptorrr rdr rnr>rzrr[rr rr rr*rEr)r9r= _must_skiprr`r)rrrZrr-rrRis_type is_async_funcr8rr5r=wrappedrAru child_kwargsrrrY child_klasss r#r r s.~Dzt$G"**. 45 5"4(MtnGt$ 8'+#$ f% JJvu %EI  NN6 E%   >? ? t_$ X&8&>$  (W  (& (D$ &dD)  d #tWh78(,u%jj$'GxN&$@+D(T2629;T U   tU+H) ww.   h  / &1L(M2XxuhGC),D   &F$ ."48I(1L %"8,' ' BV%5*0B4@BC),D   &*}C  Xsi @ c= ) D% %gn6%f% KU   s J?? K  K c,t|ts|t|divry|j}|jD]X}|j j |t}|tur,t|ttfryt|tr|cSy|S)z[ Return whether we should skip the first argument on spec's `entry` attribute. rkF) r(r7r*r,rjrkrlrrCrBr>)rrAr<rrvs r#r;r;( s dD ! GD*b1 1~~##E73 W   f|[9 :  .N Nr"ceZdZ ddZy)r9NcX||_||_||_||_||_||_yr5)ridsrrrZrw)rPrrrrwrDrZs r#rAz_SpecState.__init__F s,       r")FNNNF)rrrrAr!r"r#r9r9D s 48/4r"r9cvt|trtj|Stj|Sr5)r(bytesioBytesIOStringIO) read_datas r# _to_streamrK\ s*)U#zz)$${{9%%r"c d t}|dg fd} fd} fd fd fd}tVddl}tt t |j jt t |jat+ddl}tt t |ja |tdt }tt  j_ d j_ d j_ d j _ d j"_ | j_ d < d  j _| j"_ j&_| j(_ fd }||_ |_ |S) a A helper function to create a mock to replace the use of `open`. It works for `open` called directly or used as a context manager. The `mock` argument is the mock object to configure. If `None` (the default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. `read_data` is a string for the `read`, `readline` and `readlines` of the file handle to return. This is an empty string by default. NcjjjjSdj|i|Sr0) readlinesrrQrR_statehandles r#_readlines_side_effectz)mock_open.._readlines_side_effectr sC    ( ( 4##00 0"vay""D3F33r"cjjjjSdj|i|Sr0)readrrOs r#_read_side_effectz$mock_open.._read_side_effectw s= ;; # # /;;++ +vay~~t.v..r"c?`KEd{ dj|i|7wr0)readline)rQrR_iter_side_effectrPs r#_readline_side_effectz(mock_open.._readline_side_effect| s<$&&&$&)$$d5f5 5 's .,.c3Kjj jjdD]}|ywr0)rWr)linerPrQs r#rXz$mock_open.._iter_side_effect sB ?? ' ' 3oo2221IDJsAAcxjjjjStdSr0)rWrr)rPrQsr#_next_side_effectz$mock_open.._next_side_effect s1 ?? ' ' 3??// /F1Ir"ropen)rwr)rrctd<jjdk(rd<dj_tS)Nrr)rKrWrr)rQrRrYrPrQrJs r# reset_datazmock_open..reset_data sHy)q ?? & &&) 3-/F1I*0)FOO 'r")rK file_spec_iorfrir  TextIOWrapperunionrH open_specr^rr:rwriterTrWrNrrr) r=rJ _read_datarRrUr]rbr`rXrYrPrQs ` @@@@r#rrc sWI&J$ F4 / 6  S!2!234::3s3;;?O;PQR S]+,  |f95 I &F$*F! $FLL#FKK#'FOO $(F!/FKK%'F1I"()FOO#9F "3FOO"3FOO"DD Kr"c$eZdZdZdZddZdZy)raW A mock intended to be used as a property, or other descriptor, on a class. `PropertyMock` provides `__get__` and `__set__` methods so you can specify a return value when it is fetched. Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. c tdi|S)Nr!)r)rPrRs r#r'zPropertyMock._get_child_mock s"6""r"Nc|Sr5r!)rPr.obj_types r#r~zPropertyMock.__get__ s v r"c||yr5r!)rPr.rIs r#rzPropertyMock.__set__ s  S r"r5)rrrr r'r~rr!r"r#rr s#r"rcd|_t|D]d} t||}t |t s!t |j j|trK|j|usZt|fy#t$rYswxYw)aDisable the automatic generation of child mocks. Given an input Mock, seals it to ensure no further mocks will be generated when accessing an attribute that was not already defined. The operation recursively seals the mock passed in, meaning that the mock itself, any mocks generated by accessing one of its attributes, and all assigned mocks without a name or spec will be sealed. TN) rr r*rEr(r rrlr9rr)r=rrs r#rr sDD  d#A!_-  a&&**40* =    % G   s A;; BBceZdZdZdZdZy)rz8 Wraps an iterator in an asynchronous iterator. cz||_tt}tj|_||j d<y)Nrr1)iteratorr rr+CO_ITERABLE_COROUTINErrk)rPrprs r#rAz_AsyncIterator.__init__ s/  #X6 $:: $- j!r"c^K t|jS#t$rYtwxYwwr5)rrprrrs r#rz_AsyncIterator.__anext__ s1  & &     s-- *-*-N)rrrr rArr!r"r#rr s. !r"rr)NFNNN)FFNN)Nr)__all__rrrGr+rr2builtinsrHrtypesrrr unittest.utilr functoolsrr threadingrrrr rVr(r rrr/r3r'r:r?rKr[rVrdrhrnrzrtrrrgrrrrMISSINGr{DELETEDr:rrrfrrrrr frozenset removeprefixrWrr3rrrrrJrOrSrrVrnrvrYmultiplestopallr magic_methodsnumericsr\rFinplaceright _non_defaultsrvrr_sync_async_magics _async_magicsrrUrurrrrrrrrrrr rrrrFrArrrGrr r rr~rgrrr r;r9r7rr>rarerKrrrr)rwrs00r#rs &  '22#$CyC"(m Hmd4??33GTm H   @2  F # & 6."b>6) )f )   ;          &**(6  6 X   :   j G DGB""$!!!'(*;*;T"BCIh-K E+TE+P((V 6  f$$v)Ev)r uCGS*/Sl8        &Od4$0!!e] IP l dIs*N;3N;0)O& O:+O OOPK!L,__pycache__/async_case.cpython-312.opt-2.pycnu[ ֦ikJddlZddlZddlZddlZddlmZdZGddeZy)N)TestCaseTceZdZdfd ZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd Zdfd ZfdZdZxZS)IsolatedAsyncioTestCasecdt||d|_tj|_yN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s ,/usr/lib64/python3.12/unittest/async_case.pyr z IsolatedAsyncioTestCase.__init__$s) $"#.#;#;#= c Kywrrs r asyncSetUpz"IsolatedAsyncioTestCase.asyncSetUp)  c Kywrrrs r asyncTearDownz%IsolatedAsyncioTestCase.asyncTearDown,rrc0|j|g|i|yr) addCleanuprfuncargskwargss raddAsyncCleanupz'IsolatedAsyncioTestCase.addAsyncCleanup/s $1&1rcK t|} |j}|j}||d{}|j||ddd|S#t$r(t d|j d|j ddwxYw7Ow)N'.zC' object does not support the asynchronous context manager protocol)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r")rcmclsenterexitresults renterAsyncContextz)IsolatedAsyncioTestCase.enterAsyncContext>s 2h 'NNE==D Ry T2tT48  'a/q1A1A0BCTU"& ' '!s% BA BBB1BBc|jj|jj|j|j |j yr)r get_looprrunsetUp _callAsyncrrs r _callSetUpz"IsolatedAsyncioTestCase._callSetUpRs> $$&   $$TZZ0 (rch|j|!tjd|dtdyy)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethodz'IsolatedAsyncioTestCase._callTestMethodZs<    ' 3 MM((.xq23ERS U 4rc|j|j|jj|jyr)r7rrr5tearDownrs r _callTearDownz%IsolatedAsyncioTestCase._callTearDown_s, **+   $$T]]3rc0|j|g|i|yr)r=)rfunctionr r!s r _callCleanupz$IsolatedAsyncioTestCase._callCleanupcsX777rc\|jj||i||jSN)context)r r5rrs rr7z"IsolatedAsyncioTestCase._callAsyncfs8""&& $ !& !,,'  rctj|r-|jj||i||jS|jj|g|i|SrJ)inspectiscoroutinefunctionr r5rrs rr=z'IsolatedAsyncioTestCase._callMaybeAsyncnsi  & &t ,&&**d%f%00+  04++//FtFvF Frc>tjd}||_y)NT)debug)asyncioRunnerr rrunners r_setupAsyncioRunnerz+IsolatedAsyncioTestCase._setupAsyncioRunnerxsd+$rc<|j}|jyr)r closerSs r_tearDownAsyncioRunnerz.IsolatedAsyncioTestCase._tearDownAsyncioRunner}s$$ rc|j t| ||jS#|jwxYwr)rUr r5rX)rr1rs rr5zIsolatedAsyncioTestCase.runs9   " *7;v&  ' ' )D ' ' )s 2Acb|jt| |jyr)rUr rPrX)rrs rrPzIsolatedAsyncioTestCase.debugs$   "   ##%rc>|j|jyyr)r rXrs r__del__zIsolatedAsyncioTestCase.__del__s    *  ' ' ) +r)runTestr)__name__r+r,r rrr"r2r8rBrErHr7r=rUrXr5rPr\ __classcell__)rs@rrr sU4>    2()U 48 G% *& *rr)rQr rMr>caser __unittestrrrrrbs'  E*hE*rPK!^|FF&__pycache__/_log.cpython-312.opt-1.pycnu[ ֦i ddlZddlZddlmZejdddgZGddej ZGd d eZy) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc"eZdZdZdZdZdZy)_CapturingHandlerzM A logging handler capturing all (raw and formatted) logging output. cdtjj|tgg|_yN)loggingHandler__init__rwatcherselfs &/usr/lib64/python3.12/unittest/_log.pyrz_CapturingHandler.__init__s"  &&r2. cyr rs rflushz_CapturingHandler.flushs rc|jjj||j|}|jjj|yr )rrappendformatr)rrecordmsgs remitz_CapturingHandler.emits@ ##F+kk&! ""3'rN)__name__ __module__ __qualname____doc__rrrrrrr r s/ (rr c&eZdZdZdZdZdZdZy)_AssertLogsContextz6A context manager for assertLogs() and assertNoLogs() z"%(levelname)s:%(name)s:%(message)sctj||||_|r&tjj |||_ntj|_d|_||_ yr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser$r'r)s rrz_AssertLogsContext.__init__!sP%%dI6&  --11%?DJ DJ rc|t|jtjr|jx}|_n&tj |jx}|_tj |j}t}|j|j|j||j|_ |jdd|_|j|_|j |_|g|_ |j|jd|_|j$ry|jS)NF) isinstancer$r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr' setFormatterrhandlers old_handlers old_level propagate old_propagater))rr. formatterhandlers r __enter__z_AssertLogsContext.__enter__+s d&& 7#'#3#3 3FT[#*#4#4T5E5E#F FFT[%%d&9&9: #%$Y' "OOA.#--") #  << rcr|j|j_|j|j_|jj |j |y|jrXt|jjdkDr5|jdj|jjyyt|jjdk(rS|jdjtj|j |jj"yy)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r5r.r4r8r7r2r6r)lenrr _raiseFailurerrr getLevelNamer'name)rexc_type exc_valuetbs r__exit__z_AssertLogsContext.__exit__?s#00  $ 2 2  T^^,   <<4<<''(1,""188 ++-4<<''(A-""CVG00N>NOQ.rN)rrrr r1rr;rDrrrr"r"s@9N(Qrr") r collectionscaser namedtuplerr r r"rrrrHsM&)+(():*3X)>@(($:Q-:QrPK!d::&__pycache__/case.cpython-312.opt-1.pycnu[ ֦idZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlmZmZmZmZmZdZeZdZGdd eZGd d eZGd d eZGddeZdZdZdZdZ gZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)GddZ*Gdde*Z+Gd d!e+Z,Gd"d#e+Z-Gd$d%ej\Z/Gd&d'eZ0Gd(d)e0Z1Gd*d+e0Z2y),zTest 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.ceZdZdZy)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__&/usr/lib64/python3.12/unittest/case.pyr r srr ceZdZdZy) _ShouldStopz The test should stop. Nr rrrrr"rrceZdZdZy)_UnexpectedSuccessz7 The test was supposed to fail, but it didn't! Nr rrrrr'rrrc:eZdZddZej ddZy)_OutcomeNc^d|_||_t|d|_d|_d|_y)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init__z_Outcome.__init__.s/!& (/ (E% #rc#K|j}d|_ d|r4|jr(|jj|j|d |jxr||_y#t$rt $r1}d|_t |j|t|Yd}~Td}~wt$rYbtj}|jr||_ nHd|_|r(|jj|j||nt|j||d}YxYw#|jxr||_wxYww)NTF)r rr test_caseKeyboardInterruptr _addSkipstrrsysexc_inforr! _addError)r"r%subTest old_successer*s rtestPartExecutorz_Outcome.testPartExecutor5sll   8 ,4<< &&y':':ItL<<7KDL1!   5 DL T[[)SV 4 4   ||~H%%'/$$ KK**9+>+> 8Tdkk9h?H  <<7KDLsLEA'6D+E'D(9'B% D+% D(1D+3A3D(&D++EEN)F)r rrr# contextlibcontextmanagerr/rrrrr-s!$88rrct|dd}| |||ytjdtd|j|y)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr%reasonr4s rr'r'VsDfi.G 6" L$a ))$rc|D|At|d|jr|j||y|j||yyy)Nr) issubclassfailureException addFailureaddError)rtestr*s rr+r+_sK h2 hqk4#8#8 9 F  dH - FOOD( + 3rc|Sr0r)objs r_idrDfs Jrct|} |j}|j}||}|||ddd|S#t$r(t d|j d|j ddwxYw)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrRjs r(CO ||2YFtRtT* M O!CNN+1S-=-=,>?CDEJN OOs ;1A,c4tj|||fy)znSame as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).N)_module_cleanupsappend)functionargskwargss raddModuleCleanuprYzsXtV45rc"t|tS)z&Same as enterContext, but module-wide.)rRrY)rMs renterModuleContextr[s ". //rcg}tr(tj\}}} ||i|tr(|r|dy#t$r}|j|Yd}~.d}~wwxYw)zWExecute all module cleanup functions. Normally called for you after tearDownModule.Nr)rTpop ExceptionrU) exceptionsrVrWrXexcs rdoModuleCleanupsrasqJ !1!5!5!7$ # d %f %  m #   c " " #s9 AAAc^fd}ttjr }d||S|S)z& Unconditionally skip a test. ct|tstj|fd}|}d|_|_|S)Nctr0r )rWrXr;s r skip_wrapperz-skip..decorator..skip_wrappersv&&rT) isinstancerH functoolswraps__unittest_skip____unittest_skip_why__) test_itemrfr;s r decoratorzskip..decoratorsC)T* __Y ' '( '$I&* #*0 'r)rgtypes FunctionType)r;rmrls` rskiprqs5 &%,,- ## rc(|r t|StS)z/ Skip a test if the condition is true. rqrD conditionr;s rskipIfrvsF| Jrc(|s t|StS)z3 Skip a test unless the condition is true. rsrts r skipUnlessrxs F| Jrcd|_|S)NT)__unittest_expecting_failure__)rls rr!r!s/3I, rct|trtfd|DSt|txr t |S)Nc36K|]}t|ywr0) _is_subtype).0r.basetypes r z_is_subtype..s>X;q(+Xs)rgtupleallrHr=)expectedrs `rr}r}s7(E">X>>> h % H*Xx*HHrceZdZdZdZy)_BaseTestCaseContextc||_yr0)r%)r"r%s rr#z_BaseTestCaseContext.__init__s "rc|jj|j|}|jj|r0)r%_formatMessagemsgr>)r" standardMsgrs r _raiseFailurez"_BaseTestCaseContext._raiseFailures1nn++DHHkBnn--c22rN)r rrr#rrrrrrs #3rrceZdZddZdZy)_AssertRaisesBaseContextNctj||||_||_|t j |}||_d|_d|_yr0) rr#rr%recompileexpected_regexobj_namer)r"rr%rs rr#z!_AssertRaisesBaseContext.__init__sJ%%dI6  "  %ZZ7N, rc t|j|jst|d|j|s=|j dd|_|r ttt|d|d}S|^}} |j|_ |5||i|dddd}y#t$rt||_ Y1wxYw#1swYd}yxYw#d}wxYw)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. z() arg 1 must be rNz1 is an invalid keyword argument for this function) r}r _base_typerL_base_type_strr]rnextiterr rrKr()r"namerWrX callable_objs rhandlez_AssertRaisesBaseContext.handles t}}doo>!%t':':!<==!::eT2#7;DL7I%LMMD#' L4 2 , 5 5 d-f-D " 2 #L 1  2D4DsTA6C;CB'C CC'CCCCC CCCr0)r rrr#rrrrrrs rrcHeZdZdZeZdZdZdZe e jZ y)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typesc|Sr0rr"s rrIz_AssertRaisesContext.__enter__s rc|p |jj}|jr,|j dj ||jn6|j dj |ntj|t||jsy|jd|_ |jy|j}|jt|s4|j dj |jt|y#t$rt|j}Y$wxYw)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rr rKr(rrformat traceback clear_framesr=with_traceback exceptionrsearchpattern)r"exc_type exc_valuetbexc_namers rrJz_AssertRaisesContext.__exit__s   .==11}}""#8#?#?@D $OP""?#9#9(#CD  " "2 &(DMM2"11$7    &,,$$S^4   9@@#++S^ = >+" .t}}- .sDD?>D?N) r rrr BaseExceptionrrrIrJ classmethodro GenericAlias__class_getitem__rrrrrs,MJDN6$E$6$67rrc$eZdZdZeZdZdZdZy)_AssertWarnsContextzBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typesc<ttjjD]}t |ddsi|_t jd|_|jj|_t jd|j|S)N__warningregistry__T)recordalways) listr)modulesvaluesr6rr7catch_warningswarnings_managerrI simplefilterr)r"vs rrIz_AssertWarnsContext.__enter__!syckk((*+Aq/6(*%,!) 7 7t D--779 h 6 rc|jj||||y |jj}d}|j D]}|j}t||js&||}|j%|jjt |s[||_ |j|_ |j|_ y|>|jdj|jj t ||j"r,|jdj||j"y|jdj|y#t$rt |j}YOwxYw)Nrz{} not triggered by {}z{} not triggered)rrJrr rKr(r7messagergrrwarningfilenamelinenorrrr)r"rrrrfirst_matchingmws rrJz_AssertWarnsContext.__exit__,s] &&xB?    *}}--HA Aa/%!"##/''..s1v6DLJJDM((DK   %   9@@((00#n2E G H ==   7>>x?C}} N O   188B C3 *4==)H *sE&&FFN) r rrrWarningrrrIrJrrrrrsLJ?N  DrrceZdZdZy)_OrderedChainMapc#Kt}|jD]#}|D]}||vs|j||%ywr0)setmapsadd)r"seenmappingks r__iter__z_OrderedChainMap.__iter__Ps<uyyGD=HHQKG!s #AAN)r rrrrrrrrOsrrcteZdZdZeZdZdZdZfdZ dLdZ dZ dZ d Z ed Zed Zd Zd ZedZedZdZdZdZdZdZdZdZdZej<efdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dMd Z(d!Z)ed"Z*d#Z+d$Z,d%Z-dMd&Z.dMd'Z/dMd(Z0d)Z1d*Z2d+Z3dNd,Z4dNd-Z5d.Z6dMd/Z7dMd0Z8dMd1Z9 dOd2Z: dOd3Z;dNd4ZdMd7Z?dMd8Z@dMd9ZAdMd:ZBdMd;ZCdMd<ZDdMd=ZEdMd>ZFdMd?ZGdMd@ZHdMdAZIdMdBZJdMdCZKdMdDZLdMdEZMdMdFZNdMdGZOdHZPdIZQdMdJZRdMdKZSxZTS)PTestCaseaWA 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. Tiic@d|_g|_t| |i|y)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rOrWrX __class__s rrzTestCase.__init_subclass__s% %  !4262rc||_d|_d|_ t||}|j|_g|_d|_ i|_ |jtd|jtd|jtd|jtd |jt d |jt"d y#t $r#|dk7rt d|jd|YwxYw) 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 testrunTestzno such test method in : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr6rrK ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr()r" methodName testMethods rr#zTestCase.__init__s * ' 5 z2J#-"4"4D  %'!   '89   '89   (:;   &67   ,<=   &<=) 4Y&!~~z"344' 4s C)C:9C:c"||j|<y)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)r"typeobjrVs rrzTestCase.addTypeEqualityFuncs.6!!'*rc@|jj|||fy)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).N)rrUr"rVrWrXs r addCleanupzTestCase.addCleanups xv67rc.t||jS)zEnters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method. )rRr)r"rMs r enterContextzTestCase.enterContexts b$//22rc@|jj|||fy)zpSame as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).N)rrUrOrVrWrXs raddClassCleanupzTestCase.addClassCleanups ""HdF#;>2D4H4HIIrclt|t|urtS|j|jk(Sr0)rHNotImplementedrr"others r__eq__zTestCase.__eq__s/ :T%[ (! !##u'<'<<rrs r__repr__zTestCase.__repr__s"($*>*>@ @rc+HK|j|jjsdy|j}| t|}n|jj |}t ||||_ |jj|jd5dddd|jjs*|jj}|.|jr"t|jjrt||_y#1swYmxYw#||_wxYww)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. NT)r,) rrrrparams new_child_SubTestr/r rfailfastrr!)r"rr#parent params_maprs rr,zTestCase.subTests ==  (N(N   >)&1J008J sJ7  #// t/LM==((--%&//%%.."!"DMML#DMs7A/D"2'DD A$DD" DD DD"c |j}|||y#t$r/tjdt|j |YywxYw)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerKr7r8r9r:)r"rr*r*s r_addExpectedFailurezTestCase._addExpectedFailure'sR /!'!:!:  tX .  $ MM\( * F  d # $s 5AAc |j}||y#t$rXtjdt t d#t $r)|j |tjYYywxYwwxYw)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrKr7r8r9rr?r)r*)r"rr-s r_addUnexpectedSuccesszTestCase._addUnexpectedSuccess1st '#)#>#>  ! & 8 MM_( * 8(d2% 8!!!$ 7 8 8s& #A8A.A40A83A44A8c |j}|||y#t$rtjdtYywxYw)Nz$TestResult has no addDuration method) addDurationrKr7r8r9)r"relapsedr0s r _addDurationzTestCase._addDuration@sA ' ,,K g &  * MM@( * *s #>>c$|jyr0)rrs r _callSetUpzTestCase._callSetUpIs  rcT|!tjd|dtdyy)NzFIt is deprecated to return a value that is not None from a test case (r) stacklevel)r7r8DeprecationWarning)r"methods r_callTestMethodzTestCase._callTestMethodLs3 8  MM((.xq23ERS U rc$|jyr0)rrs r _callTearDownzTestCase._callTearDownQs  rc||i|yr0rrs r _callCleanupzTestCase._callCleanupTs$!&!rc|4|j}t|dd}t|dd}| |nd}|j| t||j}t|jdds t|ddrQt|jddxs t|dd}t |||||j |||SSt|ddxs t|dd}t|}tj} ||_ |j|5|jddd|jrc||_|j|5|j|dddd|_|j|5|j!ddd|j#|j%|tj|z |jrO|r;|j&r|j)||j&n$|j+|n|j,||d|_d}d|_ |j |||SS#1swY9xYw#1swYxYw#1swYxYw#d|_d}d|_ wxYw#|j |||wwxYw)N startTestRun stopTestRunrjFrkrnrz)rr6 startTestrrr'stopTestrtime perf_counterrr/r4r rr:r< doCleanupsr2r!r+r.r:) r"rr@rArskip_whyroutcome start_times rrunz TestCase.runWs >++-F"6>4@L!&->K'K4  t';';FM $DeL v&G**,J % ' --d3OO%4??0AG- 11$7,,Z8805G- 11$7**,8!!!&4+<+<+>+KM??("22 44VW=T=TU 66v>)))$/+/'!%  FOOD !& 'A438787"+/'!%  FOOD !& 'st A.J.;J.J+I3<,J(J: JJ +BJJ.3I=8JJ J JJJ++J..K c0|jxs t}|jr[|jj\}}}|j |5|j |g|i|ddd|jr[|j S#1swY"xYw)zNExecute all cleanup functions. Normally called for you after tearDown.N)rrrr]r/r>r )r"rHrVrWrXs rrFzTestCase.doCleanupss---8:nn%)^^%7%7%9 "HdF))$/!!!( "HdF ?$)&)!! ?''..s||~> ?sA 6BBc&|j|i|Sr0)rJ)r"rWkwdss r__call__zTestCase.__call__stxx&&&rct||j}t|jdds t|ddr1t|jddxs t|dd}t||j |j ||j |jrB|jj\}}}|j|g|i||jrAyy)z6Run the test without collecting errors in a TestResultrjFrkrnN) r6rrr r4r:r<rr]r>)r"rrGrVrWrXs rdebugzTestCase.debugsT4#7#78 DNN$7 ? J 3U ;0GLL":/FK 8$ $  Z( nn%)^^%7%7%9 "HdF D  h 8 8 8nnrct|)zSkip this test.re)r"r;s rskipTestzTestCase.skipTests vrc$|j|)z)Fail immediately, with the given message.)r>)r"rs rfailz TestCase.fails##C((rcf|r/|j|dt|z}|j|y)z#Check that the expression is false.z%s is not falseNrrr>r"exprrs r assertFalsezTestCase.assertFalses7 %%c+>.$?GdGs#'c@t||}|jd||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) assertWarnsrr)r"expected_warningrWrXrfs rrhzTestCase.assertWarnss$8&&6=~~mT6::rc&ddlm}||||dS)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_AssertLogsContextFno_logs_logrmr"loggerlevelrms r assertLogszTestCase.assertLogs.s* -!$uEErc&ddlm}||||dS)z Fail unless no log messages of level *level* or higher are emitted on *logger_name* or its children. This method must be used as a context manager. rrlTrnrprrs r assertNoLogszTestCase.assertNoLogsFs -!$tDDrct|t|urD|jjt|}|t|tr t ||}|S|j S)aGet a detailed comparison function for the types of the two args. Returns: A callable accepting (first, second, msg=None) that will raise a failure exception if first != second with a useful human readable error message for those types. )rHrgetrgr(r6_baseAssertEqual)r"firstsecondasserters r_getAssertEqualityFunczTestCase._getAssertEqualityFuncOs[" ;$v, &0044T%[AH#h,&tX6H$$$rcr||k(s2dt||z}|j||}|j|y)z:The default assertEqual implementation, not type specific.%s != %sN)r rr>)r"r{r|rrs rrzzTestCase._baseAssertEqualisC$';E6'JJK%%c;7C'', ,rc>|j||}||||y)z[Fail if the two objects are unequal as determined by the '==' operator. )rN)r~)r"r{r|rassertion_funcs r assertEqualzTestCase.assertEqualps"44UFCuf#.rc||k7s:|j|t|dt|}|j|y)zYFail if the two objects are equal as determined by the '!=' operator.  == NrY)r"r{r|rs rassertNotEqualzTestCase.assertNotEqualwsI%%c59I:CF:K,MNC'', ,rc ~||k(ry| | tdt||z }|9||kryt|dt|dt|dt|d}n=|d}t||dk(ryt|dt|d|d t|d}|j ||}|j |) a'Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). If the two objects compare equal then they will automatically compare almost equal. N specify delta or places not bothz !=  within  delta ( difference)rz places (rLabsrroundrr>r"r{r|placesrdeltadiffrs rassertAlmostEqualzTestCase.assertAlmostEquals F?   !3>? ?56>"  u}% &!% $ !K ~T6"a'% &!$ !K !!#{3##C((rc n| | tdt||z }|>||k(s||kDryt|dt|dt|dt|d}n6|d}||k(st||dk7ryt|dt|d|d }|j ||}|j |) aFail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). Objects that are equal automatically fail. Nrrrrrrrz placesrrs rassertNotAlmostEqualzTestCase.assertNotAlmostEquals  !3>? ?56>"  VO% &!% $ !K ~VOtV)<)A9B59I9B69J9?AK!!#{3##C((rc |d|j}t||s |jd|dt|t||s"|jd|dt|d}d} t |}| t |}|||k(ryd|jft||zz}ttD]+} || } || } | | k7s|d | ft| | zzz }n ||k(r|t|t|k7ry||kDr%|d |||z fzz } |d |t||fzz }n)||kr$|d|||z fzz } |d |t||fzz }|} ddjtjt!j"|j%t!j"|j%z} |j'| | } |j)|| }|j+|y#t t f$r d|z}YwxYw#t t f$r d|z}YwxYw#t tt f$r|d | |fzz }YMwxYw#t tt f$r|d | |fzz }YswxYw#t tt f$r|d||fzz }YEwxYw#t tt f$r|d||fzz }YjwxYw)aAAn equality assertion for ordered sequences (like lists and tuples). For the purposes of this function, a valid ordered sequence type is one which can be indexed, has a length, and has an equality operator. Args: seq1: The first sequence to compare. seq2: The second sequence to compare. seq_type: The expected datatype of the sequences, or None if no datatype should be enforced. msg: Optional message to use on failure instead of a list of differences. NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r )r rgr>rlenrLNotImplementedError capitalizer rangemin IndexErrorrHjoindifflibndiffpprintpformat splitlines_truncateMessagerrW)r"seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualzTestCase.assertSequenceEquals  $--MdH-+++8)D/-KLLdH-+++8)D/-KLL'M  #t9D   '4y  t|0"--/1(t456I3tT?+ GE  GE E>"K#$$)=eU)K"K#MNI%,(DLX%5J$t*,d{+.;TD[-IJK K"A#'4:)>"?#@AI +.;TD[-IJK L"A#'4:)>"?#@AI   MM&...99; ...99; =>>++KA !!#{3 #K./ #B!#I #23 'G%'  '":/BC"N"#]!3#45I":/BC"O"#]!3#45I*":/BCK#259=4I#JKIK":/BCL#36:M5J#KLILsl, H: H H; I!#J J,HH H87H8;II!JJJ)(J),K Kcn|j}|t||kr||zS|tt|zzSr0)maxDiffr DIFF_OMITTED)r"rrmax_diffs rrzTestCase._truncateMessage3s:<<  s4yH4T> !,T233rc6|j|||ty)aA list-specific equality assertion. Args: list1: The first list to compare. list2: The second list to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r"list1list2rs rrzTestCase.assertListEqual9s   sT Brc6|j|||ty)aA tuple-specific equality assertion. Args: tuple1: The first tuple to compare. tuple2: The second tuple to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r"tuple1tuple2rs rrzTestCase.assertTupleEqualEs   u Erc |j|} |j|}ssyg}|r2|j d|D]}|j t |r2|j d|D]}|j t |dj |} |j|j|| y#t$r}|jd|zYd}~d}~wt$r}|jd|zYd}~d}~wwxYw#t$r}|jd|zYd}~d}~wt$r}|jd|zYd}~:d}~wwxYw)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 ) differencerLrWrKrUreprrr) r"set1set2r difference1r. difference2linesitemrs rrzTestCase.assertSetEqualPsE P//$/K  Q//$/K {   LLE F# T$Z($  LLE F# T$Z($ii&  $%%c;785 M IIG!K L L P IIJQN O O P  M IIG!K L L Q IIKaO P P QsFCD DC)) D5DD E$D99 E$EE$c||vr;t|dt|}|j|j||yy)zDJust like self.assertTrue(a in b), but with a nicer default message. not found in NrrWrr"member containerrrs rassertInzTestCase.assertIn{s@  "2;F2C2;I2FHK IId))#{; < #rc||vr;t|dt|}|j|j||yy)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nrrs r assertNotInzTestCase.assertNotIns@ Y ;DV;L8A)8LNK IId))#{; < rc||ur;t|dt|}|j|j||yy)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nrr"expr1expr2rrs rassertIszTestCase.assertIss?  ,5e,<-6u-=?K IId))#{; < rcl||ur0dt|}|j|j||yy)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nrrs r assertIsNotzTestCase.assertIsNots4 E>:CE:JLK IId))#{; < rc |j|td|j|td||k7rdt||z}ddjt j t j|jt j|jz}|j||}|j|j||yy)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr ) assertIsInstancerr rrrrrrrrWr)r"d1d2rrrs rrzTestCase.assertDictEquals b$(LM b$(MN 8$';B'CCK499W]]!>>"-88:!>>"-88:&<==D// TBK IId))#{; < rct|t|}} tj|}tj|}||k(ryt||}|r[d}|Dcgc]}d|z } }dj | } |j|| }|j||}|j|yy#t$rt ||}YuwxYwcc}w)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: z First has %d, Second has %d: %rr ) r collectionsCounterrrLrrrrrW) r"r{r|r first_seq second_seq differencesrrrrs rassertCountEqualzTestCase.assertCountEquals!%U T&\:  F'' 2E ((4F .y*EK ;EWii&G// WEK%%c;7C IIcN  I1)ZHK IXs*B2 C 2C  C c|j|td|j|td||k7rt||jkDst||jkDr|j ||||}|}|r|r|ddk7s|ddk7r*|dz }|dz }n|r|ddk7r|dz }n|r |ddk7r|dz }|j d}|j d}dt ||z}ddjtj||z} |j|| }|j|j||y y ) z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringr T)keependsrrnN) rr(r_diffThresholdrzrr rrrrrWr) r"r{r|rfirst_presplitsecond_presplit firstlines secondlinesrrs rrzTestCase.assertMultiLineEqualsY eS*JK fc+LM F?E T000F d111%%eVS9 #N$O9$r d(:"d*N#t+OF2J$.4'59,$&'22D2AJ)44d4CK%';E6'JJK"'''-- K"HIID// TBK IId))#{; <9 rc||ks;t|dt|}|j|j||yy)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nrr"abrrs r assertLesszTestCase.assertLesss91u3 b), but with a nicer default message.z not greater than Nrrs r assertGreaterzTestCase.assertGreaters91u6?lIaLQK IId))#{; <rc||k\s;t|dt|}|j|j||yy)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to Nrrs rassertGreaterEqualzTestCase.assertGreaterEquals<AvBKA,PYZ[P\]K IId))#{; <rch|0t|d}|j|j||yy)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Nonerr"rCrrs r assertIsNonezTestCase.assertIsNones1 ?.7n>K IId))#{; < rcP|$d}|j|j||yy)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rWrrs rassertIsNotNonezTestCase.assertIsNotNones* ;-K IId))#{; < rct||s2t|d|}|j|j||yy)zTSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.z is not an instance of NrgrrWrr"rCrOrrs rrzTestCase.assertIsInstance s:#s#;DS>3OK IId))#{; <$rct||r2t|d|}|j|j||yy)z,Included for symmetry with assertIsInstance.z is an instance of Nrrs rassertNotIsInstancezTestCase.assertNotIsInstances8 c3 7@~sKK IId))#{; < rcBt|||}|jd||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. assertRaisesRegexrd)r"rerrWrXrfs rrzTestCase.assertRaisesRegexs'''94P~~14@@rcBt|||}|jd||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. assertWarnsRegexri)r"rjrrWrXrfs rrzTestCase.assertWarnsRegex&s' &&6nM~~0$??rct|ttfrtj|}|j |s5d|j d|}|j||}|j|y)z=Fail the test unless the text matches the regular expression.zRegex didn't match: rN) rgr(bytesrrrrrr>)r"textrrrs r assertRegexzTestCase.assertRegex9sh nsEl 3ZZ7N$$T*&&.K%%c;7C'', , +rc.t|ttfrtj|}|j |}|rWd||j |jd|jd|}|j||}|j|y)z9Fail the test if the text matches the regular expression.zRegex matched: z matches z in N) rgr(rrrrstartendrrr>)r"runexpected_regexrmatchrs rassertNotRegexzTestCase.assertNotRegexEs &e 5!zz*:;  ''- U[[]UYY[1 ((K %%c;7C'', , r)rr0)NNNNN)Ur rrrAssertionErrorr>r`rrrr#rrrrrrrrrrrrrrrrrr!r1r2_subtest_msg_sentinelr,r+r.r2r4r:r<r>rJrFrNrQrSrUrWr\r^rrcrhrurwr~rzrrrrrrrrrrrrrrrrrrrrrrrrrrrr  __classcell__rs@rrrYs@&KGN3 >@ 683== 77  VVaa#CJ= 8e@/##</ ''U "?B  ? ?'9")- - I*B;>F0E%4-/-AE $+)ZDH#'!)FaF4 C F)9V==== =@!=F= = = = = = == A @& - -rrcZeZdZdZd fd ZdZdZdZdZdZ dZ d Z d Z d Z xZS) 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. cbtt| ||_||_||_||_yr0)rrr# _setUpFunc _tearDownFunc _testFunc _description)r"testFuncrr descriptionrs rr#zFunctionTestCase.__init__^s/ .0%!'rc>|j|jyyr0)rrs rrzFunctionTestCase.setUpes ?? & OO  'rc>|j|jyyr0)rrs rrzFunctionTestCase.tearDownis    )     *rc$|jyr0)rrs rrzFunctionTestCase.runTestms  rc.|jjSr0)rr rs rrzFunctionTestCase.idps~~&&&rct||jstS|j|jk(xrO|j|jk(xr4|j |j k(xr|j |j k(Sr0)rgrrrrrrrs rrzFunctionTestCase.__eq__ssv%0! !%"2"227!!U%8%887~~07  E$6$66 7rctt||j|j|j|j fSr0)rrHrrrrrs rrzFunctionTestCase.__hash__|s7T$Z$2D2D^^T%6%689 9rc`t|jd|jjdS)Nrr)rrrr rs rrzFunctionTestCase.__str__s%$T^^4 NN335 5rcNdt|jd|jdS)Nrz tec=r )rrrrs rr!zFunctionTestCase.__repr__s ( 8%)^^5 5rc|j |jS|jj}|xr"|jddj xsdS)Nr r)rrrr r r s rrz!FunctionTestCase.shortDescriptionsO    ($$ $nn$$1syyq)//19T9rr )r rrrr#rrrrrrrr!rrrs@rrrUs:(!'7955:rrc<eZdZfdZdZdZdZdZdZxZ S)r%cnt|||_||_||_|j |_yr0)rr#_messager%r#r>)r"r%rr#rs rr#z_SubTest.__init__s1  " ) : :rctd)Nzsubtests cannot be run directly)rrs rrz_SubTest.runTests!"CDDrc`g}|jtur*|jdj|j|jrPdj d|jj D}|jdj|dj |xsdS)Nz[{}]z, c3FK|]\}}dj||yw)z{}={!r}N)r)r~rrs rrz+_SubTest._subDescription..s)$31FQ  A&1s!z({}) z ())r%rrUrr#ritems)r"parts params_descs r_subDescriptionz_SubTest._subDescriptions == 5 5 LLt}}5 6 ;;))$3"kk//1$33K LL{3 4xx/-/rcrdj|jj|jSNz{} {})rr%rr-rs rrz _SubTest.ids)~~dnn//143G3G3IJJrc6|jjS)zlReturns a one-line description of the subtest, or None if no description has been provided. )r%rrs rrz_SubTest.shortDescriptions~~..00rcVdj|j|jSr/)rr%r-rs rrz_SubTest.__str__s ~~dnnd.B.B.DEEr) r rrr#rr-rrrrrs@rr%r%s$;E 0K1 Frr%)3rr)rhrrrr7rr1rrDrornrutilrrrrr __unittestobjectrrr^r rrrr'r+rDrRrTrYr[rarqrvrxr!r}rrrrChainMaprrrr%rrrr6s4   ?? 7 y)  &8v&8R%, 6 0  (I 33'3'T$83$8N1D21Dh{++x-vx-x7:x7:t!Fx!FrPK!oj&__pycache__/case.cpython-312.opt-2.pycnu[ ֦i ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZmZmZdZeZdZGddeZGd d eZGd d eZGd deZdZdZdZdZgZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(GddZ)Gdde)Z*Gdd e*Z+Gd!d"e*Z,Gd#d$ejZZ.Gd%d&eZ/Gd'd(e/Z0Gd)d*e/Z1y)+N)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 eZdZy)SkipTestN__name__ __module__ __qualname__&/usr/lib64/python3.12/unittest/case.pyr r srr c eZdZy) _ShouldStopNr rrrrr"rrc eZdZy)_UnexpectedSuccessNr rrrrr'rrrc:eZdZddZej ddZy)_OutcomeNc^d|_||_t|d|_d|_d|_y)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init__z_Outcome.__init__.s/!& (/ (E% #rc#K|j}d|_ d|r4|jr(|jj|j|d |jxr||_y#t$rt $r1}d|_t |j|t|Yd}~Td}~wt$rYbtj}|jr||_ nHd|_|r(|jj|j||nt|j||d}YxYw#|jxr||_wxYww)NTF)rrr test_caseKeyboardInterruptr _addSkipstrrsysexc_inforr _addError)r!r$subTest old_successer)s rtestPartExecutorz_Outcome.testPartExecutor5sll   8 ,4<< &&y':':ItL<<7KDL1!   5 DL T[[)SV 4 4   ||~H%%'/$$ KK**9+>+> 8Tdkk9h?H  <<7KDLsLEA'6D+E'D(9'B% D+% D(1D+3A3D(&D++EEN)F)r rrr" contextlibcontextmanagerr.rrrrr-s!$88rrct|dd}| |||ytjdtd|j|y)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr$reasonr3s rr&r&VsDfi.G 6" L$a ))$rc|D|At|d|jr|j||y|j||yyyNr) issubclassfailureException addFailureaddError)rtestr)s rr*r*_sK h2 hqk4#8#8 9 F  dH - FOOD( + 3rc|Sr/r)objs r_idrDfs Jrct|} |j}|j}||}|||ddd|S#t$r(t d|j d|j ddwxYw)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrRjs r(CO ||2YFtRtT* M O!CNN+1S-=-=,>?CDEJN OOs ;1A,c6 tj|||fyr/)_module_cleanupsappend)functionargskwargss raddModuleCleanuprYzs2XtV45rc$ t|tSr/)rRrY)rMs renterModuleContextr[s0 ". //rc g}tr(tj\}}} ||i|tr(|r|dy#t$r}|j|Yd}~.d}~wwxYwr<)rTpop ExceptionrU) exceptionsrVrWrXexcs rdoModuleCleanupsrastJ !1!5!5!7$ # d %f %  m #   c " " #s: AAAc` fd}ttjr }d||S|S)Nct|tstj|fd}|}d|_|_|S)Nctr/r )rWrXr:s r skip_wrapperz-skip..decorator..skip_wrappersv&&rT) isinstancerH functoolswraps__unittest_skip____unittest_skip_why__) test_itemrfr:s r decoratorzskip..decoratorsC)T* __Y ' '( '$I&* #*0 'r)rgtypes FunctionType)r:rmrls` rskiprqs: &%,,- ## rc* |r t|StSr/rqrD conditionr:s rskipIfrvsF| Jrc* |s t|StSr/rsrts r skipUnlessrxs F| Jrcd|_|S)NT)__unittest_expecting_failure__)rls rr r s/3I, rct|trtfd|DSt|txr t |S)Nc36K|]}t|ywr/) _is_subtype).0r-basetypes r z_is_subtype..s>X;q(+Xs)rgtupleallrHr=)expectedrs `rr}r}s7(E">X>>> h % H*Xx*HHrceZdZdZdZy)_BaseTestCaseContextc||_yr/)r$)r!r$s rr"z_BaseTestCaseContext.__init__s "rc|jj|j|}|jj|r/)r$_formatMessagemsgr>)r! standardMsgrs r _raiseFailurez"_BaseTestCaseContext._raiseFailures1nn++DHHkBnn--c22rN)r rrr"rrrrrrs #3rrceZdZddZdZy)_AssertRaisesBaseContextNctj||||_||_|t j |}||_d|_d|_yr/) rr"rr$recompileexpected_regexobj_namer)r!rr$rs rr"z!_AssertRaisesBaseContext.__init__sJ%%dI6  "  %ZZ7N, rc t|j|jst|d|j|s=|j dd|_|r ttt|d|d}S|^}} |j|_ |5||i|dddd}y#t$rt||_ Y1wxYw#1swYd}yxYw#d}wxYw)Nz() arg 1 must be rz1 is an invalid keyword argument for this function) r}r _base_typerL_base_type_strr]rnextiterr rrKr')r!namerWrX callable_objs rhandlez_AssertRaisesBaseContext.handles  t}}doo>!%t':':!<==!::eT2#7;DL7I%LMMD#' L4 2 , 5 5 d-f-D " 2 #L 1  2D4DsTA6C<CB(C CC(CCCCC CCCr/)r rrr"rrrrrrs rrcFeZdZ eZdZdZdZee jZ y)_AssertRaisesContextz-an exception type or tuple of exception typesc|Sr/rr!s rrIz_AssertRaisesContext.__enter__s rc|p |jj}|jr,|j dj ||jn6|j dj |ntj|t||jsy|jd|_ |jy|j}|jt|s4|j dj |jt|y#t$rt|j}Y$wxYw)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rr rKr'rrformat traceback clear_framesr=with_traceback exceptionrsearchpattern)r!exc_type exc_valuetbexc_namers rrJz_AssertRaisesContext.__exit__s   .==11}}""#8#?#?@D $OP""?#9#9(#CD  " "2 &(DMM2"11$7    &,,$$S^4   9@@#++S^ = >+" .t}}- .sDD?>D?N) r rr BaseExceptionrrrIrJ classmethodro GenericAlias__class_getitem__rrrrrs,MJDN6$E$6$67rrc"eZdZ eZdZdZdZy)_AssertWarnsContextz(a warning type or tuple of warning typesc<ttjjD]}t |ddsi|_t jd|_|jj|_t jd|j|S)N__warningregistry__T)recordalways) listr(modulesvaluesr5rr6catch_warningswarnings_managerrI simplefilterr)r!vs rrIz_AssertWarnsContext.__enter__!syckk((*+Aq/6(*%,!) 7 7t D--779 h 6 rc|jj||||y |jj}d}|j D]}|j}t||js&||}|j%|jjt |s[||_ |j|_ |j|_ y|>|jdj|jj t ||j"r,|jdj||j"y|jdj|y#t$rt |j}YOwxYw)Nrz{} not triggered by {}z{} not triggered)rrJrr rKr'r6messagergrrwarningfilenamelinenorrrr)r!rrrrfirst_matchingmws rrJz_AssertWarnsContext.__exit__,s] &&xB?    *}}--HA Aa/%!"##/''..s1v6DLJJDM((DK   %   9@@((00#n2E G H ==   7>>x?C}} N O   188B C3 *4==)H *sE&&FFN)r rrWarningrrrIrJrrrrrsLJ?N  DrrceZdZdZy)_OrderedChainMapc#Kt}|jD]#}|D]}||vs|j||%ywr/)setmapsadd)r!seenmappingks r__iter__z_OrderedChainMap.__iter__Ps<uyyGD=HHQKG!s #AAN)r rrrrrrrrOsrrcreZdZ eZdZdZdZfdZdKdZ dZ dZ dZ e d Ze d Zd Zd Ze d Ze dZdZdZdZdZdZdZdZdZej:efdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dLdZ'd Z(e d!Z)d"Z*d#Z+d$Z,dLd%Z-dLd&Z.dLd'Z/d(Z0d)Z1d*Z2dMd+Z3dMd,Z4d-Z5dLd.Z6dLd/Z7dLd0Z8 dNd1Z9 dNd2Z:dMd3Z;d4ZdLd7Z?dLd8Z@dLd9ZAdLd:ZBdLd;ZCdLd<ZDdLd=ZEdLd>ZFdLd?ZGdLd@ZHdLdAZIdLdBZJdLdCZKdLdDZLdLdEZMdLdFZNdGZOdHZPdLdIZQdLdJZRxZSS)OTestCaseTiic@d|_g|_t| |i|y)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rOrWrX __class__s rrzTestCase.__init_subclass__s% %  !4262rc ||_d|_d|_ t||}|j|_g|_d|_ i|_ |jtd|jtd|jtd|jtd|jt d|jt"d y#t $r#|dk7rt d|jd|YwxYw) NzNo testrunTestzno such test method in : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr5__doc__rK ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr')r! methodName testMethods rr"zTestCase.__init__s  * ' 5 z2J#-"4"4D  %'!   '89   '89   (:;   &67   ,<=   &<=) 4Y&!~~z"344' 4s C)C;:C;c$ ||j|<yr/)r)r!typeobjrVs rrzTestCase.addTypeEqualityFuncs .6!!'*rcB |jj|||fyr/)rrUr!rVrWrXs r addCleanupzTestCase.addCleanups# K xv67rc0 t||jSr/)rRr)r!rMs r enterContextzTestCase.enterContexts b$//22rcB |jj|||fyr/)rrUrOrVrWrXs raddClassCleanupzTestCase.addClassCleanups" 4 ""HdF#;>2D4H4HIIrclt|t|urtS|j|jk(Sr/)rHNotImplementedrr!others r__eq__zTestCase.__eq__s/ :T%[ (! !##u'<'<<rrs r__repr__zTestCase.__repr__s"($*>*>@ @rc+JK |j|jjsdy|j}| t|}n|jj |}t ||||_ |jj|jd5dddd|jjs*|jj}|.|jr"t|jjrt||_y#1swYmxYw#||_wxYww)NT)r+) rrrrparams new_child_SubTestr.rrfailfastrr )r!rr$parent params_maprs rr+zTestCase.subTests ==  (N(N   >)&1J008J sJ7  #// t/LM==((--%&//%%.."!"DMML#DMs7A0D#3'DD A$DD# DD D  D#c |j}|||y#t$r/tjdt|j |YywxYw)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerKr6r7r8r9)r!rr)r+s r_addExpectedFailurezTestCase._addExpectedFailure'sR /!'!:!:  tX .  $ MM\( * F  d # $s 5AAc |j}||y#t$rXtjdt t d#t $r)|j |tjYYywxYwwxYw)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrKr6r7r8rr?r(r))r!rr.s r_addUnexpectedSuccesszTestCase._addUnexpectedSuccess1st '#)#>#>  ! & 8 MM_( * 8(d2% 8!!!$ 7 8 8s& #A8A.A40A83A44A8c |j}|||y#t$rtjdtYywxYw)Nz$TestResult has no addDuration method) addDurationrKr6r7r8)r!relapsedr1s r _addDurationzTestCase._addDuration@sA ' ,,K g &  * MM@( * *s #>>c$|jyr/)rrs r _callSetUpzTestCase._callSetUpIs  rcT|!tjd|dtdyy)NzFIt is deprecated to return a value that is not None from a test case (r) stacklevel)r6r7DeprecationWarning)r!methods r_callTestMethodzTestCase._callTestMethodLs3 8  MM((.xq23ERS U rc$|jyr/)rrs r _callTearDownzTestCase._callTearDownQs  rc||i|yr/rrs r _callCleanupzTestCase._callCleanupTs$!&!rc|4|j}t|dd}t|dd}| |nd}|j| t||j}t|jdds t|ddrQt|jddxs t|dd}t |||||j |||SSt|ddxs t|dd}t|}tj} ||_ |j|5|jddd|jrc||_|j|5|j|dddd|_|j|5|j!ddd|j#|j%|tj|z |jrO|r;|j&r|j)||j&n$|j+|n|j,||d|_d}d|_ |j |||SS#1swY9xYw#1swYxYw#1swYxYw#d|_d}d|_ wxYw#|j |||wwxYw)N startTestRun stopTestRunrjFrkrnrz)rr5 startTestrrr&stopTestrtime perf_counterrr.r5rrr;r= doCleanupsr3r r,r/r9) r!rrArBrskip_whyroutcome start_times rrunz TestCase.runWs >++-F"6>4@L!&->K'K4  t';';FM $DeL v&G**,J % ' --d3OO%4??0AG- 11$7,,Z8805G- 11$7**,8!!!&4+<+<+>+KM??("22 44VW=T=TU 66v>)))$/+/'!%  FOOD !& 'A438787"+/'!%  FOOD !& 'st A.J.;J.J+I3<,J(J: JJ +BJJ.3I=8JJ J JJJ++J..K c2 |jxs t}|jr[|jj\}}}|j |5|j |g|i|ddd|jr[|j S#1swY"xYwr/)rrrr]r.r?r)r!rIrVrWrXs rrGzTestCase.doCleanupss ---8:nn%)^^%7%7%9 "HdF))$/!!!( "HdF ?$)&)!! ?''..s||~> ?sA 6BBc&|j|i|Sr/)rK)r!rWkwdss r__call__zTestCase.__call__stxx&&&rc t||j}t|jdds t|ddr1t|jddxs t|dd}t||j |j ||j |jrB|jj\}}}|j|g|i||jrAyy)NrjFrkrn) r5rrr r5r;r=rr]r?)r!rrHrVrWrXs rdebugzTestCase.debugsDT4#7#78 DNN$7 ? J 3U ;0GLL":/FK 8$ $  Z( nn%)^^%7%7%9 "HdF D  h 8 8 8nnrc t|r/re)r!r:s rskipTestzTestCase.skipTestsvrc& |j|r/)r>)r!rs rfailz TestCase.fails7##C((rch |r/|j|dt|z}|j|y)Nz%s is not falserrr>r!exprrs r assertFalsezTestCase.assertFalses:1 %%c+>.$?GdGs$(cB t||}|jd||S)N assertWarnsrr)r!expected_warningrWrXrgs rrizTestCase.assertWarnss) 6&&6=~~mT6::rc( ddlm}||||dS)Nr_AssertLogsContextFno_logs_logrnr!loggerlevelrns r assertLogszTestCase.assertLogs.s ( -!$uEErc( ddlm}||||dS)NrrmTrorqrss r assertNoLogszTestCase.assertNoLogsFs -!$tDDrc t|t|urD|jjt|}|t|tr t ||}|S|j Sr/)rHrgetrgr'r5_baseAssertEqual)r!firstsecondasserters r_getAssertEqualityFunczTestCase._getAssertEqualityFuncOs` ;$v, &0044T%[AH#h,&tX6H$$$rct ||k(s2dt||z}|j||}|j|y)N%s != %s)r rr>)r!r|r}rrs rr{zTestCase._baseAssertEqualisFH$';E6'JJK%%c;7C'', ,rc@ |j||}||||y)N)r)r)r!r|r}rassertion_funcs r assertEqualzTestCase.assertEqualps' 44UFCuf#.rc ||k7s:|j|t|dt|}|j|y)N == rZ)r!r|r}rs rassertNotEqualzTestCase.assertNotEqualwsN %%c59I:CF:K,MNC'', ,rc  ||k(ry| | tdt||z }|9||kryt|dt|dt|dt|d}n=|d}t||dk(ryt|dt|d|dt|d}|j ||}|j |) N specify delta or places not bothz !=  within  delta ( difference)rz places (rLabsrroundrr>r!r|r}placesrdeltadiffrs rassertAlmostEqualzTestCase.assertAlmostEquals  F?   !3>? ?56>"  u}% &!% $ !K ~T6"a'% &!$ !K !!#{3##C((rc p | | tdt||z }|>||k(s||kDryt|dt|dt|dt|d}n6|d}||k(st||dk7ryt|dt|d|d}|j ||}|j |) Nrrrrrrrz placesrrs rassertNotAlmostEqualzTestCase.assertNotAlmostEquals   !3>? ?56>"  VO% &!% $ !K ~VOtV)<)A9B59I9B69J9?AK!!#{3##C((rc  |d|j}t||s |jd|dt|t||s"|jd|dt|d}d} t |}| t |}|||k(ryd|jft||zz}ttD]+} || } || } | | k7s|d | ft| | zzz }n ||k(r|t|t|k7ry||kDr%|d |||z fzz } |d |t||fzz }n)||kr$|d|||z fzz } |d |t||fzz }|} ddjtjt!j"|j%t!j"|j%z} |j'| | } |j)|| }|j+|y#t t f$r d|z}YwxYw#t t f$r d|z}YwxYw#t tt f$r|d| |fzz }YMwxYw#t tt f$r|d | |fzz }YswxYw#t tt f$r|d ||fzz }YEwxYw#t tt f$r|d||fzz }YjwxYw)NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r )r rgr>rlenrLNotImplementedError capitalizer rangemin IndexErrorrHjoindifflibndiffpprintpformat splitlines_truncateMessagerrX)r!seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualzTestCase.assertSequenceEquals   $--MdH-+++8)D/-KLLdH-+++8)D/-KLL'M  #t9D   '4y  t|0"--/1(t456I3tT?+ GE  GE E>"K#$$)=eU)K"K#MNI%,(DLX%5J$t*,d{+.;TD[-IJK K"A#'4:)>"?#@AI +.;TD[-IJK L"A#'4:)>"?#@AI   MM&...99; ...99; =>>++KA !!#{3 #K./ #B!#I #23 'G%'  '":/BC"N"#]!3#45I":/BC"O"#]!3#45I*":/BCK#259=4I#JKIK":/BCL#36:M5J#KLILsl- H; H!H<I"$JJ-HH!H98H9<II"JJJ*)J*-KKcn|j}|t||kr||zS|tt|zzSr/)maxDiffr DIFF_OMITTED)r!rrmax_diffs rrzTestCase._truncateMessage3s:<<  s4yH4T> !,T233rc8 |j|||tyN)r)rr)r!list1list2rs rrzTestCase.assertListEqual9s     sT Brc8 |j|||tyr)rr)r!tuple1tuple2rs rrzTestCase.assertTupleEqualEs     u Erc |j|} |j|}ssyg}|r2|j d|D]}|j t |r2|j d|D]}|j t |dj |} |j|j|| y#t$r}|jd|zYd}~d}~wt$r}|jd|zYd}~d}~wwxYw#t$r}|jd|zYd}~d}~wt$r}|jd|zYd}~:d}~wwxYw)Nz/invalid type when attempting set difference: %sz2first 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 ) differencerLrXrKrUreprrr) r!set1set2r difference1r- difference2linesitemrs rrzTestCase.assertSetEqualPsJ  P//$/K  Q//$/K {   LLE F# T$Z($  LLE F# T$Z($ii&  $%%c;785 M IIG!K L L P IIJQN O O P  M IIG!K L L Q IIKaO P P QsFCD DC** D6DD E% D:: E%E  E%c ||vr;t|dt|}|j|j||yy)N not found in rrXrr!member containerrrs rassertInzTestCase.assertIn{sCR  "2;F2C2;I2FHK IId))#{; < #rc ||vr;t|dt|}|j|j||yy)Nz unexpectedly found in rrs r assertNotInzTestCase.assertNotInsCV Y ;DV;L8A)8LNK IId))#{; < rc ||ur;t|dt|}|j|j||yy)Nz is not rr!expr1expr2rrs rassertIszTestCase.assertIssBR  ,5e,<-6u-=?K IId))#{; < rcn ||ur0dt|}|j|j||yy)Nzunexpectedly identical: rrs r assertIsNotzTestCase.assertIsNots7V E>:CE:JLK IId))#{; < rc |j|td|j|td||k7rdt||z}ddjt j t j|jt j|jz}|j||}|j|j||yy)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr ) assertIsInstancerr rrrrrrrrXr)r!d1d2rrrs rrzTestCase.assertDictEquals b$(LM b$(MN 8$';B'CCK499W]]!>>"-88:!>>"-88:&<==D// TBK IId))#{; < rc t|t|}} tj|}tj|}||k(ryt||}|r[d}|Dcgc]}d|z } }dj | } |j|| }|j||}|j|yy#t$rt ||}YuwxYwcc}w)NzElement counts were not equal: z First has %d, Second has %d: %rr ) r collectionsCounterrrLrrrrrX) r!r|r}r first_seq second_seq differencesrrrrs rassertCountEqualzTestCase.assertCountEquals !%U T&\:  F'' 2E ((4F .y*EK ;EWii&G// WEK%%c;7C IIcN  I1)ZHK IXs*B3 C3C  C c |j|td|j|td||k7rt||jkDst||jkDr|j ||||}|}|r|r|ddk7s|ddk7r*|dz }|dz }n|r|ddk7r|dz }n|r |ddk7r|dz }|j d}|j d}dt ||z}ddjtj||z} |j|| }|j|j||yy) NzFirst argument is not a stringzSecond argument is not a stringr T)keependsrrn) rr'r_diffThresholdr{rr rrrrrXr) r!r|r}rfirst_presplitsecond_presplit firstlines secondlinesrrs rrzTestCase.assertMultiLineEquals\; eS*JK fc+LM F?E T000F d111%%eVS9 #N$O9$r d(:"d*N#t+OF2J$.4'59,$&'22D2AJ)44d4CK%';E6'JJK"'''-- K"HIID// TBK IId))#{; <9 rc ||ks;t|dt|}|j|j||yy)Nz not less than rr!abrrs r assertLesszTestCase.assertLesss<Q1u3K IId))#{; < rcR |$d}|j|j||yy)Nzunexpectedly None)rXrrs rassertIsNotNonezTestCase.assertIsNotNones-6 ;-K IId))#{; < rc t||s2t|d|}|j|j||yy)Nz is not an instance of rgrrXrr!rCrOrrs rrzTestCase.assertIsInstance s= #s#;DS>3OK IId))#{; <$rc t||r2t|d|}|j|j||yy)Nz is an instance of rrs rassertNotIsInstancezTestCase.assertNotIsInstances;: c3 7@~sKK IId))#{; < rcD t|||}|jd||S)NassertRaisesRegexre)r!rfrrWrXrgs rrzTestCase.assertRaisesRegexs, ''94P~~14@@rcD t|||}|jd||S)NassertWarnsRegexrj)r!rkrrWrXrgs rrzTestCase.assertWarnsRegex&s, &&6nM~~0$??rc t|ttfrtj|}|j |s5d|j d|}|j||}|j|y)NzRegex didn't match: r) rgr'bytesrrrrrr>)r!textrrrs r assertRegexzTestCase.assertRegex9skK nsEl 3ZZ7N$$T*&&.K%%c;7C'', , +rc0 t|ttfrtj|}|j |}|rWd||j |jd|jd|}|j||}|j|y)NzRegex matched: z matches z in ) rgr'rrrrstartendrrr>)r!runexpected_regexrmatchrs rassertNotRegexzTestCase.assertNotRegexEsG &e 5!zz*:;  ''- U[[]UYY[1 ((K %%c;7C'', , r)rr/)NNNNN)Tr rrAssertionErrorr>rarrrr"rrrrrrrrrrrrrrrrrr"r0r1_subtest_msg_sentinelr+r,r/r3r5r;r=r?rKrGrOrRrTrVrXr]r_rrdrirvrxrr{rrrrrrrrrrrrrrrrrrrrrrrrrrrr  __classcell__rs@rrrYs@&KGN3 >@ 683== 77  VVaa#CJ= 8e@/##</ ''U "?B  ? ?'9")- - I*B;>F0E%4-/-AE $+)ZDH#'!)FaF4 C F)9V==== =@!=F= = = = = = == A @& - -rrcXeZdZ d fd ZdZdZdZdZdZdZ dZ d Z d Z xZ S) FunctionTestCasecbtt| ||_||_||_||_yr/)rrr" _setUpFunc _tearDownFunc _testFunc _description)r!testFuncrr descriptionrs rr"zFunctionTestCase.__init__^s/ .0%!'rc>|j|jyyr/)rrs rrzFunctionTestCase.setUpes ?? & OO  'rc>|j|jyyr/)rrs rrzFunctionTestCase.tearDownis    )     *rc$|jyr/)rrs rrzFunctionTestCase.runTestms  rc.|jjSr/)rr rs rrzFunctionTestCase.idps~~&&&rct||jstS|j|jk(xrO|j|jk(xr4|j |j k(xr|j |j k(Sr/)rgrrrrrrrs rrzFunctionTestCase.__eq__ssv%0! !%"2"227!!U%8%887~~07  E$6$66 7rctt||j|j|j|j fSr/)rrHrrrrrs rrzFunctionTestCase.__hash__|s7T$Z$2D2D^^T%6%689 9rc`t|jd|jjdS)Nrr)rrrr rs rrzFunctionTestCase.__str__s%$T^^4 NN335 5rcNdt|jd|jdS)Nr z tec=r!)rrrrs rr"zFunctionTestCase.__repr__s ( 8%)^^5 5rc|j |jS|jj}|xr"|jddj xsdSr )rrrr r r s rrz!FunctionTestCase.shortDescriptionsO    ($$ $nn$$1syyq)//19T9rr )r rrr"rrrrrrrr"rrrs@rrrUs:(!'7955:rrc<eZdZfdZdZdZdZdZdZxZ S)r&cnt|||_||_||_|j |_yr/)rr"_messager$r$r>)r!r$rr$rs rr"z_SubTest.__init__s1  " ) : :rctd)Nzsubtests cannot be run directly)rrs rrz_SubTest.runTests!"CDDrc`g}|jtur*|jdj|j|jrPdj d|jj D}|jdj|dj |xsdS)Nz[{}]z, c3FK|]\}}dj||yw)z{}={!r}N)r)r~rrs rrz+_SubTest._subDescription..s)$31FQ  A&1s!z({}) z ())r&rrUrr$ritems)r!parts params_descs r_subDescriptionz_SubTest._subDescriptions == 5 5 LLt}}5 6 ;;))$3"kk//1$33K LL{3 4xx/-/rcrdj|jj|jSNz{} {})rr$rr.rs rrz _SubTest.ids)~~dnn//143G3G3IJJrc8 |jjSr/)r$rrs rrz_SubTest.shortDescriptions ~~..00rcVdj|j|jSr0)rr$r.rs rrz_SubTest.__str__s ~~dnnd.B.B.DEEr) r rrr"rr.rrrrrs@rr&r&s$;E 0K1 Frr&)2r(rhrrrr6rr0rrErornrutilrrrrr __unittestobjectrrr^r rrrr&r*rDrRrTrYr[rarqrvrxr r}rrrrChainMaprrrr&rrrr7s4   ?? 7 y)  &8v&8R%, 6 0  (I 33'3'T$83$8N1D21Dh{++x-vx-x7:x7:t!Fx!FrPK!ծO4O4&__pycache__/main.cpython-312.opt-2.pycnu[ ֦i.~ ddlZddlZddlZddlZddlmZmZddlmZdZ dZ dZ dZ d Z d Zd ZGd d eZeZy)N)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase c,tjj|r|jj drtjj |rttjj |tj}tjj |s|jtjr|S|}tjj|ddjddjddS|S)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths &/usr/lib64/python3.12/unittest/main.py _convert_namers  ww~~d 5 5e < 77== wwtRYY[9Hww}}X&(*=*=bii*H Dww%cr*224=EEc3OO Kc>|Dcgc] }t|c}Scc}wN)r)namesrs r_convert_namesr!/s,1 2EDM$ E 22 2scd|vrd|z}|S)N*z*%s*)patterns r_convert_select_patternr&3s '>7" Nrc eZdZ dZdZdxZxZxZxZxZ Z dZ dddde jddddddf ddddZddZd Zd Zdd Zd Zd ZdZdZddZdZy) TestProgramNr__main__TF) tb_locals durationsc >t|trEt||_|j dddD]}t |j||_n||_|t j}||_||_ | |_ ||_ | |_ | |_ | |_| t jsd|_n| |_||_||_||_t(j*j-|d|_|j1||j3y)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr*r+ warnoptionswarnings defaultTest testRunner testLoaderr rbasenameprogName parseArgsrunTests)selfr1r=r5r>r?r6r9r7r8r:r<r*r+parts r__init__zTestProgram.__init__Cs fc "$V,DK S)!"-%dkk48 .!DK <88D   $" ""  COO&DM%DM&$$((a1  t rctjdt|r t||j|j |j tjdy)NzHTestProgram.usageExit() is deprecated and will be removed in Python 3.13) r<warnDeprecationWarningprint_discovery_parser_initArgParsers _print_helpr4r6)rDmsgs r usageExitzTestProgram.usageExitksP 01C E  #J  ! ! )  "   rcV|j\t|jjttd|j iz|j jyt|jjttd|j izy)Nprog) r1rK _main_parser format_help MAIN_EXAMPLESrArL print_helpMODULE_EXAMPLES)rDargskwargss rrNzTestProgram._print_helpusx ;;  $##//1 2 -64=="99 :  " " - - / $##//1 2 /VT]]$;; ""48,    ( (ab4 8::""2&    ( (ab4 8 ::+DJJ7DN:%"    %!DN ((# ."..0DN!$"2"23DN rc|jr|j|j_|rM| |jn|}|j|j|j|j |_y|j+|jj|j|_y|jj|j|j|_yr) testNamePatternsr?r[startr%toptestr`loadTestsFromModuler1loadTestsFromNames)rDfrom_discoveryLoaderrs rrczTestProgram.createTestss  /3/D/DDOO , (.T__FHF' DLL$((KDI ^^ #;;DKKHDI::4>>;?;;HDIrc||j}|j||_|j||_yr)_getParentArgParser_getMainArgParserrS_getDiscoveryArgParserrL)rD parent_parsers rrMzTestProgram._initArgParserss6002  22=A!%!tjd}|jdddddd |jd d ddd d |jdddd|jddtddd|j|jdddddd|_|j |jdddddd|_|j |jd d!d"dd#d|_|j!|jd$d%d&td'(g|_|S))NF)add_helpz-vz --verboser9 store_constrHzVerbose output)destactionconsthelpz-qz--quietrz Quiet outputz--localsr* store_truez"Show local variables in tracebacks)rurvrxz --durationsr+Nz+Show the N slowest test cases (N=0 for all))rutyper-metavarrxz-fz --failfastr7zStop on first fail or errorz-cz--catchr8z'Catch Ctrl-C and display results so farz-bz--bufferr:z%Buffer stdout and stderr during testsz-kreappendz.Only run tests which match the given substring)rurvr{rx) argparseArgumentParser add_argumentintr7r8r:rer&)rDparsers rrnzTestProgram._getParentArgParsersr((%8D+K#0!1  3 D)+#0!/  1 J[#/!E  G M #$(#!N  P ==   l'3%B  D"DM ?? "   il'3%N  P$DO ;;    jx'3%L  N DK  (   +='/6M%U  W%'D ! rctj|g}|j|_|j|_|j ddd|S)Nparentsr_r#z?a list of any number of test modules, classes and test methods.)nargsrx)r~rrArRrNrVr)rDparentrs rrozTestProgram._getMainArgParsersP((&:mm  ,,G3"8  9 rcXtj|g}d|jz|_d|_|j dddd|j d d d d |j d ddddD]3}|j |dtj tj 5|S)Nrz %s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrfz*Directory to start discovery ('.' default))rurxz-pz --patternr%z+Pattern to match tests ('test*.py' default)z-tz--top-level-directoryrgzrTextTestRunnerr.r{r9r7r:r<r*r+ TypeErrorrunrhresultr6testsRunr\skippedr4_NO_TESTS_EXITCODE wasSuccessful)rDr>s rrCzTestProgram.runTestssa ??   ?? "$33DO doot , / I!%4>>:>--8< :>--;?>>;?>> "1"KJ"J nnTYY/ 99{{##q(S1D1D-E-J+,**,  !I!%4>>:>--8< :>--"1"IJI  /!__.  /s,AE<C" &P=: HL $L * =!rr()r4r~r r<rrsignalsr __unittestrrUrWrr!r&objectr(mainr$rrrsX  #    3 g&gTrPK!iG<G<!__pycache__/suite.cpython-312.pycnu[ ֦i4dZddlZddlmZddlmZdZdZGdd eZGd deZ Gd d eZ d Z GddeZ y) TestSuiteN)case)utilTc.t||d}|y)NcyNr '/usr/lib64/python3.12/unittest/suite.pyz!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s 64 .DFr cXeZdZdZdZddZdZdZdZdZ dZ d Z d Z d Z d Zd Zy) BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. TcBg|_d|_|j|yNr)_tests_removed_testsaddTests)selftestss r __init__zBaseTestSuite.__init__s  er c`dtj|jdt|dS)N)rstrclass __class__listrs r __repr__zBaseTestSuite.__repr__s"&--"?dLLr cht||jstSt|t|k(Sr ) isinstancer!NotImplementedr")rothers r __eq__zBaseTestSuite.__eq__s)%0! !DzT%[((r c,t|jSr )iterrr#s r __iter__zBaseTestSuite.__iter__"sDKK  r cX|j}|D]}|s||jz }|Sr )rcountTestCases)rcasestests r r.zBaseTestSuite.countTestCases%s4##D,,.. r c t|s#tdjt|t |t r+t |tjtfr td|jj|y)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr&type issubclassrTestCaserrappendrr0s r addTestzBaseTestSuite.addTest,sj~077T CD D dD !j26--1K'M?@ @ 4 r cjt|tr td|D]}|j|y)Nz0tests must be an iterable of tests, not a string)r&strr3r;)rrr0s r rzBaseTestSuite.addTests6s. eS !NO OD LL r ct|D]:\}}|jr|S|||js*|j|<|Sr ) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr0s r runzBaseTestSuite.run<sL$T?KE4    L}}''. +  r c |j|}t|dr#|xj|jz c_d|j|<y#t$rYywxYw)z2Stop holding a reference to the TestCase at index.r.N)rhasattrrr.r3)rrDr0s r rBz BaseTestSuite._removeTestAtIndexEs^ &;;u%Dt-.##t':':'<<#!%DKK    sA AAc&|j|i|Sr rE)rargskwdss r __call__zBaseTestSuite.__call__Sstxx&&&r c2|D]}|jy)7Run the tests without collecting errors in a TestResultN)debugr:s r rOzBaseTestSuite.debugVsD JJLr N)r )__name__ __module__ __qualname____doc__rArr$r)r,r.r;rrErBrLrOr r r rrsDH M) !!  &'r rcPeZdZdZd dZdZdZdZdZ d dZ d d Z d Z d Z y)raA test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. c4d}t|dddur dx|_}t|D]\}}|jrnt |rl|j |||j |||j|||j|_ t|jdds t|ddr|s ||n|j|js|j||r*|j d||j|d|_|S)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrVr?r@ _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr!_previousTestClassrOrArB_handleModuleTearDown)rrCrOtopLevelrDr0s r rEz TestSuite.runfs 6,e 4 =04 4F "X$T?KE4  4 ++D&9))$7&&tV4,0NN)DNN,?GF$8%@V  }}''.)+,   ' 'f 5  & &v .%*F " r c<t}|j|dy)rNTN) _DebugResultrE)rrOs r rOzTestSuite.debugs r ct|dd}|j}||k(ry|jryt|ddryd} d|_t|dd}t|dd}|Wt |d ||r3|1||jD]} |j|| dd | t |d yy#t$rYwxYw#t $r^}t|trd} d|_n#t$rYnwxYwtj|} |j||d| Yd}~d}~wwxYw#t |d wxYw) Nr]__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) rr!rXrWr3r Exceptionr&rarr "_createClassOrModuleLevelExceptiontearDown_exceptions) rr0rC previousClass currentClassfailedrdree classNameexc_infos r r\zTestSuite._handleClassSetUps~( !,0A4H  ! FN 3 : GLo9#%$0$D$D?? & \9%-@/%E  (891 "   ! G!&,7!F9= 6$ $ l ;I;;FA D( C>- B98B9< C;,C61D(6C;;D(> D%D D( D%%D((D6Nc<|d|d}|j||||y)Nz ())_addClassOrModuleLevelException)rrCexc method_namerrh errorNames r rkz,TestSuite._createClassOrModuleLevelExceptions("m2fXQ/  ,,VS)TJr ct|}t|dd}|-t|tjr||t |y|s%|j |tjy|j ||y)NaddSkip) _ErrorHolderrr&rSkipTestr=addErrorrxrr)rrC exceptionrrherrorrs r rz)TestSuite._addClassOrModuleLevelExceptions`Y'&)T2  :i#G E3y> *s||~6t,r c$|j|}|y|jry tj|}t |d t |dd}| | tjt |dy#t$rYywxYw#t$r/}t|tr|j||d|Yd}~dd}~wwxYw#t$r/}t|tr|j||d|Yd}~d}~wwxYw#t |dwxYw)NrftearDownModuleri) rurXrxryrzrrrjr&rarkrr{)rrCrtr}rrps r r^zTestSuite._handleModuleTearDowns+226:  !   $ $  [[0F / 6$V-=tDN)L"$ H%%' F$4 51   !L!&,7;;FA9D>CD C>%C94D9C>>DDct|dd}|j}||k(s|yt|ddryt|ddryt|ddryt|dd}t|dd}||yt|d | ||[||jD]E} t |t r| d t j|}|j|| d d|| Gt|d y#t$rD}t |t rt j|}|j||d|Yd}~d}~wwxYw#t|d wxYw) Nr]rWFrXrc tearDownClassrerfrrgri) rr!rrjr&rarr rkrl) rr0rCrmrnrrerprqrrs r rZz TestSuite._tearDownPreviousClassst(rsW    IFIXi6 i6X$6$L6r PK!^繳,__pycache__/async_case.cpython-312.opt-1.pycnu[ ֦ikJddlZddlZddlZddlZddlmZdZGddeZy)N)TestCaseTceZdZdfd ZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd Zdfd ZfdZdZxZS)IsolatedAsyncioTestCasecdt||d|_tj|_yN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s ,/usr/lib64/python3.12/unittest/async_case.pyr z IsolatedAsyncioTestCase.__init__$s) $"#.#;#;#= c Kywrrs r asyncSetUpz"IsolatedAsyncioTestCase.asyncSetUp)  c Kywrrrs r asyncTearDownz%IsolatedAsyncioTestCase.asyncTearDown,rrc0|j|g|i|yr) addCleanuprfuncargskwargss raddAsyncCleanupz'IsolatedAsyncioTestCase.addAsyncCleanup/s $1&1rc Kt|} |j}|j}||d{}|j||ddd|S#t$r(t d|j d|j ddwxYw7Ow)zEnters the supplied asynchronous context manager. If successful, also adds its __aexit__ method as a cleanup function and returns the result of the __aenter__ method. '.zC' object does not support the asynchronous context manager protocolN)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r")rcmclsenterexitresults renterAsyncContextz)IsolatedAsyncioTestCase.enterAsyncContext>s2h 'NNE==D Ry T2tT48  'a/q1A1A0BCTU"& ' '!s% BA BBB1A??Bc|jj|jj|j|j |j yr)r get_looprrunsetUp _callAsyncrrs r _callSetUpz"IsolatedAsyncioTestCase._callSetUpRs> $$&   $$TZZ0 (rch|j|!tjd|dtdyy)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethodz'IsolatedAsyncioTestCase._callTestMethodZs<    ' 3 MM((.xq23ERS U 4rc|j|j|jj|jyr)r7rrr5tearDownrs r _callTearDownz%IsolatedAsyncioTestCase._callTearDown_s, **+   $$T]]3rc0|j|g|i|yr)r=)rfunctionr r!s r _callCleanupz$IsolatedAsyncioTestCase._callCleanupcsX777rc\|jj||i||jSN)context)r r5rrs rr7z"IsolatedAsyncioTestCase._callAsyncfs8""&& $ !& !,,'  rctj|r-|jj||i||jS|jj|g|i|SrJ)inspectiscoroutinefunctionr r5rrs rr=z'IsolatedAsyncioTestCase._callMaybeAsyncnsi  & &t ,&&**d%f%00+  04++//FtFvF Frc>tjd}||_y)NT)debug)asyncioRunnerr rrunners r_setupAsyncioRunnerz+IsolatedAsyncioTestCase._setupAsyncioRunnerxsd+$rc<|j}|jyr)r closerSs r_tearDownAsyncioRunnerz.IsolatedAsyncioTestCase._tearDownAsyncioRunner}s$$ rc|j t| ||jS#|jwxYwr)rUr r5rX)rr1rs rr5zIsolatedAsyncioTestCase.runs9   " *7;v&  ' ' )D ' ' )s 2Acb|jt| |jyr)rUr rPrX)rrs rrPzIsolatedAsyncioTestCase.debugs$   "   ##%rc>|j|jyyr)r rXrs r__del__zIsolatedAsyncioTestCase.__del__s    *  ' ' ) +r)runTestr)__name__r+r,r rrr"r2r8rBrErHr7r=rUrXr5rPr\ __classcell__)rs@rrr sU4>    2()U 48 G% *& *rr)rQr rMr>caser __unittestrrrrrbs'  E*hE*rPK!&__pycache__/_log.cpython-312.opt-2.pycnu[ ֦i ddlZddlZddlmZejdddgZGddej ZGd d eZy) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc eZdZ dZdZdZy)_CapturingHandlercdtjj|tgg|_yN)loggingHandler__init__rwatcherselfs &/usr/lib64/python3.12/unittest/_log.pyrz_CapturingHandler.__init__s"  &&r2. cyr rs rflushz_CapturingHandler.flushs rc|jjj||j|}|jjj|yr )rrappendformatr)rrecordmsgs remitz_CapturingHandler.emits@ ##F+kk&! ""3'rN)__name__ __module__ __qualname__rrrrrrr r s/ (rr c$eZdZ dZdZdZdZy)_AssertLogsContextz"%(levelname)s:%(name)s:%(message)sctj||||_|r&tjj |||_ntj|_d|_||_ yr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser#r&r(s rrz_AssertLogsContext.__init__!sP%%dI6&  --11%?DJ DJ rc|t|jtjr|jx}|_n&tj |jx}|_tj |j}t}|j|j|j||j|_ |jdd|_|j|_|j |_|g|_ |j|jd|_|j$ry|jS)NF) isinstancer#r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr& setFormatterrhandlers old_handlers old_level propagate old_propagater()rr- formatterhandlers r __enter__z_AssertLogsContext.__enter__+s d&& 7#'#3#3 3FT[#*#4#4T5E5E#F FFT[%%d&9&9: #%$Y' "OOA.#--") #  << rcr|j|j_|j|j_|jj |j |y|jrXt|jjdkDr5|jdj|jjyyt|jjdk(rS|jdjtj|j |jj"yy)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r4r-r3r7r6r1r5r(lenrr _raiseFailurerrr getLevelNamer&name)rexc_type exc_valuetbs r__exit__z_AssertLogsContext.__exit__?s#00  $ 2 2  T^^,   <<4<<''(1,""188 ++-4<<''(A-""CVG00N>NOQ.rN)rrrr0rr:rCrrrr!r!s@9N(Qrr!) r collectionscaser namedtuplerr r r!rrrrGsM&)+(():*3X)>@(($:Q-:QrPK!)__pycache__/signals.cpython-312.opt-1.pycnu[ ֦ic zddlZddlZddlmZdZGddeZejZdZ dZ da dZ d d Z y) N)wrapsTceZdZdZdZy)_InterruptHandlercd|_||_t|trT|tj k(rtj }||_ y|tjk(r d}||_ ytd||_ y)NFcyN) unused_signum unused_frames )/usr/lib64/python3.12/unittest/signals.pydefault_handlerz3_InterruptHandler.__init__..default_handlerszYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr )selfr s r __init__z_InterruptHandler.__init__ sw / os +&..0"("<"< /!FNN2 / !233 /rctjtj}||ur|j|||jr|j||d|_t j D]}|jy)NT)r getsignalSIGINTr r_resultskeysstop)rsignumframeinstalled_handlerresults r __call__z_InterruptHandler.__call__sh",,V]]; D (   / ;;   / mmoF KKM&rN)__name__ __module__ __qualname__rr$r rr rr s /$ rrcdt|<y)N)rr#s r registerResultr+*s HVrc@ttj|dSr)boolrpopr*s r removeResultr/-s  VT* ++rctWtjtj}t |atjtjtyyr)_interrupt_handlerrrrr)r s r installHandlerr21s?! **6==9.? fmm%78"rctfd}|St3tjtjtjyy)Nc tjtj}t |i|tjtj|S#tjtj|wxYwr)rrr removeHandler)argskwargsinitialmethods r innerzremoveHandler..inner;sS&&v}}5G O 6t.v. fmmW5 fmmW5s A&B)rr1rrr)r9r:s` r r5r59sL  v 6  6 % fmm%7%H%HI&rr)rweakref functoolsr __unittestobjectrWeakKeyDictionaryrr+r/r1r2r5r rr r@sO   @ %7 $ $ &,9JrPK!@M@M@(__pycache__/runner.cpython-312.opt-1.pycnu[ ֦i(dZddlZddlZddlZddlmZddlmZddlm Z dZ Gdd e Z Gd d ejZGd d e Zy)z Running testsN)result)_SubTest)registerResultTc$eZdZdZdZdZddZy)_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodc||_yN)stream)selfr s (/usr/lib64/python3.12/unittest/runner.py__init__z_WritelnDecorator.__init__s  cL|dvr t|t|j|S)N)r __getstate__)AttributeErrorgetattrr )r attrs r __getattr__z_WritelnDecorator.__getattr__s' - - & &t{{4((rNcL|r|j||jdyN )write)r args r writelnz_WritelnDecorator.writelns  JJsO 4rr )__name__ __module__ __qualname____doc__rrrrr rrsJ) rrceZdZdZdZdZddfd ZdZfdZd Z fd Z fd Z fd Z fd Z fdZfdZfdZdZdZxZS)TextTestResultzhA test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------N durationsctt| |||||_|dkD|_|dk(|_||_d|_||_y)zwConstruct a TextTestResult. Subclasses should accept **kwargs to ensure compatibility as the interface changes.rTN) superr"rr showAlldots descriptions_newliner$)r r r) verbosityr$ __class__s r rzTextTestResult.__init__&sK nd,V\9M  1} N ( "rc|j}|jr|rdjt||fSt|Sr)shortDescriptionr)joinstr)r testdoc_first_lines r getDescriptionzTextTestResult.getDescription1s=..0   99c$i89 9t9 rctt| ||jrg|jj |j ||jj d|jjd|_yy)N ... F) r&r" startTestr'r rr3flushr*r r1r,s r r6zTextTestResult.startTest8sd nd-d3 << KK  d11$7 8 KK  g & KK   !DM rct|t}|s |jr|js|jj |r|jj d|jj |j ||jj d|jj ||jjd|_y)Nz r5T) isinstancerr*r rrr3r7)r r1status is_subtests r _write_statuszTextTestResult._write_status@sh/ == ##% !!$' KK  d11$7 8 KK  g & F#  rc||jr?t|d|jr|j|dn|j|dnv|jrjt|d|jr|j j dn|j j d|j jtt|+|||y)NrFAILERRORFE) r' issubclassfailureExceptionr=r(r rr7r&r" addSubTest)r r1subtesterrr,s r rEzTextTestResult.addSubTestMs ?||c!fg&>&>?&&w7&&w8c!fg&>&>?KK%%c*KK%%c* !!# nd.tWcBrctt| ||jr|j |dy|j r6|j jd|j jyy)Nok.) r&r" addSuccessr'r=r(r rr7r8s r rKzTextTestResult.addSuccess\sW nd.t4 <<   tT * YY KK  c " KK   rctt| |||jr|j |dy|j r6|j jd|j jyy)Nr@rB) r&r"addErrorr'r=r(r rr7r r1rGr,s r rMzTextTestResult.addErrordsY nd,T37 <<   tW - YY KK  c " KK   rctt| |||jr|j |dy|j r6|j jd|j jyy)Nr?rA) r&r" addFailurer'r=r(r rr7rNs r rPzTextTestResult.addFailurelsY nd.tS9 <<   tV , YY KK  c " KK   rctt| |||jr"|j |dj |y|j r6|jjd|jjyy)Nz skipped {0!r}s) r&r"addSkipr'r=formatr(r rr7)r r1reasonr,s r rSzTextTestResult.addSkiptsd nd+D&9 <<   t_%;%;F%C D YY KK  c " KK   rc6tt| |||jr6|jj d|jj y|jr6|jjd|jj yy)Nzexpected failurex) r&r"addExpectedFailurer'r rr7r(rrNs r rXz!TextTestResult.addExpectedFailure|sl nd6tSA << KK   2 3 KK    YY KK  c " KK   rc4tt| ||jr6|jj d|jj y|jr6|jjd|jj yy)Nzunexpected successu) r&r"addUnexpectedSuccessr'r rr7r(rr8s r r[z#TextTestResult.addUnexpectedSuccesssj nd8> << KK   4 5 KK    YY KK  c " KK   rc|js |jr4|jj|jj |j d|j |j d|jt|dd}|rt|jj|j|D]/}|jjd|j|1|jj yy)Nr@r?unexpectedSuccessesr zUNEXPECTED SUCCESS: ) r(r'r rr7printErrorListerrorsfailuresr separator1r3)r r]r1s r printErrorszTextTestResult.printErrorss 99 KK   ! KK    GT[[1 FDMM2%d,A2F  KK   0+ ##&:4;N;Nt;T:U$VW, KK    rcz|D]\}}|jj|j|jj|d|j||jj|j|jjd|z|jj y)Nz: z%s)r rrar3 separator2r7)r flavourr_r1rGs r r^zTextTestResult.printErrorListsID# KK   0 KK  GD4G4G4M N O KK   0 KK  s + KK     r)rrrrrardrr3r6r=rErKrMrPrSrXr[rbr^ __classcell__)r,s@r r"r"sYJJEI #"  C         rr"c:eZdZdZeZ d ddddZdZdZdZ y) TextTestRunnerzA test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. NF) tb_localsr$c|tj}t||_||_||_||_||_||_| |_ ||_ |||_ yy)zConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysstderrrr r)r+failfastbufferrir$warnings resultclass) r r r)r+rmrnrprorir$s r rzTextTestRunner.__init__sc >ZZF'/ ("   ""   "*D  #rc |j|j|j|j|jS#t $r4|j|j|j|jcYSwxYw)Nr#)rpr r)r+r$ TypeError)r s r _makeResultzTextTestRunner._makeResultss 4##DKK1B1B$(NNdnn$N N 4##DKK1B1B$(NN4 4 4sz0TextTestRunner._printDurations..sQqTrT)keyreverserzSlowest test durationsrdFgMbP?z%.3fs10 zA (durations < 0.001s were hidden; use -v to show these durations))collectedDurationssortedr$r rhasattrrdr+)r rlshiddenr1elapseds r _printDurationszTextTestRunner._printDurationss((  F--> " >>A OT^^$B 45 6< ( KK   1 1 2MD'~~!go KK  g.? F G   KK  !B C KK   #rc|j}t||j|_|j|_|j|_t j 5|j rt j|j tj}t|dd}|| ||t|dd}|| tj}dddz }|j|j|j|t|dr%|jj!|j"|j$}|jj!d||dk7xrdxsd|fz|jj!d x} x} } t't(|j*|j,|j.f} | \} } } g} |j2sr|jj5d t)|j6t)|j8}}|r| j;d |z|rS| j;d |zn>|d k(r| s|jj5d n|jj5d| r| j;d| z| r| j;d| z| r| j;d| z| r/|jj!ddj=| dn|jj5d|jj?|S#t|dd}||wwxYw#1swYxYw#t0$rYwxYw)z&Run the given test case or test suite. startTestRunN stopTestRunrdzRan %d test%s in %.3fsrrRr|rFAILEDz failures=%dz errors=%dz NO TESTS RANOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rsrrmrnrirocatch_warnings simplefiltertime perf_counterrrbr$rrr rrdtestsRunmaplenexpectedFailuresr]skippedr wasSuccessfulrr`r_appendr/r7)r r1r startTimerrstopTime timeTakenrun expectedFailsr]rresultsinfosfailederroreds r rzTextTestRunner.runs !!#v--  >>  $ $ &}}%%dmm4))+I"6>4@L' "V %fmTB *M((*H'y(  >> %   ( 6< ( KK   1 1 2oo 4 #("2s"8b)DE F 899 9+g B# 7 7 & : : & 01G ;B 7M.#v##% KK  h '!&//2C 4FGF ]V34 [723 AXg KK  n - KK  d #  LL/ 0  LL/-? @  LL25HH I  KK  499U+; = > KK  d #  e&fmTB *M+' &B   s7#AM2:M+M221M?M//M22M<? N  N )NTrFFNN) rrrrr"rprrsrrr rr rhrhs3 !KABJN+#t+*4$,Drrh)rrkrror|rcasersignalsr __unittestobjectr TestResultr"rhr rr rsN #     C V&&C L@V@rPK!^|FF __pycache__/_log.cpython-312.pycnu[ ֦i ddlZddlZddlmZejdddgZGddej ZGd d eZy) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc"eZdZdZdZdZdZy)_CapturingHandlerzM A logging handler capturing all (raw and formatted) logging output. cdtjj|tgg|_yN)loggingHandler__init__rwatcherselfs &/usr/lib64/python3.12/unittest/_log.pyrz_CapturingHandler.__init__s"  &&r2. cyr rs rflushz_CapturingHandler.flushs rc|jjj||j|}|jjj|yr )rrappendformatr)rrecordmsgs remitz_CapturingHandler.emits@ ##F+kk&! ""3'rN)__name__ __module__ __qualname____doc__rrrrrrr r s/ (rr c&eZdZdZdZdZdZdZy)_AssertLogsContextz6A context manager for assertLogs() and assertNoLogs() z"%(levelname)s:%(name)s:%(message)sctj||||_|r&tjj |||_ntj|_d|_||_ yr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser$r'r)s rrz_AssertLogsContext.__init__!sP%%dI6&  --11%?DJ DJ rc|t|jtjr|jx}|_n&tj |jx}|_tj |j}t}|j|j|j||j|_ |jdd|_|j|_|j |_|g|_ |j|jd|_|j$ry|jS)NF) isinstancer$r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr' setFormatterrhandlers old_handlers old_level propagate old_propagater))rr. formatterhandlers r __enter__z_AssertLogsContext.__enter__+s d&& 7#'#3#3 3FT[#*#4#4T5E5E#F FFT[%%d&9&9: #%$Y' "OOA.#--") #  << rcr|j|j_|j|j_|jj |j |y|jrXt|jjdkDr5|jdj|jjyyt|jjdk(rS|jdjtj|j |jj"yy)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r5r.r4r8r7r2r6r)lenrr _raiseFailurerrr getLevelNamer'name)rexc_type exc_valuetbs r__exit__z_AssertLogsContext.__exit__?s#00  $ 2 2  T^^,   <<4<<''(1,""188 ++-4<<''(A-""CVG00N>NOQ.rN)rrrr r1rr;rDrrrr"r"s@9N(Qrr") r collectionscaser namedtuplerr r r"rrrrHsM&)+(():*3X)>@(($:Q-:QrPK!D11"__pycache__/result.cpython-312.pycnu[ ֦i#`dZddlZddlZddlZddlmZddlmZdZdZ dZ d Z Gd d e Z y) zTest result objectN)utilwrapsTc.tfd}|S)NcVt|ddr|j|g|i|S)NfailfastF)getattrstop)selfargskwmethods (/usr/lib64/python3.12/unittest/result.pyinnerzfailfast..inner s- 4U + IIKd(T(R((r)rrs` rr r s  6])) Lrz Stdout: %sz Stderr: %sceZdZdZdZdZdZddZdZdZ dZ dZ d Z d Z d Zed Zed ZdZdZdZdZedZdZdZdZdZdZdZdZdZy) TestResultaHolder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. NFcd|_g|_g|_d|_g|_g|_g|_g|_d|_d|_ d|_ d|_ d|_ tj|_tj |_d|_y)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccessescollectedDurations shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__zTestResult.__init__&s     "#% "$ "" #  # "rcy)z#Called by TestRunner after test runNr s r printErrorszTestResult.printErrors8rc\|xjdz c_d|_|jy)z-Called when the given test is about to be runrFN)rr' _setupStdoutr tests r startTestzTestResult.startTest;s$  " rc|jri|j2tj|_tj|_|jt _|jt _yy)N)rr!ioStringIOr r"r#r%r.s rr2zTestResult._setupStdoutAsP ;;""*&(kkm#&(kkm#,,CJ,,CJ rcy)zpCalled once before any tests are executed. See startTest for a method called before each test. Nr-r.s r startTestRunzTestResult.startTestRunIr0rc2|jd|_y)z'Called when the given test has been runFN)_restoreStdoutr'r3s rstopTestzTestResult.stopTestOs "rc|jrQ|jrtjj }tj j }|r8|j ds|dz }|jjt|z|r8|j ds|dz }|jjt|z|jt_|jt_|jjd|jj|jjd|jjyy)N r)rr'r"r#getvaluer%endswithr$write STDOUT_LINEr& STDERR_LINEr seektruncater!)r outputerrors rr<zTestResult._restoreStdoutTs ;;!!,,. ++-!??40$))// f0DE >>$/ ))// e0CD..CJ..CJ    $ $Q '    ( ( *    $ $Q '    ( ( *% rcy)zmCalled once after all tests are executed. See stopTest for a method called after each test. Nr-r.s r stopTestRunzTestResult.stopTestRunir0rcl|jj||j||fd|_y)zmCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). TN)rappend_exc_info_to_stringr'r r4errs raddErrorzTestResult.addErroros0 D$":":3"EFG!rcl|jj||j||fd|_y)zdCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)rrLrMr'rNs r addFailurezTestResult.addFailurews0 dD$<$|jj||fy)zCalled when a test is skipped.N)rrL)r r4reasons raddSkipzTestResult.addSkips T6N+rc^|jj||j||fy)z/Called when an expected failure/error occurred.N)rrLrMrNs raddExpectedFailurezTestResult.addExpectedFailures+ $$ 4++C6 7 9rc:|jj|y)z5Called when a test was expected to fail, but succeed.N)rrLr3s raddUnexpectedSuccesszTestResult.addUnexpectedSuccesss   ''-rcjt|dr'|jjt||fyy)zCalled when a test finished to run, regardless of its outcome. *test* is the test case corresponding to the test method. *elapsed* is the time represented in seconds, and it includes the execution of cleanup functions. rN)hasattrrrLstr)r r4elapseds r addDurationzTestResult.addDurations1 4- .  # # * *CIw+? @ /rct|jt|jcxk(xrdk(ncxr't|d xst|jdk(S)z/Tells whether or not this result was a success.rr)lenrrrbrr.s r wasSuccessfulzTestResult.wasSuccessfulsS T]]#s4;;'7<1<5T#8994T--.!3 6rcd|_y)z+Indicates that the tests should be aborted.TN)rr.s rr zTestResult.stops rc"|\}}}|j||||}tj||||jd}t |j }|j rtjj}tjj} |r.|jds|dz }|jt|z| r.| jds| dz } |jt| zdj|S)z>Converts a sys.exc_info()-style tuple of values into a string.T)capture_localscompactr?)_clean_tracebacks tracebackTracebackExceptionrlistformatrr"r#r@r%rArLrCrDjoin) r rOr4exctypevaluetbtb_emsgLinesrGrHs rrMzTestResult._exc_info_to_strings   # #GUB =++ UB>>49 & ;;ZZ((*FJJ'')Et,dNF f 45~~d+TME e 34wwx  rcd}d}|||fg}t|h}|r|j\}}}|r1|j|r |j}|r|j|r ||jur|j ||r|}d}n||_|o|j|jfD]T} | t| |vs|jt| | | j f|jt| V|r|S)NTF) idpop_is_relevant_tb_leveltb_nextrU_remove_unittest_tb_frames __traceback__ __cause__ __context__rLtypeadd) r rtrurvr4retfirstexcsseencs rrnzTestResult._clean_tracebackss%$%5 {#'88: WeR33B7ZZ33B7$/////3&(# //5+<+<=A}Ad): T!Wa$ABA>#* rc2d|jjvS)N __unittest)tb_frame f_globals)r rvs rr|z TestResult._is_relevant_tb_levelsr{{4444rcd}|r3|j|s"|}|j}|r|j|s"|d|_yy)aTruncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified. N)r|r})r rvprevs rr~z%TestResult._remove_unittest_tb_framessM33B7DB33B7  DL rcdtj|j|jt |j t |j fzS)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rrgrrr.s r__repr__zTestResult.__repr__sA3 dnn-t}}c$++>NDMM"$$ %r)NNN)__name__ __module__ __qualname____doc___previousTestClass_testRunEntered_moduleSetUpFailedr+r/r5r2r:r=r<rJr rPrRrWrYr\r^r`rerhr rMrnr|r~rr-rrrrs O#$. - # +* """" &" ,9 .. A6!,85  %rr)rr7r"rormr functoolsrrr rCrDobjectrr-rrrs;     h%h%rPK!<|)j j $__pycache__/__init__.cpython-312.pycnu[ ֦i dZgdZejgddZddlmZddlmZmZm Z m Z m Z m Z m Z mZmZmZddlmZmZddlmZmZdd lmZmZdd lmZmZdd lmZmZmZm Z dd lm!Z!m"Z"m#Z#d Z$dZ%y)a Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework (used with permission). This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Simple usage: import unittest class IntegerArithmeticTestCase(unittest.TestCase): def testAdd(self): # test method names begin with 'test' self.assertEqual((1 + 2), 3) self.assertEqual(0 + 1, 1) def testMultiply(self): self.assertEqual((0 * 10), 0) self.assertEqual((5 * 8), 40) if __name__ == '__main__': unittest.main() Further information is available in the bundled documentation, and from http://docs.python.org/library/unittest.html Copyright (c) 1999-2003 Steve Purcell Copyright (c) 2003-2010 Python Software Foundation This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContext)getTestCaseNames makeSuite findTestCasesT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrr)rrrc:tjdhzS)Nr)globalskeys*/usr/lib64/python3.12/unittest/__init__.py__dir__r$Ms 9>> 89 99r"cN|dk(r ddlmatStdtd|)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r# __getattr__r*Ps- ((7&& 78,.@I JJr"N)&__doc____all__extend __unittestresultrcaserrrr r r rrrrsuiterrloaderrr r rrunnerrrsignalsrrrrrrrr$r*r!r"r#r5s^,\ IAB  ''',1#2PP>>:Kr"PK!WX&__pycache__/async_case.cpython-312.pycnu[ ֦ikJddlZddlZddlZddlZddlmZdZGddeZy)N)TestCaseTceZdZdfd ZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd Zdfd ZfdZdZxZS)IsolatedAsyncioTestCasecdt||d|_tj|_yN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s ,/usr/lib64/python3.12/unittest/async_case.pyr z IsolatedAsyncioTestCase.__init__$s) $"#.#;#;#= c Kywrrs r asyncSetUpz"IsolatedAsyncioTestCase.asyncSetUp)  c Kywrrrs r asyncTearDownz%IsolatedAsyncioTestCase.asyncTearDown,rrc0|j|g|i|yr) addCleanuprfuncargskwargss raddAsyncCleanupz'IsolatedAsyncioTestCase.addAsyncCleanup/s $1&1rc Kt|} |j}|j}||d{}|j||ddd|S#t$r(t d|j d|j ddwxYw7Ow)zEnters the supplied asynchronous context manager. If successful, also adds its __aexit__ method as a cleanup function and returns the result of the __aenter__ method. '.zC' object does not support the asynchronous context manager protocolN)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r")rcmclsenterexitresults renterAsyncContextz)IsolatedAsyncioTestCase.enterAsyncContext>s2h 'NNE==D Ry T2tT48  'a/q1A1A0BCTU"& ' '!s% BA BBB1A??Bc|jj|jj|j|j |j yr)r get_looprrunsetUp _callAsyncrrs r _callSetUpz"IsolatedAsyncioTestCase._callSetUpRs> $$&   $$TZZ0 (rch|j|!tjd|dtdyy)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethodz'IsolatedAsyncioTestCase._callTestMethodZs<    ' 3 MM((.xq23ERS U 4rc|j|j|jj|jyr)r7rrr5tearDownrs r _callTearDownz%IsolatedAsyncioTestCase._callTearDown_s, **+   $$T]]3rc0|j|g|i|yr)r=)rfunctionr r!s r _callCleanupz$IsolatedAsyncioTestCase._callCleanupcsX777rc|jJdtj|s J|d|jj||i||jS)N!asyncio runner is not initializedz is not an async functioncontextr inspectiscoroutinefunctionr5rrs rr7z"IsolatedAsyncioTestCase._callAsyncfso"".S0SS.**40VTH|j|jyyr)r rZrs r__del__zIsolatedAsyncioTestCase.__del__s    *  ' ' ) +r)runTestr)__name__r+r,r rrr"r2r8rBrErHr7r=rWrZr5rRr^ __classcell__)rs@rrr sU4>    2()U 48 G% *& *rr)rSr rNr>caser __unittestrrrrrds'  E*hE*rPK!iG<G<'__pycache__/suite.cpython-312.opt-1.pycnu[ ֦i4dZddlZddlmZddlmZdZdZGdd eZGd deZ Gd d eZ d Z GddeZ y) TestSuiteN)case)utilTc.t||d}|y)NcyNr '/usr/lib64/python3.12/unittest/suite.pyz!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s 64 .DFr cXeZdZdZdZddZdZdZdZdZ dZ d Z d Z d Z d Zd Zy) BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. TcBg|_d|_|j|yNr)_tests_removed_testsaddTests)selftestss r __init__zBaseTestSuite.__init__s  er c`dtj|jdt|dS)N)rstrclass __class__listrs r __repr__zBaseTestSuite.__repr__s"&--"?dLLr cht||jstSt|t|k(Sr ) isinstancer!NotImplementedr")rothers r __eq__zBaseTestSuite.__eq__s)%0! !DzT%[((r c,t|jSr )iterrr#s r __iter__zBaseTestSuite.__iter__"sDKK  r cX|j}|D]}|s||jz }|Sr )rcountTestCases)rcasestests r r.zBaseTestSuite.countTestCases%s4##D,,.. r c t|s#tdjt|t |t r+t |tjtfr td|jj|y)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr&type issubclassrTestCaserrappendrr0s r addTestzBaseTestSuite.addTest,sj~077T CD D dD !j26--1K'M?@ @ 4 r cjt|tr td|D]}|j|y)Nz0tests must be an iterable of tests, not a string)r&strr3r;)rrr0s r rzBaseTestSuite.addTests6s. eS !NO OD LL r ct|D]:\}}|jr|S|||js*|j|<|Sr ) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr0s r runzBaseTestSuite.run<sL$T?KE4    L}}''. +  r c |j|}t|dr#|xj|jz c_d|j|<y#t$rYywxYw)z2Stop holding a reference to the TestCase at index.r.N)rhasattrrr.r3)rrDr0s r rBz BaseTestSuite._removeTestAtIndexEs^ &;;u%Dt-.##t':':'<<#!%DKK    sA AAc&|j|i|Sr rE)rargskwdss r __call__zBaseTestSuite.__call__Sstxx&&&r c2|D]}|jy)7Run the tests without collecting errors in a TestResultN)debugr:s r rOzBaseTestSuite.debugVsD JJLr N)r )__name__ __module__ __qualname____doc__rArr$r)r,r.r;rrErBrLrOr r r rrsDH M) !!  &'r rcPeZdZdZd dZdZdZdZdZ d dZ d d Z d Z d Z y)raA test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. c4d}t|dddur dx|_}t|D]\}}|jrnt |rl|j |||j |||j|||j|_ t|jdds t|ddr|s ||n|j|js|j||r*|j d||j|d|_|S)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrVr?r@ _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr!_previousTestClassrOrArB_handleModuleTearDown)rrCrOtopLevelrDr0s r rEz TestSuite.runfs 6,e 4 =04 4F "X$T?KE4  4 ++D&9))$7&&tV4,0NN)DNN,?GF$8%@V  }}''.)+,   ' 'f 5  & &v .%*F " r c<t}|j|dy)rNTN) _DebugResultrE)rrOs r rOzTestSuite.debugs r ct|dd}|j}||k(ry|jryt|ddryd} d|_t|dd}t|dd}|Wt |d ||r3|1||jD]} |j|| dd | t |d yy#t$rYwxYw#t $r^}t|trd} d|_n#t$rYnwxYwtj|} |j||d| Yd}~d}~wwxYw#t |d wxYw) Nr]__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) rr!rXrWr3r Exceptionr&rarr "_createClassOrModuleLevelExceptiontearDown_exceptions) rr0rC previousClass currentClassfailedrdree classNameexc_infos r r\zTestSuite._handleClassSetUps~( !,0A4H  ! FN 3 : GLo9#%$0$D$D?? & \9%-@/%E  (891 "   ! G!&,7!F9= 6$ $ l ;I;;FA D( C>- B98B9< C;,C61D(6C;;D(> D%D D( D%%D((D6Nc<|d|d}|j||||y)Nz ())_addClassOrModuleLevelException)rrCexc method_namerrh errorNames r rkz,TestSuite._createClassOrModuleLevelExceptions("m2fXQ/  ,,VS)TJr ct|}t|dd}|-t|tjr||t |y|s%|j |tjy|j ||y)NaddSkip) _ErrorHolderrr&rSkipTestr=addErrorrxrr)rrC exceptionrrherrorrs r rz)TestSuite._addClassOrModuleLevelExceptions`Y'&)T2  :i#G E3y> *s||~6t,r c$|j|}|y|jry tj|}t |d t |dd}| | tjt |dy#t$rYywxYw#t$r/}t|tr|j||d|Yd}~dd}~wwxYw#t$r/}t|tr|j||d|Yd}~d}~wwxYw#t |dwxYw)NrftearDownModuleri) rurXrxryrzrrrjr&rarkrr{)rrCrtr}rrps r r^zTestSuite._handleModuleTearDowns+226:  !   $ $  [[0F / 6$V-=tDN)L"$ H%%' F$4 51   !L!&,7;;FA9D>CD C>%C94D9C>>DDct|dd}|j}||k(s|yt|ddryt|ddryt|ddryt|dd}t|dd}||yt|d | ||[||jD]E} t |t r| d t j|}|j|| d d|| Gt|d y#t$rD}t |t rt j|}|j||d|Yd}~d}~wwxYw#t|d wxYw) Nr]rWFrXrc tearDownClassrerfrrgri) rr!rrjr&rarr rkrl) rr0rCrmrnrrerprqrrs r rZz TestSuite._tearDownPreviousClassst(rsW    IFIXi6 i6X$6$L6r PK!-y!w8w8'__pycache__/suite.cpython-312.opt-2.pycnu[ ֦i4 ddlZddlmZddlmZdZdZGddeZGd d eZGd d eZ d Z GddeZ y)N)case)utilTc.t||d}|y)NcyNr '/usr/lib64/python3.12/unittest/suite.pyz!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s 64 .DFr cVeZdZ dZddZdZdZdZdZdZ dZ d Z d Z d Z d Zy ) BaseTestSuiteTcBg|_d|_|j|yNr)_tests_removed_testsaddTests)selftestss r __init__zBaseTestSuite.__init__s  er c`dtj|jdt|dS)N)rstrclass __class__listrs r __repr__zBaseTestSuite.__repr__s"&--"?dLLr cht||jstSt|t|k(Sr) isinstancer NotImplementedr!)rothers r __eq__zBaseTestSuite.__eq__s)%0! !DzT%[((r c,t|jSr)iterrr"s r __iter__zBaseTestSuite.__iter__"sDKK  r cX|j}|D]}|s||jz }|Sr)rcountTestCases)rcasestests r r-zBaseTestSuite.countTestCases%s4##D,,.. r c t|s#tdjt|t |t r+t |tjtfr td|jj|y)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr%type issubclassrTestCase TestSuiterappendrr/s r addTestzBaseTestSuite.addTest,sj~077T CD D dD !j26--1K'M?@ @ 4 r cjt|tr td|D]}|j|y)Nz0tests must be an iterable of tests, not a string)r%strr2r;)rrr/s r rzBaseTestSuite.addTests6s. eS !NO OD LL r ct|D]:\}}|jr|S|||js*|j|<|Sr) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr/s r runzBaseTestSuite.run<sL$T?KE4    L}}''. +  r c |j|}t|dr#|xj|jz c_d|j|<y#t$rYywxYw)Nr-)rhasattrrr-r2)rrDr/s r rBz BaseTestSuite._removeTestAtIndexEsa@ &;;u%Dt-.##t':':'<<#!%DKK    sA AAc&|j|i|SrrE)rargskwdss r __call__zBaseTestSuite.__call__Sstxx&&&r c4 |D]}|jyr)debugr:s r rNzBaseTestSuite.debugVsED JJLr N)r )__name__ __module__ __qualname__rArr#r(r+r-r;rrErBrLrNr r r rrsDH M) !!  &'r rcNeZdZ d dZdZdZdZdZ d dZ d dZ d Z d Z y) r8c4d}t|dddur dx|_}t|D]\}}|jrnt |rl|j |||j |||j|||j|_ t|jdds t|ddr|s ||n|j|js|j||r*|j d||j|d|_|S)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)r rTr?r@ _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr _previousTestClassrNrArB_handleModuleTearDown)rrCrNtopLevelrDr/s r rEz TestSuite.runfs 6,e 4 =04 4F "X$T?KE4  4 ++D&9))$7&&tV4,0NN)DNN,?GF$8%@V  }}''.)+,   ' 'f 5  & &v .%*F " r c> t}|j|dy)NT) _DebugResultrE)rrNs r rNzTestSuite.debugsE r ct|dd}|j}||k(ry|jryt|ddryd} d|_t|dd}t|dd}|Wt |d ||r3|1||jD]} |j|| dd | t |d yy#t$rYwxYw#t $r^}t|trd} d|_n#t$rYnwxYwtj|} |j||d| Yd}~d}~wwxYw#t |d wxYw) Nr[__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) r r rVrUr2r Exceptionr%r_rr"_createClassOrModuleLevelExceptiontearDown_exceptions) rr/rC previousClass currentClassfailedrbrce classNameexc_infos r rZzTestSuite._handleClassSetUps~( !,0A4H  ! FN 3 : GLo9#%$0$D$D?? & \9%-@/%E  (891 "   ! G!&,7!F9= 6$ $ l ;I;;FA D( C>- B98B9< C;,C61D(6C;;D(> D%D D( D%%D((D6Nc<|d|d}|j||||y)Nz ())_addClassOrModuleLevelException)rrCexc method_namerrf errorNames r riz,TestSuite._createClassOrModuleLevelExceptions("m2fXQ/  ,,VS)TJr ct|}t|dd}|-t|tjr||t |y|s%|j |tjy|j ||y)NaddSkip) _ErrorHolderr r%rSkipTestr=addErrorrvrp)rrC exceptionrrferrorrs r r~z)TestSuite._addClassOrModuleLevelExceptions`Y'&)T2  :i#G E3y> *s||~6t,r c$|j|}|y|jry tj|}t |d t |dd}| | tjt |dy#t$rYywxYw#t$r/}t|tr|j||d|Yd}~dd}~wwxYw#t$r/}t|tr|j||d|Yd}~d}~wwxYw#t |dwxYw)NrdtearDownModulerg) rsrVrvrwrxrr rhr%r_rirry)rrCrrr{rrns r r\zTestSuite._handleModuleTearDowns+226:  !   $ $  [[0F / 6$V-=tDN)L"$ H%%' F$4 51   !L!&,7;;FA9D>CD C>%C94D9C>>DDct|dd}|j}||k(s|yt|ddryt|ddryt|ddryt|dd}t|dd}||yt|d | ||[||jD]E} t |t r| d t j|}|j|| d d|| Gt|d y#t$rD}t |t rt j|}|j||d|Yd}~d}~wwxYw#t|d wxYw) Nr[rUFrVra tearDownClassrcrdrrerg) r r rrhr%r_rrrirj) rr/rCrkrlrrcrnrorps r rXz TestSuite._tearDownPreviousClassst(rsW    IFIXi6 i6X$6$L6r PK!@8 ![[ __pycache__/util.cpython-312.pycnu[ ֦i_dZddlmZmZddlmZdZdZdZdZ dZ dZ ee eze zeze zz Z e dk\sJdZ d Zdd Zd Zd Zd ZdZeddZdZdZy)zVarious utility functions.) namedtupleCounter) commonprefixTP cnt||z |z }|tkDrd|d|||t||z dfz}|S)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips &/usr/lib64/python3.12/unittest/util.py_shortenrsK q6I  )D  *9 tQs1v 7I7J5KL L Hcttt|}ttt|}|t kr|St |t t |z tztzz }|tkDrIttztz|z zt ksJtt|tfd|DSttttfd|DS)Nc3.K|] }|dzywN.0r prefixr s r z'_common_shorten_repr..'s:TVa m+Tsc3TK|]}t|dttz!ywr)r _MIN_DIFF_LEN _MIN_END_LENrs rrz'_common_shorten_repr..*s- Q(1YZ=-NNs%() tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr(s Y% &D S$ F  $ FF I9$~58HHJJO# 00?B"$&12 22&.*=:T::: fno >F     rc t|}|rt |t kr|S|dt dzS#t$rtj|}YBwxYw)Nz [truncated]...)repr Exceptionobject__repr__r r")objshortresults rr r -sW&c CK+- ,; "3 33 &%&s /AAc8|jd|jS)N.) __module__ __qualname__)clss rstrclassr66snnc&6&6 77rcdx}}g}g} ||}||}||kr-|j||dz }|||k(ry|dz }|||k(rnj||kDr-|j||dz }|||k(rG|dz }|||k(rn8|dz } |||k(r|dz }|||k(r|dz }|||k(r|dz }|||k(r #|dz }|||k(r|dz }|||k(rwwxYw#t$r.|j||d|j||dY||fSwxYw)arFinds elements in only one or the other of two, sorted input lists. Returns a two-element tuple of lists. The first list contains those elements in the "expected" list but not in the "actual" list, and the second contains those elements in the "actual" list but not in the "expected" list. Duplicate elements in either input list are ignored. rN)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerD9s IAGJ   Aq A1uq!QqkQ&FAqkQ&Q!!!$QQi1nFAQi1nQ"1+*Q#1+*FA )q.Q!)q.+ (FA )q.Q!)q.  NN8AB< (   fQRj )  J   sA:C1C8C?B2C0C2CCC1D  D cg}|r%|j} |j||r%||fS#t$r|j|Y#wxYw)zSame behavior as sorted_list_difference but for lists of unorderable items (like dicts). As it does a linear search per item (remove) it has O(n*n) performance.)popremove ValueErrorr9)r<r=r@items runorderable_list_differencerJbsV G ||~ ! MM$   F?  ! NN4  !s.A  A c||kD||kz S)z.Return -1 if x < y, 0 if x == y and 1 if x > yr)xys r three_way_cmprNss Ea!e rMismatchzactual expected valuec<t|t|}}t|t|}}t}g}t|D]y\}} | |ur dx} } t ||D]} || | k(s | dz } ||| <t|D]\} } | | k(s | dz } ||| <| | k7s\t | | | }|j |{t|D]N\}} | |ur d} t ||D]} || | k(s | dz } ||| <t d| | }|j |P|S)HReturns list of (cnt_act, cnt_exp, elem) triples where the counts differrr8)listr r, enumeraterange _Mismatchr9)r=r<r tmnNULLr0r>elemcnt_scnt_tr? other_elemdiffs r_count_diff_all_purposer_ysI <hqA q63q6qA 8D FQ<4 4< q!Att| !'q\MAzT! !* E>UE40D MM$  Q<4 4< q!Att| !E4( d  MrcHt|t|}}g}|jD];\}}|j|d}||k7st|||}|j |=|jD](\}}||vs td||}|j |*|S)rQr)ritemsgetrUr9) r=r<r rVr0rZr[r\r^s r_count_diff_hashablercs 6?GH-qA Fwwy edA E>UE40D MM$  ! wwy e q=Qt,D MM$ ! MrN)F)__doc__ collectionsrros.pathr __unittestr"r r#rr$rrr(r r6rDrJrNrUr_rcrrrrhs +    !11OC !#/01   *48&R" z#: ; !FrPK!k&__pycache__/util.cpython-312.opt-2.pycnu[ ֦i_ ddlmZmZddlmZdZdZdZdZdZ dZ eeeze zeze zz Z dZ dZ dd Zd Zd Zd Zd ZeddZdZdZy)) namedtupleCounter) commonprefixTP cnt||z |z }|tkDrd|d|||t||z dfz}|S)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips &/usr/lib64/python3.12/unittest/util.py_shortenrsK q6I  )D  *9 tQs1v 7I7J5KL L Hcttt|}ttt|}|t kr|St |t t |z tztzz }|tkDr&tt|tfd|DSttttfd|DS)Nc3.K|] }|dzywN.0r prefixr s r z'_common_shorten_repr..'s:TVa m+Tsc3TK|]}t|dttz!ywr)r _MIN_DIFF_LEN _MIN_END_LENrs rrz'_common_shorten_repr..*s- Q(1YZ=-NNs%() tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr(s Y% &D S$ F  $ FF I9$~58HHJJO#&.*=:T::: fno >F     rc t|}|rt |t kr|S|dt dzS#t$rtj|}YBwxYw)Nz [truncated]...)repr Exceptionobject__repr__r r")objshortresults rr r -sW&c CK+- ,; "3 33 &%&s /AAc8|jd|jS)N.) __module__ __qualname__)clss rstrclassr66snnc&6&6 77rc dx}}g}g} ||}||}||kr-|j||dz }|||k(ry|dz }|||k(rnj||kDr-|j||dz }|||k(rG|dz }|||k(rn8|dz } |||k(r|dz }|||k(r|dz }|||k(r|dz }|||k(r #|dz }|||k(r|dz }|||k(rwwxYw#t$r.|j||d|j||dY||fSwxYwNr)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerE9s IAGJ   Aq A1uq!QqkQ&FAqkQ&Q!!!$QQi1nFAQi1nQ"1+*Q#1+*FA )q.Q!)q.+ (FA )q.Q!)q.  NN8AB< (   fQRj )  J   sA:C1C9CB3C1C3CCC1D  D c g}|r%|j} |j||r%||fS#t$r|j|Y#wxYwr)popremove ValueErrorr:)r=r>rAitems runorderable_list_differencerKbs[ G ||~ ! MM$   F?  ! NN4  !s/A  A c ||kD||kz Srr)xys r three_way_cmprOss8 Ea!e rMismatchzactual expected valuec> t|t|}}t|t|}}t}g}t|D]y\}} | |ur dx} } t ||D]} || | k(s | dz } ||| <t|D]\} } | | k(s | dz } ||| <| | k7s\t | | | }|j |{t|D]N\}} | |ur d} t ||D]} || | k(s | dz } ||| <t d| | }|j |P|Sr8)listr r, enumeraterange _Mismatchr:)r>r=r tmnNULLr0r?elemcnt_scnt_tr@ other_elemdiffs r_count_diff_all_purposer_ysJN <hqA q63q6qA 8D FQ<4 4< q!Att| !'q\MAzT! !* E>UE40D MM$  Q<4 4< q!Att| !E4( d  MrcJ t|t|}}g}|jD];\}}|j|d}||k7st|||}|j |=|jD](\}}||vs td||}|j |*|S)Nr)ritemsgetrUr:) r>r=r rVr0rZr[r\r^s r_count_diff_hashablercsN 6?GH-qA Fwwy edA E>UE40D MM$  ! wwy e q=Qt,D MM$ ! MrN)F) collectionsrros.pathr __unittestr"r r#rr$rrr(r r6rErKrOrUr_rcrrrrgs +    !11OC !#/01   *48&R" z#: ; !FrPK!D11(__pycache__/result.cpython-312.opt-1.pycnu[ ֦i#`dZddlZddlZddlZddlmZddlmZdZdZ dZ d Z Gd d e Z y) zTest result objectN)utilwrapsTc.tfd}|S)NcVt|ddr|j|g|i|S)NfailfastF)getattrstop)selfargskwmethods (/usr/lib64/python3.12/unittest/result.pyinnerzfailfast..inner s- 4U + IIKd(T(R((r)rrs` rr r s  6])) Lrz Stdout: %sz Stderr: %sceZdZdZdZdZdZddZdZdZ dZ dZ d Z d Z d Zed Zed ZdZdZdZdZedZdZdZdZdZdZdZdZdZy) TestResultaHolder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. NFcd|_g|_g|_d|_g|_g|_g|_g|_d|_d|_ d|_ d|_ d|_ tj|_tj |_d|_y)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccessescollectedDurations shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__zTestResult.__init__&s     "#% "$ "" #  # "rcy)z#Called by TestRunner after test runNr s r printErrorszTestResult.printErrors8rc\|xjdz c_d|_|jy)z-Called when the given test is about to be runrFN)rr' _setupStdoutr tests r startTestzTestResult.startTest;s$  " rc|jri|j2tj|_tj|_|jt _|jt _yy)N)rr!ioStringIOr r"r#r%r.s rr2zTestResult._setupStdoutAsP ;;""*&(kkm#&(kkm#,,CJ,,CJ rcy)zpCalled once before any tests are executed. See startTest for a method called before each test. Nr-r.s r startTestRunzTestResult.startTestRunIr0rc2|jd|_y)z'Called when the given test has been runFN)_restoreStdoutr'r3s rstopTestzTestResult.stopTestOs "rc|jrQ|jrtjj }tj j }|r8|j ds|dz }|jjt|z|r8|j ds|dz }|jjt|z|jt_|jt_|jjd|jj|jjd|jjyy)N r)rr'r"r#getvaluer%endswithr$write STDOUT_LINEr& STDERR_LINEr seektruncater!)r outputerrors rr<zTestResult._restoreStdoutTs ;;!!,,. ++-!??40$))// f0DE >>$/ ))// e0CD..CJ..CJ    $ $Q '    ( ( *    $ $Q '    ( ( *% rcy)zmCalled once after all tests are executed. See stopTest for a method called after each test. Nr-r.s r stopTestRunzTestResult.stopTestRunir0rcl|jj||j||fd|_y)zmCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). TN)rappend_exc_info_to_stringr'r r4errs raddErrorzTestResult.addErroros0 D$":":3"EFG!rcl|jj||j||fd|_y)zdCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)rrLrMr'rNs r addFailurezTestResult.addFailurews0 dD$<$|jj||fy)zCalled when a test is skipped.N)rrL)r r4reasons raddSkipzTestResult.addSkips T6N+rc^|jj||j||fy)z/Called when an expected failure/error occurred.N)rrLrMrNs raddExpectedFailurezTestResult.addExpectedFailures+ $$ 4++C6 7 9rc:|jj|y)z5Called when a test was expected to fail, but succeed.N)rrLr3s raddUnexpectedSuccesszTestResult.addUnexpectedSuccesss   ''-rcjt|dr'|jjt||fyy)zCalled when a test finished to run, regardless of its outcome. *test* is the test case corresponding to the test method. *elapsed* is the time represented in seconds, and it includes the execution of cleanup functions. rN)hasattrrrLstr)r r4elapseds r addDurationzTestResult.addDurations1 4- .  # # * *CIw+? @ /rct|jt|jcxk(xrdk(ncxr't|d xst|jdk(S)z/Tells whether or not this result was a success.rr)lenrrrbrr.s r wasSuccessfulzTestResult.wasSuccessfulsS T]]#s4;;'7<1<5T#8994T--.!3 6rcd|_y)z+Indicates that the tests should be aborted.TN)rr.s rr zTestResult.stops rc"|\}}}|j||||}tj||||jd}t |j }|j rtjj}tjj} |r.|jds|dz }|jt|z| r.| jds| dz } |jt| zdj|S)z>Converts a sys.exc_info()-style tuple of values into a string.T)capture_localscompactr?)_clean_tracebacks tracebackTracebackExceptionrlistformatrr"r#r@r%rArLrCrDjoin) r rOr4exctypevaluetbtb_emsgLinesrGrHs rrMzTestResult._exc_info_to_strings   # #GUB =++ UB>>49 & ;;ZZ((*FJJ'')Et,dNF f 45~~d+TME e 34wwx  rcd}d}|||fg}t|h}|r|j\}}}|r1|j|r |j}|r|j|r ||jur|j ||r|}d}n||_|o|j|jfD]T} | t| |vs|jt| | | j f|jt| V|r|S)NTF) idpop_is_relevant_tb_leveltb_nextrU_remove_unittest_tb_frames __traceback__ __cause__ __context__rLtypeadd) r rtrurvr4retfirstexcsseencs rrnzTestResult._clean_tracebackss%$%5 {#'88: WeR33B7ZZ33B7$/////3&(# //5+<+<=A}Ad): T!Wa$ABA>#* rc2d|jjvS)N __unittest)tb_frame f_globals)r rvs rr|z TestResult._is_relevant_tb_levelsr{{4444rcd}|r3|j|s"|}|j}|r|j|s"|d|_yy)aTruncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified. N)r|r})r rvprevs rr~z%TestResult._remove_unittest_tb_framessM33B7DB33B7  DL rcdtj|j|jt |j t |j fzS)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rrgrrr.s r__repr__zTestResult.__repr__sA3 dnn-t}}c$++>NDMM"$$ %r)NNN)__name__ __module__ __qualname____doc___previousTestClass_testRunEntered_moduleSetUpFailedr+r/r5r2r:r=r<rJr rPrRrWrYr\r^r`rerhr rMrnr|r~rr-rrrrs O#$. - # +* """" &" ,9 .. A6!,85  %rr)rr7r"rormr functoolsrrr rCrDobjectrr-rrrs;     h%h%rPK!?jj$__pycache__/__main__.cpython-312.pycnu[ ֦idZddlZejdjdrrsc 88A; & !!#..1J~-CHHQK  DrPK!E~RR(__pycache__/loader.cpython-312.opt-2.pycnu[ ֦i|R ddlZddlZddlZddlZddlZddlZddlmZmZddlm Z m Z m Z dZ ejdejZGdde j Zd Zd Zd Zd Zd ZGddeZeZddZe j6dfdZde j6e j:fdZde j6e j:fdZy)N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c,eZdZdZfdZfdZxZS) _FailedTestNc:||_tt||yN) _exceptionsuperr __init__)self method_name exception __class__s (/usr/lib64/python3.12/unittest/loader.pyrz_FailedTest.__init__s# k4)+6cX|jk7rtt|Sfd}|S)Ncjr )r rsr testFailurez,_FailedTest.__getattr__..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_test ImportError)r suiteClassmessages r_make_failed_import_testr*%s- i""$&G T;w#7W MMrcLdtj}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 -D tg  ''rctjt|d}||i}tdtjf|}|||fS)Ncyr rs r testSkippedz'_make_skipped_test..testSkipped4s r ModuleSkipped)rskipstrtypeTestCase)r.rr(r3attrs TestClasss r_make_skipped_testr;3sS YYs9~   %E_t}}&6>I y,. //rcFtjj|dS)Nr)ospathsplitext)r>s r _splitextr@;s 77  D !! $$rceZdZ dZeej ZdZe jZ dZ fdZ dZdddZddZddZd Zdd Zd Zd Zd ZdZdZdZxZS) TestLoaderr/NcVtt| g|_t |_yr )rrBrerrorsset_loading_packages)rrs rrzTestLoader.__init__Js# j$(* "%rc t|tjr td|tj tj fvrg}n"|j|}|st|drdg}|jt||}|S)NzYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?runTest) issubclassr TestSuite TypeErrorrr8FunctionTestCasegetTestCaseNameshasattrr(map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCasez TestLoader.loadTestsFromTestCaseQsI mU__ 5() ) T]]D,A,AB BM 11-@M W]I%F!* s=-'HI rpatternc& g}t|D]}}t||}t|ts t |t j s;|t j t jfvs^|j|j|t|dd}|j|}| ||||S|S#t$rK}t|j||j\}} |jj| |cYd}~Sd}~wwxYw)N load_tests)dirgetattr isinstancer7rIrr8rLappendrSr( Exceptionr,rrD) rmodulerUtestsrobjrWe error_case error_messages rloadTestsFromModulezTestLoader.loadTestsFromModuleasLKD&$'C3%sDMM2 t/D/DEE T77<= V\48 &  ! "!$w77   ",COOQ-9) M ""=1!!  "s0 B<< DAD D Dc  |jd}d\}}|*|dd}|r dj|}t|} |dd}|} |D]} | t| | } } t| tj r|j#| St| t$rMt'| t(j*r3| t(j*t(j,fvr|j/| St| tj0rmt t$r]t'| t(j*rC|d}| |} tt| |tj0s.|j | gSt| t2j4r| St7| ra| }t|t2j4r|St|t(j*r|j |gSt9d| d|d t9d | z#t$rM|j }t ||j \}}|s|jj||cYSYnwxYw|r=!#t$r} t| dd&|$|jj||cYd} ~ cSt| | |j dtj\}}|jj||cYd} ~ cSd} ~ wwxYw) N.NNr__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(rDr[rYAttributeErrorr&r$r%rZtypes ModuleTypercr7rIrr8rLrS FunctionTyperrJcallablerK)rrr]partsrarb parts_copy module_namenext_attributer_partparentr`instr/s rloadTestsFromNamezTestLoader.loadTestsFromNameys  3$.! M >qJ *"%((:"6K' 4F!"IED &!73#5. c5++ ,++C0 0 sD !3 .DMM4+@+@AA--c2 2e001&/9D$". KK&&}5%%1Ba%002516-J KK&&}5%%% &s=H I AII K5)+K0K5A K0(K50K5cn |Dcgc]}|j||}}|j|Scc}wr )ryr()rnamesr]rsuitess rloadTestsFromNameszTestLoader.loadTestsFromNamessA DII54$((v65Iv&&Js2c fd}tt|t}jr/|j t j j|S)Nc|jjsyt|}t|sydjj |fzj duxstfdj DS)NFz%s.%s.%sc36K|]}t|ywr )r).0rUfullNames r zKTestLoader.getTestCaseNames..shouldIncludeMethod..sXBWwK'2BWs) startswithtestMethodPrefixrYrqrrtestNamePatternsany)attrnametestFuncrrrPs @rshouldIncludeMethodz8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<'<=}h7HH%!((-*D*Dh&H((D0YX$BWBWXX Yr)key)listfilterrXsortTestMethodsUsingsort functools cmp_to_key)rrPr testFnNamess`` rrMzTestLoader.getTestCaseNamessX  Y6"5s=7IJK  $ $   !5!5d6O6O!P  Qrc |j}d}||j |j}n|d}|}tjj|}|tjvr tjj d|||_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) NFTr __init__.pyrez2Can 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>abspathsysinsertisdirisfilerjrkmodulesridirname__file__rmrbuiltin_module_namesrK _get_directory_containing_moduleremover'r _find_testsr() r start_dirrU top_level_diroriginal_top_level_dirset_implicit_topis_not_importable the_moduletop_partr^s rdiscoverzTestLoader.discovers 6"&!4!4   T%8%8%D //M  "# %M 6 ( HHOOA} -+! 77==3 4 2IM)(*rww||I}7](^$^! 39%![[3 $??3/2 ( ")<)<>!@I$*.*O*OPX*YD'HHOOM2 E QR RT%%i9:4u%%'&(!**c.F.FF')ABGKL(>znM#'( ( )$(! )s + I#AHAI # I10I1ctj|}tjj |j }tjj |jjdrrrbasenamelowerrr)rrtr] full_paths rrz+TestLoader._get_directory_containing_module:s[)GGOOFOO4 77  I & , , . 9 9- H77??277??9#=> > 77??9- -rc||jk(ryttjj |}tjj ||j}|j tjjd}|SNre)rr@r=r>normpathrelpathreplacesep)rr>_relpathrs r_get_name_from_pathzTestLoader._get_name_from_pathFsg 4&& &))$/077??4)<)<= S1 rc>t|tj|Sr )rkrr)rrs r_get_module_from_namez TestLoader._get_module_from_nameRs4{{4  rct||Sr )r)rr>rrUs r _match_pathzTestLoader._match_pathVstW%%rc#`K |j|}|dk7r,||jvr|j||\}}|||sytt j |}|D]}tj j||}|j||\}}|||sA|j|}|jj| |j||Ed{|jj|y7"#|jj|wxYwwr) rrF_find_test_pathsortedr=listdirr>rjaddrdiscard) rrrUrr^should_recursepathsr>rs rrzTestLoader._find_testsZs='' 2 3;4t'='==%)$8$8G$L !E>  !rzz),-D Y5I$($8$8G$L !E>  // :&&**409#// 7CCC**2248D**2248s6B$D.',D.D)D *D.D. DD++D.c| tjj|}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|df|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) N)NFrzW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?rTFrrWT)r=r>rrVALID_MODULE_NAMEmatchrrrrrYr@realpathrrr'rcrSkipTestr;r(r*rDr[rrjrFrr)rrrUrrr]mod_filerfullpath_noext module_dirmod_name expected_dirmsgr`rarbrWr^packages rrzTestLoader._find_test_pathzs* 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=J8*M $L+L+8L( K)#L()=L(+M N;M<6N;<=N;r )ztest*.pyN)rrrr staticmethodr three_way_cmprrrrJr(rrrSrcryr}rMrrrrrrrr r!s@rrBrB?s'(:(:;JN' 6:0PJd'&S&j . !&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)warningswarnDeprecationWarningrrM)rPrrrrs rrMrMs? MM Eq vy;K L ] ]^k llrr/crddl}|jdtdt|||j |S)Nrzunittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.rr)rrrrrS)rPrrr(rs r makeSuitersB MM Jq vy* 5 K K rcrddl}|jdtdt|||j |S)Nrzunittest.findTestCases() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromModule() instead.rr)rrrrrc)r]rrr(rs r findTestCasesrsB MM Hq vy* 5 I I rrf) r=rerr$rnrrrrrr __unittestcompile IGNORECASErr8r r*r,r&r;r@objectrBdefaultTestLoaderrrrMrJrrr2rrrs  (  BJJ0"--@ $-- N . (0%CCL L 7;6H6H[_m%+d6H6H "(43E3E"__ rPK!ߙ))(__pycache__/result.cpython-312.opt-2.pycnu[ ֦i#^ ddlZddlZddlZddlmZddlmZdZdZdZ dZ Gd d e Z y) N)utilwrapsTc.tfd}|S)NcVt|ddr|j|g|i|S)NfailfastF)getattrstop)selfargskwmethods (/usr/lib64/python3.12/unittest/result.pyinnerzfailfast..inner s- 4U + IIKd(T(R((r)rrs` rr r s  6])) Lrz Stdout: %sz Stderr: %sceZdZ dZdZdZddZdZdZdZ dZ dZ d Z d Z ed Zed Zd ZdZdZdZedZdZdZdZdZdZdZdZdZy) TestResultNFcd|_g|_g|_d|_g|_g|_g|_g|_d|_d|_ d|_ d|_ d|_ tj|_tj |_d|_y)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccessescollectedDurations shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__zTestResult.__init__&s     "#% "$ "" #  # "rcyNr s r printErrorszTestResult.printErrors8s-rc^ |xjdz c_d|_|jy)NrF)rr' _setupStdoutr tests r startTestzTestResult.startTest;s'7  " rc|jri|j2tj|_tj|_|jt _|jt _yyr-)rr!ioStringIOr r"r#r%r/s rr2zTestResult._setupStdoutAsP ;;""*&(kkm#&(kkm#,,CJ,,CJ rcyr-r.r/s r startTestRunzTestResult.startTestRunI rc4 |jd|_y)NF)_restoreStdoutr'r3s rstopTestzTestResult.stopTestOs5 "rc|jrQ|jrtjj }tj j }|r8|j ds|dz }|jjt|z|r8|j ds|dz }|jjt|z|jt_|jt_|jjd|jj|jjd|jjyy)N r)rr'r"r#getvaluer%endswithr$write STDOUT_LINEr& STDERR_LINEr seektruncater!)r outputerrors rr=zTestResult._restoreStdoutTs ;;!!,,. ++-!??40$))// f0DE >>$/ ))// e0CD..CJ..CJ    $ $Q '    ( ( *    $ $Q '    ( ( *% rcyr-r.r/s r stopTestRunzTestResult.stopTestRunir;rcn |jj||j||fd|_yNT)rappend_exc_info_to_stringr'r r4errs raddErrorzTestResult.addErroros5  D$":":3"EFG!rcn |jj||j||fd|_yrM)rrNrOr'rPs r addFailurezTestResult.addFailurews3 ' dD$<$>49 & ;;ZZ((*FJJ'')Et,dNF f 45~~d+TME e 34wwx  rcd}d}|||fg}t|h}|r|j\}}}|r1|j|r |j}|r|j|r ||jur|j ||r|}d}n||_|o|j|jfD]T} | t| |vs|jt| | | j f|jt| V|r|S)NTF) idpop_is_relevant_tb_leveltb_nextrW_remove_unittest_tb_frames __traceback__ __cause__ __context__rNtypeadd) r rvrwrxr4retfirstexcsseencs rrpzTestResult._clean_tracebackss%$%5 {#'88: WeR33B7ZZ33B7$/////3&(# //5+<+<=A}Ad): T!Wa$ABA>#* rc2d|jjvS)N __unittest)tb_frame f_globals)r rxs rr~z TestResult._is_relevant_tb_levelsr{{4444rc d}|r3|j|s"|}|j}|r|j|s"|d|_yyr-)r~r)r rxprevs rrz%TestResult._remove_unittest_tb_framessR 33B7DB33B7  DL rcdtj|j|jt |j t |j fzS)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rrirrr/s r__repr__zTestResult.__repr__sA3 dnn-t}}c$++>NDMM"$$ %r)NNN)__name__ __module__ __qualname___previousTestClass_testRunEntered_moduleSetUpFailedr+r0r5r2r:r>r=rKr rRrTrYr[r^r`rbrgrjr rOrpr~rrr.rrrrs O#$. - # +* """" &" ,9 .. A6!,85  %rr) r7r"rqror functoolsrrr rDrEobjectrr.rrrs;     h%h%rPK!h&__pycache__/util.cpython-312.opt-1.pycnu[ ֦i_dZddlmZmZddlmZdZdZdZdZ dZ dZ ee eze zeze zz Z dZ d Zdd Zd Zd Zd ZdZeddZdZdZy)zVarious utility functions.) namedtupleCounter) commonprefixTP cnt||z |z }|tkDrd|d|||t||z dfz}|S)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips &/usr/lib64/python3.12/unittest/util.py_shortenrsK q6I  )D  *9 tQs1v 7I7J5KL L Hcttt|}ttt|}|t kr|St |t t |z tztzz }|tkDr&tt|tfd|DSttttfd|DS)Nc3.K|] }|dzywN.0r prefixr s r z'_common_shorten_repr..'s:TVa m+Tsc3TK|]}t|dttz!ywr)r _MIN_DIFF_LEN _MIN_END_LENrs rrz'_common_shorten_repr..*s- Q(1YZ=-NNs%() tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr(s Y% &D S$ F  $ FF I9$~58HHJJO#&.*=:T::: fno >F     rc t|}|rt |t kr|S|dt dzS#t$rtj|}YBwxYw)Nz [truncated]...)repr Exceptionobject__repr__r r")objshortresults rr r -sW&c CK+- ,; "3 33 &%&s /AAc8|jd|jS)N.) __module__ __qualname__)clss rstrclassr66snnc&6&6 77rcdx}}g}g} ||}||}||kr-|j||dz }|||k(ry|dz }|||k(rnj||kDr-|j||dz }|||k(rG|dz }|||k(rn8|dz } |||k(r|dz }|||k(r|dz }|||k(r|dz }|||k(r #|dz }|||k(r|dz }|||k(rwwxYw#t$r.|j||d|j||dY||fSwxYw)arFinds elements in only one or the other of two, sorted input lists. Returns a two-element tuple of lists. The first list contains those elements in the "expected" list but not in the "actual" list, and the second contains those elements in the "actual" list but not in the "expected" list. Duplicate elements in either input list are ignored. rN)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerD9s IAGJ   Aq A1uq!QqkQ&FAqkQ&Q!!!$QQi1nFAQi1nQ"1+*Q#1+*FA )q.Q!)q.+ (FA )q.Q!)q.  NN8AB< (   fQRj )  J   sA:C1C8C?B2C0C2CCC1D  D cg}|r%|j} |j||r%||fS#t$r|j|Y#wxYw)zSame behavior as sorted_list_difference but for lists of unorderable items (like dicts). As it does a linear search per item (remove) it has O(n*n) performance.)popremove ValueErrorr9)r<r=r@items runorderable_list_differencerJbsV G ||~ ! MM$   F?  ! NN4  !s.A  A c||kD||kz S)z.Return -1 if x < y, 0 if x == y and 1 if x > yr)xys r three_way_cmprNss Ea!e rMismatchzactual expected valuec<t|t|}}t|t|}}t}g}t|D]y\}} | |ur dx} } t ||D]} || | k(s | dz } ||| <t|D]\} } | | k(s | dz } ||| <| | k7s\t | | | }|j |{t|D]N\}} | |ur d} t ||D]} || | k(s | dz } ||| <t d| | }|j |P|S)HReturns list of (cnt_act, cnt_exp, elem) triples where the counts differrr8)listr r, enumeraterange _Mismatchr9)r=r<r tmnNULLr0r>elemcnt_scnt_tr? other_elemdiffs r_count_diff_all_purposer_ysI <hqA q63q6qA 8D FQ<4 4< q!Att| !'q\MAzT! !* E>UE40D MM$  Q<4 4< q!Att| !E4( d  MrcHt|t|}}g}|jD];\}}|j|d}||k7st|||}|j |=|jD](\}}||vs td||}|j |*|S)rQr)ritemsgetrUr9) r=r<r rVr0rZr[r\r^s r_count_diff_hashablercs 6?GH-qA Fwwy edA E>UE40D MM$  ! wwy e q=Qt,D MM$ ! MrN)F)__doc__ collectionsrros.pathr __unittestr"r r#rr$rrr(r r6rDrJrNrUr_rcrrrrhs +    !11OC !#/01   *48&R" z#: ; !FrPK!<|)j j *__pycache__/__init__.cpython-312.opt-1.pycnu[ ֦i dZgdZejgddZddlmZddlmZmZm Z m Z m Z m Z m Z mZmZmZddlmZmZddlmZmZdd lmZmZdd lmZmZdd lmZmZmZm Z dd lm!Z!m"Z"m#Z#d Z$dZ%y)a Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework (used with permission). This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Simple usage: import unittest class IntegerArithmeticTestCase(unittest.TestCase): def testAdd(self): # test method names begin with 'test' self.assertEqual((1 + 2), 3) self.assertEqual(0 + 1, 1) def testMultiply(self): self.assertEqual((0 * 10), 0) self.assertEqual((5 * 8), 40) if __name__ == '__main__': unittest.main() Further information is available in the bundled documentation, and from http://docs.python.org/library/unittest.html Copyright (c) 1999-2003 Steve Purcell Copyright (c) 2003-2010 Python Software Foundation This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContext)getTestCaseNames makeSuite findTestCasesT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrr)rrrc:tjdhzS)Nr)globalskeys*/usr/lib64/python3.12/unittest/__init__.py__dir__r$Ms 9>> 89 99r"cN|dk(r ddlmatStdtd|)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r# __getattr__r*Ps- ((7&& 78,.@I JJr"N)&__doc____all__extend __unittestresultrcaserrrr r r rrrrsuiterrloaderrr r rrunnerrrsignalsrrrrrrrr$r*r!r"r#r5s^,\ IAB  ''',1#2PP>>:Kr"PK!MM*__pycache__/__main__.cpython-312.opt-2.pycnu[ ֦i ddlZejdjdrrsc 88A; & !!#..1J~-CHHQK  DrPK!.544 __pycache__/main.cpython-312.pycnu[ ֦i.dZddlZddlZddlZddlZddlmZmZddlm Z dZ dZ dZ d Z d Zd Zd ZGd deZeZy)zUnittest main programN)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase c,tjj|r|jj drtjj |rttjj |tj}tjj |s|jtjr|S|}tjj|ddjddjddS|S)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths &/usr/lib64/python3.12/unittest/main.py _convert_namers  ww~~d 5 5e < 77== wwtRYY[9Hww}}X&(*=*=bii*H Dww%cr*224=EEc3OO Kc>|Dcgc] }t|c}Scc}wN)r)namesrs r_convert_namesr!/s,1 2EDM$ E 22 2scd|vrd|z}|S)N*z*%s*)patterns r_convert_select_patternr&3s '>7" Nrc eZdZdZdZdZdxZxZxZxZ xZ Z dZ dddde jddddddf ddddZdd Zd Zd Zdd Zd ZdZdZdZddZdZy) TestProgramzA command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. Nr__main__TF) tb_locals durationsc >t|trEt||_|j dddD]}t |j||_n||_|t j}||_||_ | |_ ||_ | |_ | |_ | |_| t jsd|_n| |_||_||_||_t(j*j-|d|_|j1||j3y)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr*r+ warnoptionswarnings defaultTest testRunner testLoaderr rbasenameprogName parseArgsrunTests)selfr1r=r5r>r?r6r9r7r8r:r<r*r+parts r__init__zTestProgram.__init__Cs fc "$V,DK S)!"-%dkk48 .!DK <88D   $" ""  COO&DM%DM&$$((a1  t rctjdt|r t||j|j |j tjdy)NzHTestProgram.usageExit() is deprecated and will be removed in Python 3.13) r<warnDeprecationWarningprint_discovery_parser_initArgParsers _print_helpr4r6)rDmsgs r usageExitzTestProgram.usageExitksP 01C E  #J  ! ! )  "   rcV|j\t|jjttd|j iz|j jyt|jjttd|j izy)Nprog) r1rK _main_parser format_help MAIN_EXAMPLESrArL print_helpMODULE_EXAMPLES)rDargskwargss rrNzTestProgram._print_helpusx ;;  $##//1 2 -64=="99 :  " " - - / $##//1 2 /VT]]$;; ""48,    ( (ab4 8::""2&    ( (ab4 8 ::+DJJ7DN:%"    %!DN ((# ."..0DN!$"2"23DN rc|jr|j|j_|rM| |jn|}|j|j|j|j |_y|j+|jj|j|_y|jj|j|j|_yr) testNamePatternsr?r[startr%toptestr`loadTestsFromModuler1loadTestsFromNames)rDfrom_discoveryLoaderrs rrczTestProgram.createTestss  /3/D/DDOO , (.T__FHF' DLL$((KDI ^^ #;;DKKHDI::4>>;?;;HDIrc||j}|j||_|j||_yr)_getParentArgParser_getMainArgParserrS_getDiscoveryArgParserrL)rD parent_parsers rrMzTestProgram._initArgParserss6002  22=A!%!tjd}|jdddddd |jd d ddd d |jdddd|jddtddd|j|jdddddd|_|j |jdddddd|_|j |jd d!d"dd#d|_|j!|jd$d%d&td'(g|_|S))NF)add_helpz-vz --verboser9 store_constrHzVerbose output)destactionconsthelpz-qz--quietrz Quiet outputz--localsr* store_truez"Show local variables in tracebacks)rurvrxz --durationsr+Nz+Show the N slowest test cases (N=0 for all))rutyper-metavarrxz-fz --failfastr7zStop on first fail or errorz-cz--catchr8z'Catch Ctrl-C and display results so farz-bz--bufferr:z%Buffer stdout and stderr during testsz-kreappendz.Only run tests which match the given substring)rurvr{rx) argparseArgumentParser add_argumentintr7r8r:rer&)rDparsers rrnzTestProgram._getParentArgParsersr((%8D+K#0!1  3 D)+#0!/  1 J[#/!E  G M #$(#!N  P ==   l'3%B  D"DM ?? "   il'3%N  P$DO ;;    jx'3%L  N DK  (   +='/6M%U  W%'D ! rctj|g}|j|_|j|_|j ddd|S)Nparentsr_r#z?a list of any number of test modules, classes and test methods.)nargsrx)r~rrArRrNrVr)rDparentrs rrozTestProgram._getMainArgParsersP((&:mm  ,,G3"8  9 rcXtj|g}d|jz|_d|_|j dddd|j d d d d |j d ddddD]3}|j |dtj tj 5|S)Nrz %s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrfz*Directory to start discovery ('.' default))rurxz-pz --patternr%z+Pattern to match tests ('test*.py' default)z-tz--top-level-directoryrgzrTextTestRunnerr.r{r9r7r:r<r*r+ TypeErrorrunrhresultr6testsRunr\skippedr4_NO_TESTS_EXITCODE wasSuccessful)rDr>s rrCzTestProgram.runTestssa ??   ?? "$33DO doot , / I!%4>>:>--8< :>--;?>>;?>> "1"KJ"J nnTYY/ 99{{##q(S1D1D-E-J+,**,  !I!%4>>:>--8< :>--"1"IJI  /!__.  /s,AE<C" &P=: HL $L * =!rr()rr4r~r r<rrsignalsr __unittestrrUrWrr!r&objectr(mainr$rrrsX  #    3 g&gTrPK!@M@M@"__pycache__/runner.cpython-312.pycnu[ ֦i(dZddlZddlZddlZddlmZddlmZddlm Z dZ Gdd e Z Gd d ejZGd d e Zy)z Running testsN)result)_SubTest)registerResultTc$eZdZdZdZdZddZy)_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodc||_yN)stream)selfr s (/usr/lib64/python3.12/unittest/runner.py__init__z_WritelnDecorator.__init__s  cL|dvr t|t|j|S)N)r __getstate__)AttributeErrorgetattrr )r attrs r __getattr__z_WritelnDecorator.__getattr__s' - - & &t{{4((rNcL|r|j||jdyN )write)r args r writelnz_WritelnDecorator.writelns  JJsO 4rr )__name__ __module__ __qualname____doc__rrrrr rrsJ) rrceZdZdZdZdZddfd ZdZfdZd Z fd Z fd Z fd Z fd Z fdZfdZfdZdZdZxZS)TextTestResultzhA test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------N durationsctt| |||||_|dkD|_|dk(|_||_d|_||_y)zwConstruct a TextTestResult. Subclasses should accept **kwargs to ensure compatibility as the interface changes.rTN) superr"rr showAlldots descriptions_newliner$)r r r) verbosityr$ __class__s r rzTextTestResult.__init__&sK nd,V\9M  1} N ( "rc|j}|jr|rdjt||fSt|Sr)shortDescriptionr)joinstr)r testdoc_first_lines r getDescriptionzTextTestResult.getDescription1s=..0   99c$i89 9t9 rctt| ||jrg|jj |j ||jj d|jjd|_yy)N ... F) r&r" startTestr'r rr3flushr*r r1r,s r r6zTextTestResult.startTest8sd nd-d3 << KK  d11$7 8 KK  g & KK   !DM rct|t}|s |jr|js|jj |r|jj d|jj |j ||jj d|jj ||jjd|_y)Nz r5T) isinstancerr*r rrr3r7)r r1status is_subtests r _write_statuszTextTestResult._write_status@sh/ == ##% !!$' KK  d11$7 8 KK  g & F#  rc||jr?t|d|jr|j|dn|j|dnv|jrjt|d|jr|j j dn|j j d|j jtt|+|||y)NrFAILERRORFE) r' issubclassfailureExceptionr=r(r rr7r&r" addSubTest)r r1subtesterrr,s r rEzTextTestResult.addSubTestMs ?||c!fg&>&>?&&w7&&w8c!fg&>&>?KK%%c*KK%%c* !!# nd.tWcBrctt| ||jr|j |dy|j r6|j jd|j jyy)Nok.) r&r" addSuccessr'r=r(r rr7r8s r rKzTextTestResult.addSuccess\sW nd.t4 <<   tT * YY KK  c " KK   rctt| |||jr|j |dy|j r6|j jd|j jyy)Nr@rB) r&r"addErrorr'r=r(r rr7r r1rGr,s r rMzTextTestResult.addErrordsY nd,T37 <<   tW - YY KK  c " KK   rctt| |||jr|j |dy|j r6|j jd|j jyy)Nr?rA) r&r" addFailurer'r=r(r rr7rNs r rPzTextTestResult.addFailurelsY nd.tS9 <<   tV , YY KK  c " KK   rctt| |||jr"|j |dj |y|j r6|jjd|jjyy)Nz skipped {0!r}s) r&r"addSkipr'r=formatr(r rr7)r r1reasonr,s r rSzTextTestResult.addSkiptsd nd+D&9 <<   t_%;%;F%C D YY KK  c " KK   rc6tt| |||jr6|jj d|jj y|jr6|jjd|jj yy)Nzexpected failurex) r&r"addExpectedFailurer'r rr7r(rrNs r rXz!TextTestResult.addExpectedFailure|sl nd6tSA << KK   2 3 KK    YY KK  c " KK   rc4tt| ||jr6|jj d|jj y|jr6|jjd|jj yy)Nzunexpected successu) r&r"addUnexpectedSuccessr'r rr7r(rr8s r r[z#TextTestResult.addUnexpectedSuccesssj nd8> << KK   4 5 KK    YY KK  c " KK   rc|js |jr4|jj|jj |j d|j |j d|jt|dd}|rt|jj|j|D]/}|jjd|j|1|jj yy)Nr@r?unexpectedSuccessesr zUNEXPECTED SUCCESS: ) r(r'r rr7printErrorListerrorsfailuresr separator1r3)r r]r1s r printErrorszTextTestResult.printErrorss 99 KK   ! KK    GT[[1 FDMM2%d,A2F  KK   0+ ##&:4;N;Nt;T:U$VW, KK    rcz|D]\}}|jj|j|jj|d|j||jj|j|jjd|z|jj y)Nz: z%s)r rrar3 separator2r7)r flavourr_r1rGs r r^zTextTestResult.printErrorListsID# KK   0 KK  GD4G4G4M N O KK   0 KK  s + KK     r)rrrrrardrr3r6r=rErKrMrPrSrXr[rbr^ __classcell__)r,s@r r"r"sYJJEI #"  C         rr"c:eZdZdZeZ d ddddZdZdZdZ y) TextTestRunnerzA test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. NF) tb_localsr$c|tj}t||_||_||_||_||_||_| |_ ||_ |||_ yy)zConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysstderrrr r)r+failfastbufferrir$warnings resultclass) r r r)r+rmrnrprorir$s r rzTextTestRunner.__init__sc >ZZF'/ ("   ""   "*D  #rc |j|j|j|j|jS#t $r4|j|j|j|jcYSwxYw)Nr#)rpr r)r+r$ TypeError)r s r _makeResultzTextTestRunner._makeResultss 4##DKK1B1B$(NNdnn$N N 4##DKK1B1B$(NN4 4 4sz0TextTestRunner._printDurations..sQqTrT)keyreverserzSlowest test durationsrdFgMbP?z%.3fs10 zA (durations < 0.001s were hidden; use -v to show these durations))collectedDurationssortedr$r rhasattrrdr+)r rlshiddenr1elapseds r _printDurationszTextTestRunner._printDurationss((  F--> " >>A OT^^$B 45 6< ( KK   1 1 2MD'~~!go KK  g.? F G   KK  !B C KK   #rc|j}t||j|_|j|_|j|_t j 5|j rt j|j tj}t|dd}|| ||t|dd}|| tj}dddz }|j|j|j|t|dr%|jj!|j"|j$}|jj!d||dk7xrdxsd|fz|jj!d x} x} } t't(|j*|j,|j.f} | \} } } g} |j2sr|jj5d t)|j6t)|j8}}|r| j;d |z|rS| j;d |zn>|d k(r| s|jj5d n|jj5d| r| j;d| z| r| j;d| z| r| j;d| z| r/|jj!ddj=| dn|jj5d|jj?|S#t|dd}||wwxYw#1swYxYw#t0$rYwxYw)z&Run the given test case or test suite. startTestRunN stopTestRunrdzRan %d test%s in %.3fsrrRr|rFAILEDz failures=%dz errors=%dz NO TESTS RANOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rsrrmrnrirocatch_warnings simplefiltertime perf_counterrrbr$rrr rrdtestsRunmaplenexpectedFailuresr]skippedr wasSuccessfulrr`r_appendr/r7)r r1r startTimerrstopTime timeTakenrun expectedFailsr]rresultsinfosfailederroreds r rzTextTestRunner.runs !!#v--  >>  $ $ &}}%%dmm4))+I"6>4@L' "V %fmTB *M((*H'y(  >> %   ( 6< ( KK   1 1 2oo 4 #("2s"8b)DE F 899 9+g B# 7 7 & : : & 01G ;B 7M.#v##% KK  h '!&//2C 4FGF ]V34 [723 AXg KK  n - KK  d #  LL/ 0  LL/-? @  LL25HH I  KK  499U+; = > KK  d #  e&fmTB *M+' &B   s7#AM2:M+M221M?M//M22M<? N  N )NTrFFNN) rrrrr"rprrsrrr rr rhrhs3 !KABJN+#t+*4$,Drrh)rrkrror|rcasersignalsr __unittestobjectr TestResultr"rhr rr rsN #     C V&&C L@V@rPK!.544&__pycache__/main.cpython-312.opt-1.pycnu[ ֦i.dZddlZddlZddlZddlZddlmZmZddlm Z dZ dZ dZ d Z d Zd Zd ZGd deZeZy)zUnittest main programN)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase c,tjj|r|jj drtjj |rttjj |tj}tjj |s|jtjr|S|}tjj|ddjddjddS|S)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths &/usr/lib64/python3.12/unittest/main.py _convert_namers  ww~~d 5 5e < 77== wwtRYY[9Hww}}X&(*=*=bii*H Dww%cr*224=EEc3OO Kc>|Dcgc] }t|c}Scc}wN)r)namesrs r_convert_namesr!/s,1 2EDM$ E 22 2scd|vrd|z}|S)N*z*%s*)patterns r_convert_select_patternr&3s '>7" Nrc eZdZdZdZdZdxZxZxZxZ xZ Z dZ dddde jddddddf ddddZdd Zd Zd Zdd Zd ZdZdZdZddZdZy) TestProgramzA command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. Nr__main__TF) tb_locals durationsc >t|trEt||_|j dddD]}t |j||_n||_|t j}||_||_ | |_ ||_ | |_ | |_ | |_| t jsd|_n| |_||_||_||_t(j*j-|d|_|j1||j3y)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr*r+ warnoptionswarnings defaultTest testRunner testLoaderr rbasenameprogName parseArgsrunTests)selfr1r=r5r>r?r6r9r7r8r:r<r*r+parts r__init__zTestProgram.__init__Cs fc "$V,DK S)!"-%dkk48 .!DK <88D   $" ""  COO&DM%DM&$$((a1  t rctjdt|r t||j|j |j tjdy)NzHTestProgram.usageExit() is deprecated and will be removed in Python 3.13) r<warnDeprecationWarningprint_discovery_parser_initArgParsers _print_helpr4r6)rDmsgs r usageExitzTestProgram.usageExitksP 01C E  #J  ! ! )  "   rcV|j\t|jjttd|j iz|j jyt|jjttd|j izy)Nprog) r1rK _main_parser format_help MAIN_EXAMPLESrArL print_helpMODULE_EXAMPLES)rDargskwargss rrNzTestProgram._print_helpusx ;;  $##//1 2 -64=="99 :  " " - - / $##//1 2 /VT]]$;; ""48,    ( (ab4 8::""2&    ( (ab4 8 ::+DJJ7DN:%"    %!DN ((# ."..0DN!$"2"23DN rc|jr|j|j_|rM| |jn|}|j|j|j|j |_y|j+|jj|j|_y|jj|j|j|_yr) testNamePatternsr?r[startr%toptestr`loadTestsFromModuler1loadTestsFromNames)rDfrom_discoveryLoaderrs rrczTestProgram.createTestss  /3/D/DDOO , (.T__FHF' DLL$((KDI ^^ #;;DKKHDI::4>>;?;;HDIrc||j}|j||_|j||_yr)_getParentArgParser_getMainArgParserrS_getDiscoveryArgParserrL)rD parent_parsers rrMzTestProgram._initArgParserss6002  22=A!%!tjd}|jdddddd |jd d ddd d |jdddd|jddtddd|j|jdddddd|_|j |jdddddd|_|j |jd d!d"dd#d|_|j!|jd$d%d&td'(g|_|S))NF)add_helpz-vz --verboser9 store_constrHzVerbose output)destactionconsthelpz-qz--quietrz Quiet outputz--localsr* store_truez"Show local variables in tracebacks)rurvrxz --durationsr+Nz+Show the N slowest test cases (N=0 for all))rutyper-metavarrxz-fz --failfastr7zStop on first fail or errorz-cz--catchr8z'Catch Ctrl-C and display results so farz-bz--bufferr:z%Buffer stdout and stderr during testsz-kreappendz.Only run tests which match the given substring)rurvr{rx) argparseArgumentParser add_argumentintr7r8r:rer&)rDparsers rrnzTestProgram._getParentArgParsersr((%8D+K#0!1  3 D)+#0!/  1 J[#/!E  G M #$(#!N  P ==   l'3%B  D"DM ?? "   il'3%N  P$DO ;;    jx'3%L  N DK  (   +='/6M%U  W%'D ! rctj|g}|j|_|j|_|j ddd|S)Nparentsr_r#z?a list of any number of test modules, classes and test methods.)nargsrx)r~rrArRrNrVr)rDparentrs rrozTestProgram._getMainArgParsersP((&:mm  ,,G3"8  9 rcXtj|g}d|jz|_d|_|j dddd|j d d d d |j d ddddD]3}|j |dtj tj 5|S)Nrz %s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrfz*Directory to start discovery ('.' default))rurxz-pz --patternr%z+Pattern to match tests ('test*.py' default)z-tz--top-level-directoryrgzrTextTestRunnerr.r{r9r7r:r<r*r+ TypeErrorrunrhresultr6testsRunr\skippedr4_NO_TESTS_EXITCODE wasSuccessful)rDr>s rrCzTestProgram.runTestssa ??   ?? "$33DO doot , / I!%4>>:>--8< :>--;?>>;?>> "1"KJ"J nnTYY/ 99{{##q(S1D1D-E-J+,**,  !I!%4>>:>--8< :>--"1"IJI  /!__.  /s,AE<C" &P=: HL $L * =!rr()rr4r~r r<rrsignalsr __unittestrrUrWrr!r&objectr(mainr$rrrsX  #    3 g&gTrPK!VD*__pycache__/__init__.cpython-312.opt-2.pycnu[ ֦i  gdZejgddZddlmZddlmZmZmZm Z m Z m Z m Z m Z mZmZddlmZmZddlmZmZddlmZmZdd lmZmZdd lmZmZmZmZdd lm Z m!Z!m"Z"d Z#d Z$y)) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContext)getTestCaseNames makeSuite findTestCasesT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrr)rrrc:tjdhzS)Nr)globalskeys*/usr/lib64/python3.12/unittest/__init__.py__dir__r$Ms 9>> 89 99r"cN|dk(r ddlmatStdtd|)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r# __getattr__r*Ps- ((7&& 78,.@I JJr"N)%__all__extend __unittestresultrcaserrrr r r rrrrsuiterrloaderrr r rrunnerrrsignalsrrrrrrrr$r*r!r"r#r4s^,\ IAB  ''',1#2PP>>:Kr"PK!)__pycache__/signals.cpython-312.opt-2.pycnu[ ֦ic zddlZddlZddlmZdZGddeZejZdZ dZ da dZ d d Z y) N)wrapsTceZdZdZdZy)_InterruptHandlercd|_||_t|trT|tj k(rtj }||_ y|tjk(r d}||_ ytd||_ y)NFcyN) unused_signum unused_frames )/usr/lib64/python3.12/unittest/signals.pydefault_handlerz3_InterruptHandler.__init__..default_handlerszYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr )selfr s r __init__z_InterruptHandler.__init__ sw / os +&..0"("<"< /!FNN2 / !233 /rctjtj}||ur|j|||jr|j||d|_t j D]}|jy)NT)r getsignalSIGINTr r_resultskeysstop)rsignumframeinstalled_handlerresults r __call__z_InterruptHandler.__call__sh",,V]]; D (   / ;;   / mmoF KKM&rN)__name__ __module__ __qualname__rr$r rr rr s /$ rrcdt|<y)N)rr#s r registerResultr+*s HVrc@ttj|dSr)boolrpopr*s r removeResultr/-s  VT* ++rctWtjtj}t |atjtjtyyr)_interrupt_handlerrrrr)r s r installHandlerr21s?! **6==9.? fmm%78"rctfd}|St3tjtjtjyy)Nc tjtj}t |i|tjtj|S#tjtj|wxYwr)rrr removeHandler)argskwargsinitialmethods r innerzremoveHandler..inner;sS&&v}}5G O 6t.v. fmmW5 fmmW5s A&B)rr1rrr)r9r:s` r r5r59sL  v 6  6 % fmm%7%H%HI&rr)rweakref functoolsr __unittestobjectrWeakKeyDictionaryrr+r/r1r2r5r rr r@sO   @ %7 $ $ &,9JrPK!\\(__pycache__/loader.cpython-312.opt-1.pycnu[ ֦i|RdZddlZddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z dZ ejdejZGdd e j"Zd Zd Zd Zd ZdZGddeZeZddZe j8dfdZde j8e j<fdZde j8e j<fdZ y)zLoading unittests.N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c,eZdZdZfdZfdZxZS) _FailedTestNc:||_tt||yN) _exceptionsuperr __init__)self method_name exception __class__s (/usr/lib64/python3.12/unittest/loader.pyrz_FailedTest.__init__s# k4)+6cX|jk7rtt|Sfd}|S)Ncjr )r rsr testFailurez,_FailedTest.__getattr__..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_test ImportError)r suiteClassmessages r_make_failed_import_testr*%s- i""$&G T;w#7W MMrcLdtj}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 -D tg  ''rctjt|d}||i}tdtjf|}|||fS)Ncyr rs r testSkippedz'_make_skipped_test..testSkipped4s r ModuleSkipped)rskipstrtypeTestCase)r.rr(r3attrs TestClasss r_make_skipped_testr;3sS YYs9~   %E_t}}&6>I y,. //rcFtjj|dS)Nr)ospathsplitext)r>s r _splitextr@;s 77  D !! $$rceZdZdZdZeejZdZ e jZ dZ fdZdZdddZddZdd Zd Zdd Zd 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|tjr td|tj tj fvrg}n"|j|}|st|drdg}|jt||}|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 TypeErrorrr8FunctionTestCasegetTestCaseNameshasattrr(map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCasez TestLoader.loadTestsFromTestCaseQs~ mU__ 5() ) T]]D,A,AB BM 11-@M W]I%F!* s=-'HI rpatternc$g}t|D]}}t||}t|ts t |t j s;|t j t jfvs^|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 isinstancer7rIrr8rLappendrSr( Exceptionr,rrD) rmodulerUtestsrobjrWe error_case error_messages rloadTestsFromModulezTestLoader.loadTestsFromModuleasKD&$'C3%sDMM2 t/D/DEE T77<= V\48 &  ! "!$w77   ",COOQ-9) M ""=1!!  "s/ B;; DAD D Dc |jd}d\}}|*|dd}|r dj|}t|} |dd}|} |D]} | t| | } } t| tj r|j#| St| t$rMt'| t(j*r3| t(j*t(j,fvr|j/| St| tj0rmt t$r]t'| t(j*rC|d}| |} tt| |tj0s.|j | gSt| t2j4r| St7| ra| }t|t2j4r|St|t(j*r|j |gSt9d| d |d t9d | 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(rDr[rYAttributeErrorr&r$r%rZtypes ModuleTypercr7rIrr8rLrS FunctionTyperrJcallablerK)rrr]partsrarb parts_copy module_namenext_attributer_partparentr`instr/s rloadTestsFromNamezTestLoader.loadTestsFromNameys 3$.! M >qJ *"%((:"6K' 4F!"IED &!73#5. c5++ ,++C0 0 sD !3 .DMM4+@+@AA--c2 2e001&/9D$". KK&&}5%%1Ba%002516-J KK&&}5%%% &s=H IAII K4(+K/K4A K/'K4/K4cl|Dcgc]}|j||}}|j|Scc}w)zReturn a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. )ryr()rnamesr]rsuitess rloadTestsFromNameszTestLoader.loadTestsFromNamess<DII54$((v65Iv&&Js1cfd}tt|t}jr/|j t j 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).0rUfullNames r zKTestLoader.getTestCaseNames..shouldIncludeMethod..sXBWwK'2BWs) startswithtestMethodPrefixrYrqrrtestNamePatternsany)attrnametestFuncrrrPs @rshouldIncludeMethodz8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<'<=}h7HH%!((-*D*Dh&H((D0YX$BWBWXX Yr)key)listfilterrXsortTestMethodsUsingsort functools cmp_to_key)rrPr testFnNamess`` rrMzTestLoader.getTestCaseNamessS Y6"5s=7IJK  $ $   !5!5d6O6O!P  Qrc|j}d}||j |j}n|d}|}tjj|}|tjvr tjj d|||_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__.pyrez2Can 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>abspathsysinsertisdirisfilerjrkmodulesridirname__file__rmrbuiltin_module_namesrK _get_directory_containing_moduleremover'r _find_testsr() r start_dirrU top_level_diroriginal_top_level_dirset_implicit_topis_not_importable the_moduletop_partr^s rdiscoverzTestLoader.discovers8"&!4!4   T%8%8%D //M  "# %M 6 ( HHOOA} -+! 77==3 4 2IM)(*rww||I}7](^$^! 39%![[3 $??3/2 ( ")<)<>!@I$*.*O*OPX*YD'HHOOM2 E QR RT%%i9:4u%%'&(!**c.F.FF')ABGKL(>znM#'( ( )$(! )s * I"AHAI" I0/I0ctj|}tjj |j }tjj |jjdrrrbasenamelowerrr)rrtr] full_paths rrz+TestLoader._get_directory_containing_module:s[)GGOOFOO4 77  I & , , . 9 9- H77??277??9#=> > 77??9- -rc||jk(ryttjj |}tjj ||j}|j tjjd}|S)Nre)rr@r=r>normpathrelpathreplacesep)rr>_relpathrs r_get_name_from_pathzTestLoader._get_name_from_pathFsg 4&& &))$/077??4)<)<= S1 rc>t|tj|Sr )rkrr)rrs r_get_module_from_namez TestLoader._get_module_from_nameRs4{{4  rct||Sr )r)rr>rrUs r _match_pathzTestLoader._match_pathVstW%%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.reN) rrF_find_test_pathsortedr=listdirr>rjaddrdiscard) rrrUrr^should_recursepathsr>rs rrzTestLoader._find_testsZs'' 2 3;4t'='==%)$8$8G$L !E>  !rzz),-D Y5I$($8$8G$L !E>  // :&&**409#// 7CCC**2248D**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?rTFNrrWT)r=r>rrVALID_MODULE_NAMEmatchrrrrrYr@realpathrrr'rcrSkipTestr;r(r*rDr[rrjrFrr)rrrUrrr]mod_filerfullpath_noext module_dirmod_name expected_dirmsgr`rarbrWr^packages rrzTestLoader._find_test_pathzs%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(rrrSrcryr}rMrrrrrrrr r!s@rrBrB?s'(:(:;JN' 6:0PJd'&S&j . !&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)warningswarnDeprecationWarningrrM)rPrrrrs rrMrMs? MM Eq vy;K L ] ]^k llrr/crddl}|jdtdt|||j |S)Nrzunittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.rr)rrrrrS)rPrrr(rs r makeSuitersB MM Jq vy* 5 K K rcrddl}|jdtdt|||j |S)Nrzunittest.findTestCases() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromModule() instead.rr)rrrrrc)r]rrr(rs r findTestCasesrsB MM Hq vy* 5 I I rrf)!rr=rerr$rnrrrrrr __unittestcompile IGNORECASErr8r r*r,r&r;r@objectrBdefaultTestLoaderrrrMrJrrr2rrrs  (  BJJ0"--@ $-- N . (0%CCL L 7;6H6H[_m%+d6H6H "(43E3E"__ rPK!#__pycache__/signals.cpython-312.pycnu[ ֦ic zddlZddlZddlmZdZGddeZejZdZ dZ da dZ d d Z y) N)wrapsTceZdZdZdZy)_InterruptHandlercd|_||_t|trT|tj k(rtj }||_ y|tjk(r d}||_ ytd||_ y)NFcyN) unused_signum unused_frames )/usr/lib64/python3.12/unittest/signals.pydefault_handlerz3_InterruptHandler.__init__..default_handlerszYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr )selfr s r __init__z_InterruptHandler.__init__ sw / os +&..0"("<"< /!FNN2 / !233 /rctjtj}||ur|j|||jr|j||d|_t j D]}|jy)NT)r getsignalSIGINTr r_resultskeysstop)rsignumframeinstalled_handlerresults r __call__z_InterruptHandler.__call__sh",,V]]; D (   / ;;   / mmoF KKM&rN)__name__ __module__ __qualname__rr$r rr rr s /$ rrcdt|<y)N)rr#s r registerResultr+*s HVrc@ttj|dSr)boolrpopr*s r removeResultr/-s  VT* ++rctWtjtj}t |atjtjtyyr)_interrupt_handlerrrrr)r s r installHandlerr21s?! **6==9.? fmm%78"rctfd}|St3tjtjtjyy)Nc tjtj}t |i|tjtj|S#tjtj|wxYwr)rrr removeHandler)argskwargsinitialmethods r innerzremoveHandler..inner;sS&&v}}5G O 6t.v. fmmW5 fmmW5s A&B)rr1rrr)r9r:s` r r5r59sL  v 6  6 % fmm%7%H%HI&rr)rweakref functoolsr __unittestobjectrWeakKeyDictionaryrr+r/r1r2r5r rr r@sO   @ %7 $ $ &,9JrPK!q&__pycache__/mock.cpython-312.opt-1.pycnu[ ֦iMdZddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZGdd eZeeDchc]}|j1d r|c}Zd ZeZd Zd ZdZdZ dZ!dZ"dydZ#dZ$dZ%dZ&dZ'dydZ(dZ)dZ*dZ+Gdde,Z-Gdde,Z.e.Z/e/j`Z0e/jbZ2e/jfZ4hd Z5d!Z6Gd"d#e7Z8d$Z9Gd%d&e,Z:Gd'd(e,Z;Gd)d*e;Z<e=ee<Dchc]$}|j1d+r|j}d+&c}Z?Gd,d-e7Z@d.ZAGd/d0e;ZBGd1d2eBe<ZCd3ZDGd4d5e,ZEd6ZFe0dddddfdd7d8ZG dzd9ZHe0dddddfdd7d:ZIGd;dZLeGeI_,eJeI_MeHeI_NeLeI_Od?eI_Pd@ZQdAZRdBjdCeRjDZUdBjdDeRjDZVhdEZWdFZXdBjeQeReUeVgjDchc]}dG|z c}ZYhdHZZdIhZ[eZe[zZ\eYeWzZ]e]e\zZ^hdJZ_dKdLdMdNdOZ`eaeaeaeadPddddQdRd dPddS ZbdTZcdUZddVZedWZfecedeeefdXZgdYZhGdZd[e;ZiGd\d]eie<ZjGd^d_eiZkGd`daeieCZlGdbdce;Zm ejee jdZpee ZqGdddee;ZsGdfdgesekeCZtGdhdie,ZueuZvdjZwGdkdlexZyeydmZz d{dd7dnZ{doZ|Gdpdqe,Z}e~e{e~evjfZdadadrZd|dsZGdtdueCZdvZGdwdxZycc}wcc}wcc}w#er$rdZpYwxYw)})Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockceZdZdZy)InvalidSpecErrorz8Indicates that an invalid value was used as a mock spec.N__name__ __module__ __qualname____doc__&/usr/lib64/python3.12/unittest/mock.pyrr)sBr"r_Tct|rt|tsyt|dr t |d}t |xst j|S)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r# _is_async_objr/5sGji&@sJc:& s # ?w':':3'??r"c4t|ddr t|Sy)N__code__F)r*r)funcs r#_is_async_funcr3=stZ&"4((r"c4tt|tSN) issubclasstyper r-s r#r'r'Ds d3i 11r"cjt|txs"t|txrt|tSr5)r( BaseExceptionr7r6r-s r# _is_exceptionr:Js-3 & A3@*S-"@r"cVt|trt|dr |jS|SNmock)r( FunctionTypesr)r=r-s r# _extract_mockr?Qs%#}%'#v*>xx r"cvt|tr|s|j}d}nRt|ttfrt|trd}|j }nt|t s |j}|r t|d}n|} |tj|fS#t$rYywxYw#t$rYywxYw)z Given an arbitrary, possibly callable object, try to create a suitable signature object. Return a (reduced func, signature) tuple, or None. TN) r(r7__init__ classmethod staticmethodr&r>__call__AttributeErrorrr+ signature ValueError)r2 as_instanceeat_selfsig_funcs r#_get_signature_objectrKZs $k}} D; 5 6 dK (H}} m , ==D4&W&&x000   s$( BB, B)(B), B87B8Fct|||y\}fd}t|||t|_t|_y)Nc*j|i|yr5bind)selfargskwargssigs r#checksigz"_check_signature..checksig$!&!r")rK_copy_func_detailsr7_mock_check_sig __signature__)r2r= skipfirstinstancerTrSs @r#_check_signaturer[}sI h :C {ID#"tX&!)DJ"DJr"c `dD]} t||t||y#t$rY)wxYw)N)rr __text_signature__r __defaults____kwdefaults__)setattrr*rE)r2funcopy attributes r#rVrVs:   GYi(@ A     s ! --ct|tryt|tttfrt |j St|ddyy)NTrDF)r(r7rCrBr _callabler&r*r-s r#rdrdsD#t# k:>?&&sJ%1 r"c0t|ttfvSr5)r7listtupler-s r#_is_listrhs 9u %%r"ct|tst|ddduS|f|jzD]}|jj dyy)ztGiven an object, return True if the object is callable. For classes, return True if instances would be callable.rDNTF)r(r7r*__mro____dict__get)r.bases r#_instance_callablernsV c4 sJ-T99$ ==  Z ( 4% r"c t|t}t|||}||S|\} fd}t|||j}|j sd}||d}d|z} t | |||} t| | | S)Nc*j|i|yr5rN)rQrRrSs r#rTz _set_signature..checksigrUr"ra) _checksig_r=zYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r(r7rKrVr isidentifierexec _setup_func) r=originalrZrYresultr2rTnamecontextsrcrarSs @r#_set_signaturerzs 8T*I "8Xy AF ~ ID#"tX&   D    %t4G $&* +C #wdmGs# Nr"c_fd}fd}fd}fd}fd}fd}fd} fd} d _d _d_t _t _t _j_j_ j_ |_ |_ |_ | _| _|_|_|_|__y) Nc(j|i|Sr5)assert_called_withrQrRr=s r#r}z'_setup_func..assert_called_with&t&&777r"c(j|i|Sr5) assert_calledr~s r#rz"_setup_func..assert_calleds!t!!42622r"c(j|i|Sr5)assert_not_calledr~s r#rz&_setup_func..assert_not_calleds%t%%t6v66r"c(j|i|Sr5)assert_called_oncer~s r#rz'_setup_func..assert_called_oncerr"c(j|i|Sr5)assert_called_once_withr~s r#rz,_setup_func..assert_called_once_withs+t++T.assert_has_callss$t$$d5f55r"c(j|i|Sr5)assert_any_callr~s r#rz$_setup_func..assert_any_calls#t##T4V44r"ct_t_jj}t |r|ur|jyyyr5) _CallList method_calls mock_calls reset_mock return_valuer')retrar=s r#rz_setup_func..reset_mocksL({&[ "" S !#+ NN +6 !r"Fr)r=called call_count call_argsrcall_args_listrrr side_effect_mock_childrenr}rrrrrrrrX_mock_delegate) rar=rSr}rrrrrrrs `` r#rtrtsGL8378=65GNGG&[G$;G"G,,G**G!00G!3G&=G#/G-G#G)G 1G!3GG!Dr"c tjj_d_d_t _fd}dD]}t|t||y)Nrc<tj||i|Sr5)r*r=)attrrQrRr=s r#wrapperz"_setup_async_mock..wrapper s 'wtyy$'888r")assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listr`r)r=rrbs` r#_setup_async_mockrsV ++99DDDO$;D 9,  i)!<=,r"cd|ddz|k(S)N__%s__r!rws r# _is_magicrs d1Rj D ((r"c"eZdZdZdZdZdZy)_SentinelObjectz!A unique, named, sentinel object.c||_yr5rrPrws r#rAz_SentinelObject.__init__"s  r"c d|jzSNz sentinel.%srrPs r#__repr__z_SentinelObject.__repr__%tyy((r"c d|jzSrrrs r# __reduce__z_SentinelObject.__reduce__(rr"N)rrrr rArrr!r"r#rr s'))r"rc"eZdZdZdZdZdZy) _SentinelzAAccess attributes to return a named object, usable as a sentinel.ci|_yr5) _sentinelsrs r#rAz_Sentinel.__init__.s r"cb|dk(rt|jj|t|S)N __bases__)rEr setdefaultrrs r# __getattr__z_Sentinel.__getattr__1s, ;  ))$0EFFr"cy)Nrr!rs r#rz_Sentinel.__reduce__7sr"N)rrrr rArrr!r"r#rr,sKG r"r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecftj|d|z}||fd}||fd}t||S)N_mock_cN|j}| t||St||Sr5)rr*)rPrw _the_namerSs r#_getz"_delegating_property.._getLs,!! ;4+ +sD!!r"cZ|j}|||j|<yt|||yr5)rrkr`)rPvaluerwrrSs r#_setz"_delegating_property.._setQs,!! ;',DMM) $ Cu %r")_allowed_namesaddproperty)rwrrrs r#_delegating_propertyrIs>t4I " $y& D$ r"ceZdZdZdZy)rct|tstj||St|}t|}||kDryt d||z dzD]}||||z}||k(syy)NFrT)r(rf __contains__lenrange)rPr len_valuelen_selfisub_lists r#rz_CallList.__contains__^sw%&$$T51 1J t9 x q(Y.23AAa k*H5 4r"c>tjt|Sr5)pprintpformatrfrs r#rz_CallList.__repr__ls~~d4j))r"N)rrrrrr!r"r#rr\s  *r"rct|}t|sy|js$|js|j |j y|}|||ury|j }||r||_||_|r||_||_y)NFT)r?r'rrrr)parentrrwnew_name_parents r#_check_and_set_parentrps % E U #   U11    '    +G   e **  !'' # r"ceZdZdZdZy) _MockIterc$t||_yr5)iterr.)rPr.s r#rAz_MockIter.__init__s 9r"c,t|jSr5)nextr.rs r#__next__z_MockIter.__next__sDHH~r"N)rrrrArr!r"r#rrs r"rceZdZeZdZdZy)BaseNcyr5r!rPrQrRs r#rAz Base.__init__s r")rrrrrrrAr!r"r#rrs  r"rceZdZdZeZ d,dZ d,dZdZd-dZ d.dZ d Z d Z d Z ee e e Zed Zed ZedZedZedZedZdZdZeeeZd/ddddedefdZdZdZdZdZdZ dZ!dZ"dZ#d0d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d-d(Z,d)Z-d*Z.d1d+Z/y)2r z A non-callable version of `Mock`NFc  |f} t|ts|xs|}|t|rt|f} t|j| d|j i}t t|j|}|S)Nr ) r6AsyncMockMixinr/r7rr _safe_superr __new__)clsspecrrwspec_setr _spec_state _new_name _new_parent_spec_as_instance _eat_selfunsaferRbasesspec_argnewrZs r#rzNonCallableMock.__new__sm#~.'4H# h(?'-3<<CKK(@A4<d..6&& D'C!$D  r"cj|j||j_y||_t||ddy)Nr%)rrrr)rPrs r#__set_return_valuez"NonCallableMock.__set_return_value*s2    */4D   ,&+D # !$tT :r"z1The value to be returned when the mock is called.cH|j t|S|jSr5)rr7rs r# __class__zNonCallableMock.__class__6s$    #: r"rrrrrc|j}| |jS|j}|8t|s-t |t st |st |}||_|Sr5)rrrcallabler(rr:)rP delegatedsfs r#__get_side_effectz!NonCallableMock.__get_side_effectCs\''  )) )  " " N8B<"2y1-:K2B$&I ! r"cTt|}|j}|||_y||_yr5) _try_iterrrr)rPrr/s r#__set_side_effectz!NonCallableMock.__set_side_effectNs-% ''  %*D "$)I !r"rrrrc|g}t||vry|jt|d|_d|_d|_t |_t |_t |_|r t|_ |rd|_ |jjD]/}t|ts|t ur|j#|||1|j}t%|r||ur|j#|yyy)z-Restore the mock object to its initial state.NFrr5)idr!rrrrrrrrrrrvaluesr( _SpecState_deletedrr')rPvisitedrrchildrs r#rzNonCallableMock.reset_mockYs ?G d8w  r$x  #+'k%K &-D # %)D "((//1E%,0A   W<[  Y2 %% S !co NN7 #'6 !r"c t|jdD]H\}}|jd}|j}|}|D]}t ||}t |||Jy)aZSet attributes on the mock through keyword arguments. Attributes plus return values and side effects can be set on child mocks using standard dot notation and unpacking a dictionary in the method call: >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError} >>> mock.configure_mock(**attrs)c*|djdS)Nr.)count)entrys r#z0NonCallableMock.configure_mock..sq1Dr")keyr?N)sorteditemssplitpopr*r`)rPrRargvalrQfinalr.rAs r#rzNonCallableMock.configure_mockyshv||~$E FHC 99S>DHHJECc5) C $Fr"c |dvr t||j$||jvs|tvr$td|zt|r t||jsD|jr||jvr*|j ds|t vrt|d|dtj5|jj|}|tur t||Jd}|jt|j|}|j|||||}||j|<nat|t rQ t#|j$|j&|j(|j*|j,}||j|<ddd|S#t.$r6|j0dxs|}t/d|d |d |d |j$d wxYw#1swYSxYw) N>rrzMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)rrwrrrrCannot autospec attr from target , as it has already been mocked out. [target=, attr=r)rEr _all_magicsrr startswith_ATTRIB_DENY_LISTr _lockrrlr:rr*r'r(r9r rrrZrrwrrk)rPrwrvr target_names r#rzNonCallableMock.__getattr__s  4 4 & &    +4---1D$%F%MNN t_ & &  $*<*<DL^L^@^OPTX\mTm$h''+h.KMNN " "((,,T2F!$T**##/$D$4$4d;E--d%4 $..4##D)FJ/ D, V__foo v{{F.4##D);#> (D"&-- "="EK*/x}&/*##'('&++CDDD/#> s&6B GAFG?GGG(c||jg}|j}|}d}|dgk(rd}|B|}|j|j|zd}|jdk(rd}|j}|Btt |}|j xsd}t |dkDr |ddvr|dz }||d<dj|S)Nr?r%rr=r)r%z().r)rrr!rfreversedrrjoin)rP _name_listrlastdot_firsts r#_extract_mock_namez"NonCallableMock._extract_mock_names))* '' $ C!D   g44s: ;C%%-..G!(:./ *F z?Q !}M1#  1 wwz""r"c|j}d}|dvrd|z}d}|j)d}|jrd}||jjz}dt |j||dt |dS) Nr)r=zmock.z name=%rz spec=%rz spec_set=%r)rarrrr7r7)rPrw name_string spec_strings r#rzNonCallableMock.__repr__s&&( ( ($t+K    '$K~~, %(8(8(A(AAK J     tH   r"ctstj|S|jxsg}t t |}t |j}|jjDcgc]\}}|tur|}}}|Dcgc]}|jdr|}}|Dcgc] }|jdr t|r|"}}tt||z|z|zScc}}wcc}wcc}w)z8Filter the output of `dir(mock)` to only useful members.r$)r object__dir__rr r7rfrkrrEr:rVrrDset)rPextras from_type from_dictm_namem_valuefrom_child_mockses r#rhzNonCallableMock.__dir__s>>$' '##)rT O ' *.*=*=*C*C*E(*Evwh& *E (!*C 1c1BQ C )# 1c1Bq\ #c&9,y8;KKLMM(D#s2C2 C8$C8.%C=c`|tvrtj||Sjr6j*|jvr|j vrt d|z|tvrd|z}t ||tvrj|jvrt d|zt|s)tt|t|||fd}n^t|d|tt|||j|<n*|dk(r|_yt|||r|j|<j r/t#|s#j%d|}t d|t'|t(r|j |<ytj||S)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.cg|i|Sr5r!)rQkwrurPs r#rBz-NonCallableMock.__setattr__..sHT,GD,GB,Gr"r,r?z Cannot set )rrg __setattr__rrrkrE_unsupported_magicsrUr'r`r7 _get_methodrrrrr)rar(r)rPrwrmsg mock_namerus` @r#rtzNonCallableMock.__setattr__s > !%%dD%8 8nn!3!3!? ** *  % !Dt!KL L ( (BTIC % % [ !!-$d>P>P2P$%H4%OPP$U+T D+dE*BC G&dE4>T D%0,1##D) [ $D  $T5$=,1##D)   WT4%82245Qtf=I ;yk!:; ; e\ *"'DMM$  !!$e44r"c|tvr;|t|jvr$tt||||jvry|jj |t }||jvr tt|j|n|tur t||t ur |j|=t|j|<yr5) rUr7rkdelattrrrl_missingrr __delattr__r:rE)rPrwr.s r#r|zNonCallableMock.__delattr__+s ; 44:+>+>#> DJ %4==(!!%%dH5 4==  . : :4 @ H_ & & h ##D)$,D!r"c<|jxsd}t|||Sr<)r_format_call_signaturerPrQrRrws r#_format_mock_call_signaturez+NonCallableMock._format_mock_call_signature=s(&%dD&99r"cpd}|j||}|j}|j|}||||fzS)Nz0expected %s not found. Expected: %s Actual: %s)rr)rPrQrRactionmessageexpected_stringr actual_strings r#_format_mock_failure_messagez,NonCallableMock._format_mock_failure_messageBsFF::4HNN 888)D &/=AAAr"c |s |jSd}|jddjd}|j}|D]K}|j |}|t |t r|St|}|j}|j}M|S)aH * If call objects are asserted against a method/function like obj.meth1 then there could be no name for the call object to lookup. Hence just return the spec_signature of the method/function being asserted against. * If the name is not empty then remove () and split by '.' to get list of names to iterate through the children until a potential match is found. A child mock is created only during attribute access so if we get a _SpecState then no attributes of the spec were accessed and can be safely exited. Nr%rr?)rreplacerFrrlr(r9r?)rPrwrSnameschildrenr<s r#_get_call_signature_from_namez-NonCallableMock._get_call_signature_from_nameJs'' ' T2&,,S1&&DLL&E} 5* = &e, //++ r"cvt|tr#t|dkDr|j|d}n |j}|Pt|dk(rd}|\}}n|\}}} |j |i|}t ||j|jS|S#t$r}|jdcYd}~Sd}~wwxYw)a Given a call (or simply an (args, kwargs) tuple), return a comparison key suitable for matching with other calls. This is a best effort method which relies on the spec's signature, if available, or falls back on the arguments themselves. rrNr) r(rgrrrrOrrQrR TypeErrorwith_traceback)rP_callrSrwrQrR bound_callrps r# _call_matcherzNonCallableMock._call_matcherks eU #E Q44U1X>C&&C ?5zQ$ f%*"dF .%SXXt6v6 D*//:3D3DEEL .''-- .s2B B8B3-B83B8c|jdk7r._error_messages33D&ACJr"Ttwo)rrrr_Callr( Exception)rPrQrRexpectedactual error_messagercauses``` r#r}z"NonCallableMock.assert_called_withs >> !77fEH"F)M / / %%eT6N&EF##DNN3 X  *8Y ?HTE !12 = r"c|jdk(sz3NonCallableMock.assert_has_calls..FAZ9-EaNc3@K|]}j|ywr5rrcrPs r#rz3NonCallableMock.assert_has_calls..sM_d003_zCalls not found.z+Error processing expected calls. Errors: {} Expected: z Actual)prefixr?r=z does not contain all of z in its call list, found z instead)rrrrformatr(rrrrstriprfremoverGr!rrg) rPcalls any_orderrrr all_callsproblemrp not_foundkalls ` r#rz NonCallableMock.assert_has_callss~4995aD&&q)59FFMMT__MM y(=0G ,-3V-5$7-5*4Ay)AAt$K-5$7.8%i !!*5!1 2''z':AA#FGI  O  D '  &  &*oo&?&?&+I&6 C   7:$7 '  & 'sD+D#D((EEc"|jt||fd}t|tr|nd}|jDcgc]}|j|}}|s |t |vr!|j ||}td|z|ycc}w)zassert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if the call is the most recent one.TrNz%s call not found)rrr(rr _AnyComparerrrrPrQrRrrrrrs r#rzNonCallableMock.assert_any_calls %%eT6N&EF&x;151D1DE1DA$$$Q'1DE HL$88">>tVLO #o5 9FB c J|jr,d|vrd|dnd}|j|z}t||jd}||jdvr t di|St |}t|tr|tvrt }nt|tr0|tvs|jr||jvrt}nTt }nMt|ts.t|trt}n&t|trt }n|j"d}di|S)aPCreate the child mocks for attributes and return value. By default child mocks will be the same type as the parent. Subclasses of Mock may want to override this to customize the way child mocks are made. For non-callable mocks the callable variant will be used (rather than any custom subclass).rwr?r%rrrr!)rrarErlrkr r7r6r_async_method_magicsr_all_sync_magicsr CallableMixinr r rrj)rPrsrbrxr_typeklasss r#r'zNonCallableMock._get_child_mocks   ,2bL!BvJ<(dI//1I=I + +FF;'  n5 5?r? "T  eY 'I9M,ME ~ .--&&98J8J+J!!E=1%!56!E?3MM!$E{r{r"cT|jsyd|dt|jdS)zRenders self.mock_calls as a string. Example: " Calls: [call(1), call(2)]." If self.mock_calls is empty, an empty string is returned. The output will be truncated if very long. r z: r?)rr)rPrs r#rzNonCallableMock._calls_repr's-F82i89;;r") NNNNNNrNFNFF)FFr5)r)Calls)0rrrr rrXrrArrr"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr,rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrboolrrrrarrhrtr|rrrrrrrr}rrrr'rr!r"r#r r s`* GE=AEIBEI, 8*Z  #L  !,!;!;c!AN!R&66K-%r"c|j}|Bt|r|t|st|}t|r |||i|}|tur|S|j tur |j S|jr(|jj tur |j S|j|j|i|S|j Sr5) rr:rdrrrrrr)rPrQrReffectrvs r#rz CallableMixin._execute_mock_calls!!  V$ v&f ( L00W$  " "' 1$$ $   4#6#6#C#C7#R$$ $    '#4##T4V4 4   r") rrrrrArWrDrrrr!r"r#rr[s8 d$d!RT ' 08,7\!r"rceZdZdZy)ra Create a new `Mock` object. `Mock` takes several optional arguments that specify the behaviour of the Mock object: * `spec`: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an `AttributeError`. If `spec` is an object (rather than a list of strings) then `mock.__class__` returns the class of the spec object. This allows mocks to pass `isinstance` tests. * `spec_set`: A stricter variant of `spec`. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as `spec_set` will raise an `AttributeError`. * `side_effect`: A function to be called whenever the Mock is called. See the `side_effect` attribute. Useful for raising exceptions or dynamically changing return values. The function is called with the same arguments as the mock, and unless it returns `DEFAULT`, the return value of this function is used as the return value. If `side_effect` is an iterable then each call to the mock will return the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. * `unsafe`: By default, accessing any attribute whose name starts with *assert*, *assret*, *asert*, *aseert*, or *assrt* raises an AttributeError. Additionally, an AttributeError is raised when accessing attributes that match the name of an assertion method without the prefix `assert_`, e.g. accessing `called_once` instead of `assert_called_once`. Passing `unsafe=True` will allow access to these attributes. * `wraps`: Item for the mock object to wrap. If `wraps` is not None then calling the Mock will pass the call through to the wrapped object (returning the real result). Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist will raise an `AttributeError`). If the mock has an explicit `return_value` set then calls are not passed to the wrapped object and the `return_value` is returned instead. * `name`: If the mock has a name then it will be used in the repr of the mock. This can be useful for debugging. The name is propagated to child mocks. Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. Nrr!r"r#rrs7r"rc:d}|D]}||vst|dy)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r#_check_spec_arg_typosrs1 2E ? "(OP r"ceZdZdZgZdddZdZdZdZe jdZ d Z d Z d Zd Zd ZdZdZy)_patchNFrc ~| |tur td| td| s t| t|rt d|d|dt|rt d|d|d||_||_||_||_||_ ||_ d|_ ||_ ||_ | |_g|_d|_y)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=rz? as the spec_set target has already been mocked out. [spec_set=F)rrGrr'rgetterrbr new_callablercreate has_localrautospecrRadditional_patchers is_started) rPrrbrrrrrrrRrs r#rAz_patch.__init__s  #'! B# G !& ) T ""#I=166:XQ@A A X &"#I=1AAI AOP P "(       #% r"c ft|j|j|j|j|j |j |j|j|j }|j|_ |jDcgc]}|jc}|_ |Scc}wr5) rrrbrrrrrrrRattribute_namercopy)rPpatcherps r#rz _patch.copy7s KK499 KK MM4,,dkk  "&!4!4"66' 6AFFH6' #' s B.ct|tr|j|Stj|r|j |S|j |Sr5r(r7decorate_classr+rdecorate_async_callabledecorate_callable)rPr2s r#rDz_patch.__call__DsM dD !&&t, ,  & &t ,//5 5%%d++r"ct|D]^}|jtjs#t ||}t |ds<|j }t||||`|SNrD)r rVr TEST_PREFIXr*r)rr`)rPrr attr_valuers r#r z_patch.decorate_classLsaJD??5#4#45 -J:z2iikG E4!4 5 r"c#RKg}tj5}|jD]U}|j|}|j|j |2|j tusE|j|W|t|z }||fdddy#1swYyxYwwr5) contextlib ExitStack patchings enter_contextrupdaterrr!rg)rPpatchedrQkeywargs extra_args exit_stackpatchingrHs r#decoration_helperz_patch.decoration_helperZs  ! ! #z#-- ..x8**6OOC(\\W,%%c* . E*% %D" "$ # #s#B'AB+'B B'B$ B'ctdrjjStfdg_S)Nrclj||5\}}|i|cdddS#1swYyxYwr5rrQrnewargs newkeywargsr2rrPs r#rz)_patch.decorate_callable..patchedos=''(,(025Kg{W4 4222s *3r)rr!rrPr2rs``@r#r z_patch.decorate_callableisK 4 % NN ! !$ 'K t 5  5 "Fr"ctdrjjStfdg_S)NrcKj||5\}}|i|d{cdddS7 #1swYyxYwwr5rrs r#rz/_patch.decorate_async_callable..patchedsN''(,(025Kg{!7:k::22;22s#A646 A6?Ar"r#s``@r#r z_patch.decorate_async_callablezsK 4 % NN ! !$ 'K t ;  ; "Fr"cH|j}|j}t}d} |j|}d}|tvrt|trd|_ |js|turt |d|||fS#tt f$rt ||t}YiwxYw)NFTz does not have the attribute ) rrbrrkrEKeyErrorr* _builtinsr(rr)rPtargetrwrulocals r# get_originalz_patch.get_originals~~ t,HE 9 FJ!?DK{{x72 7=tD ) 6vtW5H 6sA>> B! B!c J|jr td|j|j|j}}}|j |j }}|j}|j|_ |durd}|durd}|durd}| | td|||dvr td|j\}}|turl|id} |dur |}|dur|}d}n| |dur |}d}n|dur|}||%|tur tdt|trd} ||} nb|t|rt } nN||D|} ||} t#| rd | v} n t%|  } t| rt } n| rt&} n t(} nt(} i} ||| d <||| d <t| tr+t+| t,r|j.r|j.| d <| j1|| di| }| rFt3|r:|} ||} t#| st5| st&} | j7d | d|d d| |_n||tur td|tur tdt;|}|dur|}t3|jr)t=d|j.d|jd|dt3|rMt?|jd|j}t=d|j.d|d|jd|d tA|f||j.d|}n |r td|}||_!||_"tGjH|_%d|_ tM|j|j.||jNui}|jtur|||jN<|jPD]A}|jJjS|}|jtus1|j1|C|S|S#|jTtWjXsYyxYw)zPerform the patch.zPatch is already startedFNzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerDrrrwr%r&zBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=TruerQz: as the patch target has already been mocked out. [target=rTrrrRrS)r_namez.Can't pass kwargs to a mock we aren't creatingr!)-rrrrrrrRrrr)rr+rr(r7r/r rhr.r rr6r rbrr'rnrGrrrr*r temp_originalis_localrr _exit_stackr`rrr__exit__sysexc_info)rPrrrrrRrrur*inheritKlass this_spec not_callable_kwargsrYnew_attrrrrHs r# __enter__z_patch.__enter__s ??9: :"hh 4==8T==$++&(( kkm  5=D u H u H   4=> >  !5 L (TU U++-% '>h.Gt|t#'HD!t##HDT!#8#7w&#$GHHh-"G'$-"9!!X%9 ' (II&#-Y#>L'/ ':#:L +%E!0E%E!G"&#&. #5$'5/2t~~"&.. NN6 ""'"C,S1! ' (I +&y10E F##($4SD$4+2$4  !'!(7" GHHH~H4# -&+DNN+=>#{{oWXLCDD!*%dkk:t{{K &+DNN+=]"o&#{{oWXLCDD "(BX(,B:@BC LM M% %//1  DKK :"". 88w&7:Jt223 $ 8 8H**88BC||w."))#.!9"!J  4==#,,.12sB O<%O<:O<<$P"c|jsy|jr>|jtur,t |j |j |jnt|j |j |jsYt|j |j r|j dvr+t |j |j |j|`|`|`|j}|` d|_|j|S)zUndo the patch.N)r rr^__annotations__r_F) rr/r.rr`r)rbrzrr)r0r1)rPr3rs r#r1z_patch.__exit__=s  ==T//w> DKK1C1C D DKK 0;; T^^(L+== T^^T5G5GH   M K%%  "z""H--r"c\|j}|jj||Sz-Activate a patch, returning any created mock.)r:_active_patchesr!rPrvs r#startz _patch.startVs'! ##D) r"c~ |jj||jdddS#t$rYywxYwzStop an active patch.N)r?rrGr1rs r#stopz _patch.stop]sD   ' ' - }}T4..   s 0 <<)rrrrr?rArrDr rcontextmanagerrr r r+r:r1rArDr!r"r#rr sgNOAF# L ,  # #""0Xt.2/r"rc |jdd\}}t t j ||fS#tttf$rtd|wxYw)Nr?rz,Need a valid target to patch. You supplied: )rsplitrrGrErpkgutil resolve_name)r)rbs r# _get_targetrJisjG"MM#q1  7'' 0) ;; z> 2G:6* EG GGs 3#Arc vtturtdfd} t| |||||||| | S)a patch the named member (`attribute`) on an object (`target`) with a mock object. `patch.object` can be used as a decorator, class decorator or a context manager. Arguments `new`, `spec`, `create`, `spec_set`, `autospec` and `new_callable` have the same meaning as for `patch`. Like `patch`, `patch.object` takes arbitrary keyword arguments for configuring the mock object it creates. When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. z3 must be the actual object to be patched, not a strcSr5r!r)sr#rBz_patch_object..sVr"r)r7strrr) r)rbrrrrrrrrRrs ` r# _patch_objectrOrsS$ F|sjK L  F  3f(L& r"c ~tturttj}nfd}|s t dt |j}|d\} } t|| | |||||i } | | _ |ddD]:\} } t|| | |||||i } | | _ | jj| <| S)aPerform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the patches:: with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): ... Use `DEFAULT` as the value if you want `patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, and a dictionary is returned when `patch.multiple` is used as a context manager. `patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments `spec`, `spec_set`, `create`, `autospec` and `new_callable` have the same meaning as for `patch`. These arguments will be applied to *all* patches done by `patch.multiple`. When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX` for choosing which methods to wrap. cSr5r!rMsr#rBz!_patch_multiple..sr"z=Must supply at least one keyword argument with patch.multiplerrN) r7rNrrHrIrGrfrErrrr!) r)rrrrrrRrrErbrr this_patchers ` r#_patch_multiplerSs, F|s--v6  K    E1XNIs 3fh,G'G) 3 IsD&( lB '0 ###**<8 $ Nr"c Ht|\} } t| | |||||||| S)a: `patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the `target` is patched with a `new` object. When the function/with statement exits the patch is undone. If `new` is omitted, then the target is replaced with an `AsyncMock if the patched object is an async function or a `MagicMock` otherwise. If `patch` is used as a decorator and `new` is omitted, the created mock is passed in as an extra argument to the decorated function. If `patch` is used as a context manager the created mock is returned by the context manager. `target` should be a string in the form `'package.module.ClassName'`. The `target` is imported and the specified object replaced with the `new` object, so the `target` must be importable from the environment you are calling `patch` from. The target is imported when the decorated function is executed, not at decoration time. The `spec` and `spec_set` keyword arguments are passed to the `MagicMock` if patch is creating one for you. In addition you can pass `spec=True` or `spec_set=True`, which causes patch to pass in the object being mocked as the spec/spec_set object. `new_callable` allows you to specify a different class, or callable object, that will be called to create the `new` object. By default `AsyncMock` is used for async functions and `MagicMock` for the rest. A more powerful form of `spec` is `autospec`. If you set `autospec=True` then the mock will be created with a spec from the object being replaced. All attributes of the mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise a `TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. Instead of `autospec=True` you can pass `autospec=some_object` to use an arbitrary object as the spec instead of the one being replaced. By default `patch` will fail to replace attributes that don't exist. If you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! Patch can be used as a `TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods share a common patchings set. `patch` finds tests by looking for method names that start with `patch.TEST_PREFIX`. By default this is `test`, which matches the way `unittest` finds tests. You can specify an alternative prefix by setting `patch.TEST_PREFIX`. Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use "as" then the patched object will be bound to the name after the "as"; very useful if `patch` is creating a mock object for you. Patch will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `patch` takes arbitrary keyword arguments. These will be passed to `AsyncMock` if the patched object is asynchronous, to `MagicMock` otherwise or to `new_callable` if specified. `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are available for alternate use-cases. r)rJr) r)rrrrrrrrRrrbs r#rrs7V$F+FI  3f(L& r"cTeZdZdZddZdZdZdZdZdZ dZ d Z d Z d Z d Zy ) _patch_dicta# Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test. `in_dict` can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys. `in_dict` can also be a string specifying the name of the dictionary, which will then be fetched by importing it. `values` can be a dictionary of values to set in the dictionary. `values` can also be an iterable of `(key, value)` pairs. If `clear` is True then the dictionary will be cleared before the new values are set. `patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary:: with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()): ... `patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator `patch.dict` honours `patch.TEST_PREFIX` for choosing which methods to wrap. c ||_t||_|jj|||_d|_yr5)in_dictdictr8rclear _original)rPrXr8rZrRs r#rAz_patch_dict.__init__/s4 6l  6" r"ct|tr|j|Stj|r|j |S|j |Sr5r)rPfs r#rDz_patch_dict.__call__8sM a &&q) )  & &q )//2 2%%a((r"c2tfd}|S)Ncj |i|jS#jwxYwr5rV _unpatch_dictrQrsr]rPs r#_innerz-_patch_dict.decorate_callable.._innerAs8     %$~"~""$""$s+=rrPr]rcs`` r#r z_patch_dict.decorate_callable@ q %  % r"c2tfd}|S)NcKj |i|d{jS7#jwxYwwr5r`rbs r#rcz3_patch_dict.decorate_async_callable.._innerMsD     %^^+""$,""$s%A  757A 7A  A rdres`` r#r z#_patch_dict.decorate_async_callableLrfr"ct|D]{}t||}|jtjs/t |ds>G - NN8 $ -'}   -s7AAc<|j|jy)zUnpatch the dict.F)r[ra)rPrQs r#r1z_patch_dict.__exit__s >> %    r"cd|j}tjj||Sr>)r:rr?r!r@s r#rAz_patch_dict.starts'!%%d+ r"c tjj||j dddS#t$rYywxYwrC)rr?rrGr1rs r#rDz_patch_dict.stopsD   " " ) )$ / }}T4..   s4 AAN)r!F)rrrr rArDr r r r:rVrar1rArDr!r"r#rVrVs>8)   +8 -/r"rVcn |jy#t$rt|}|D]}||=YywxYwr5)rZrErf)rXkeysrCs r#rnrns9  G}C s 44c`ttjD]}|jy)z7Stop all active patches. LIFO to unroll nested patches.N)r[rr?rD)rs r#_patch_stopallrvs &001 2r"testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c#&K|] }d|z yw)zi%sNr!rns r#rrs7&6519&6c#&K|] }d|z yw)zr%sNr!rzs r#rrs5$4q$4r|>rh__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c fd}||_|S)z:Turns a callable object (like a mock) into a real functionc|g|i|Sr5r!)rPrQrsr2s r#methodz_get_method..methodsD&4&2&&r")r)rwr2rs ` r#rvrvs'FO Mr"r> __aexit__ __anext__ __aenter__ __aiter__>__del__rrAr __prepare__rt__instancecheck____subclasscheck__c,tj|Sr5)rg__hash__rs r#rBrBs V__T2r"c,tj|Sr5)rg__str__rs r#rBrBs FNN40r"c,tj|Sr5)rg __sizeof__rs r#rBrBsv006r"cjt|jd|jdt|S)N/)r7rrar7rs r#rBrBs3$t*"5"5!6a8O8O8Q7RRSTVW[T\S]^r")rrr __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r1 __complex__ __float____bool__ __index__rcfd}|S)NcZjj}|tur|S|urytSNT)__eq__rrNotImplemented)otherret_valrPs r#rz_get_eq..__eq__s/++00 ' !N 5=r"r!)rPrs` r#_get_eqrs Mr"cfd}|S)Nc^jjturtS|urytSNF)__ne__rrr)rrPs r#rz_get_ne..__ne__#s* ;; ) ) 8N 5=r"r!)rPrs` r#_get_ner"s Mr"cfd}|S)Ncljj}|tur tgSt|Sr5)__iter__rrrrrPs r#rz_get_iter..__iter__,s/--22 g 8OG}r"r!)rPrs` r# _get_iterr+s Or"cfd}|S)Ncjj}|turtt gStt |Sr5)rrr_AsyncIteratorrrs r#rz"_get_async_iter..__aiter__6s8..33 g !$r(+ +d7m,,r"r!)rPrs` r#_get_async_iterr5s- r")rrrrctj|t}|tur||_ytj|}|||}||_yt j|}||||_yyr5)_return_valuesrlrr_calculate_return_value_side_effect_methodsr)r=rrwfixedreturn_calculatorr side_effectors r#_set_return_valuerFs{   tW -E G#/33D9$(. *(,,T2M *40!r"ceZdZdZdZy) MagicMixinc|jtt|j|i||jyr5)_mock_set_magicsrrrA)rPrQrss r#rAzMagicMixin.__init__Ys6 . J%..;; r"c zttz}|}t|ddU|j|j}t }||z }|D]&}|t |jvst||(|t t |jz }t |}|D]}t||t||y)Nr) _magicsrr* intersectionrrir7rkrzr` MagicProxy)rP orig_magics these_magics remove_magicsrArs r#rzMagicMixin._mock_set_magics_s 44 " 4$ / ;&33D4F4FGLEM',6M&DJ///D%(' $c$t**=*=&>> T !E E5*UD"9 :"r"N)rrrrArr!r"r#rrXs  ;r"rceZdZdZddZy)r z-A version of `MagicMock` that isn't callable.cH|j|||jyrrrrs r#rz"NonCallableMagicMock.mock_add_specy D(+ r"Nr)rrrr rr!r"r#r r ws 7 r"r c eZdZy)AsyncMagicMixinN)rrrr!r"r#rrsr"rc6eZdZdZddZdddeffdZxZS)ra MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself. If you use the `spec` or `spec_set` arguments then *only* magic methods that exist in the spec will be created. Attributes and the return value of a `MagicMock` will also be `MagicMocks`. FcH|j|||jyrrrs r#rzMagicMock.mock_add_specrr")rrc|r#|jrt|jrd}tj|d|i|y)NFr)rrsuperr)rPrrQrRr,s r#rzMagicMock.reset_mocks< $//* !LDF|FvFr"r)rrrr rrr __classcell__r,s@r#rrs&  9> G G Gr"rc eZdZdZdZddZy)rc ||_||_yr5rwr)rPrwrs r#rAzMagicProxy.__init__s  r"c|j}|j}|j|||}t|||t ||||S)N)rwrr)rwrr'r`r)rPrArms r# create_mockzMagicProxy.create_mocksM   " "/5 # 7q!&!U+r"Nc"|jSr5)r)rPr.rs r#r~zMagicProxy.__get__s!!r"r5)rrrrArr~r!r"r#rrs"r"rceZdZedZedZedZfdZdZdZ dZ dZ d Z d Z dd Zd Zfd ZxZS)rrrrctj|i|tjj|j d<d|j d<d|j d<t |j d<tr7tt}t|j d<t|j d<ntt}tjtjztjz|_d|_d |_d|_d|_||j d <d |j d <t)|j d <i|j d<d|j d<y)Nrr_mock_await_count_mock_await_args_mock_await_args_listrrr)rQrRr1r rr^r_r<)rrArrrrkr _CODE_SIGr _CODE_ATTRSrr+ CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountrg)rPrQrR code_mockr,s r#rAzAsyncMockMixin.__init__s6$)&)*1););)I)I o&-. )*,0 ()1: -. '=I08I  } -4=I  0 1':I     !$$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(r"cKt||fd}|xjdz c_||_|jj ||j }|_t |r|t|s t|}t |r&|t|r||i|d{}n||i|}|tur|S|jtur |jS|jAt|jr|j|i|d{S|j|i|S|jS#t$rtwxYw777w)NTrr)rrrrr!rr:rdr StopIterationStopAsyncIterationrrrrr)rPrQrRrrrvs r#rz!AsyncMockMixin._execute_mock_callsTtVn$/ A ##E*!!  V$ v&-!&\F !( L$V,%t6v6600W$  " "' 1$$ $    '"4#3#34-T--t>v>>>#4##T4V4 4   -%--,-7?s=A-E0 D-;#EEA+E E "E-D==EEc`|jdk(rd|jxsdd}t|y)zA Assert that the mock was awaited at least once. r Expected r=z to have been awaited.Nrrrrs r#rzAsyncMockMixin.assert_awaited s;   q doo788NOC % % !r"cz|jdk(s,d|jxsdd|jd}t|y)z@ Assert that the mock was awaited exactly once. rrr=$ to have been awaited once. Awaited rNrrs r#rz"AsyncMockMixin.assert_awaited_once sM1$t8&9:#//09C % %%r"c8j!j}td|dfd}jt fd}jj}||k7r%t |t r|nd}t||y)zN Assert that the last await was with the specified arguments. NzExpected await: z Not awaitedc0jd}|S)Nawait)rrrs r#rz:AsyncMockMixin.assert_awaited_with.._error_message( s33D&3QCJr"Tr)rrrrrr(r)rPrQrRrrrrs``` r#rz"AsyncMockMixin.assert_awaited_with s ?? "77fEH #3H:]!KL L %%eT6N&EF##DOO4 X  *8Y ?HTE !12 = r"c|jdk(s,d|jxsdd|jd}t||j|i|S)zi Assert that the mock was awaited exactly once and with the specified arguments. rrr=rr)rrrrrs r#rz'AsyncMockMixin.assert_awaited_once_with2 s` 1$t8&9:#//09C % %'t''888r"c"|jt||fd}t|tr|nd}|jDcgc]}|j|}}|s |t |vr!|j ||}td|z|ycc}w)zU Assert the mock has ever been awaited with the specified arguments. TrNz%s await not found)rrr(rrrrrrs r#rzAsyncMockMixin.assert_any_await= s%%eT6N&EF&x;151E1EF1EA$$$Q'1EF HL$88">>tVLO $6 9Grc @|Dcgc]}j|}}td|Dd}tfdjD}|sb||vr]|d}n1dj |Dcgc]}t |t r|ndc}}t|dt|dj|yt|}g} |D]} |j| | rtt| d|ycc}wcc}w#t$r| j| YXwxYw) a Assert the mock has been awaited with the specified calls. The :attr:`await_args_list` list is checked for the awaits. If `any_order` is False (the default) then the awaits must be sequential. There can be extra calls before or after the specified awaits. If `any_order` is True then the awaits can be in any order, but they must all appear in :attr:`await_args_list`. c3BK|]}t|ts|ywr5rrs r#rz3AsyncMockMixin.assert_has_awaits..W rrNc3@K|]}j|ywr5rrs r#rz3AsyncMockMixin.assert_has_awaits..X sS>Rt11!4>RrzAwaits not found.z,Error processing expected awaits. Errors: {}rz Actual: z not all found in await list) rrrrrr(rrrfrrGr!rg) rPrrrrr all_awaitsrrprrs ` r#rz AsyncMockMixin.assert_has_awaitsJ s\4995aD&&q)59FFMSd>R>RSS z)=1G ,-3V-5$7-5*4Ay)AAt$K-5$7.8%i !!*5!1 23#3346  *%  D '!!$'  49)4DF  7:$7 '  & 'sC6+C;DDDcz|jdk7r,d|jxsdd|jd}t|y)z9 Assert that the mock was never awaited. rrr=z# to not have been awaited. Awaited rNrrs r#rz!AsyncMockMixin.assert_not_awaitedv sM   q t8&9:#//09C % % !r"cttj|i|d|_d|_t |_y)z0 See :func:`.Mock.reset_mock()` rN)rrrrrr)rPrQrRr,s r#rzAsyncMockMixin.reset_mock s5 D+F+({r"r)rrrrrrrrArrrrrrrrrrrs@r#rrs\&}5K%l3J*+<=O0B&!P&&>$ 9 *X&++r"rceZdZdZy)r aY Enhance :class:`Mock` with features allowing to mock an async function. The :class:`AsyncMock` object will behave so the object is recognized as an async function, and the result of a call is an awaitable: >>> mock = AsyncMock() >>> iscoroutinefunction(mock) True >>> inspect.isawaitable(mock()) True The result of ``mock()`` is an async function which will have the outcome of ``side_effect`` or ``return_value``: - if ``side_effect`` is a function, the async function will return the result of that function, - if ``side_effect`` is an exception, the async function will raise the exception, - if ``side_effect`` is an iterable, the async function will return the next value of the iterable, however, if the sequence of result is exhausted, ``StopIteration`` is raised immediately, - if ``side_effect`` is not defined, the async function will return the value defined by ``return_value``, hence, by default, the async function returns a new :class:`AsyncMock` object. If the outcome of ``side_effect`` or ``return_value`` is an async function, the mock async function obtained when the mock object is called will be this async function itself (and not an async function returning an async function). The test author can also specify a wrapped object with ``wraps``. In this case, the :class:`Mock` object behavior is the same as with an :class:`.Mock` object: the wrapped object may have methods defined as async function functions. Based on Martin Richard's asynctest project. Nrr!r"r#r r s'r"r c"eZdZdZdZdZdZy)_ANYz2A helper object that compares equal to everything.cyrr!rPrs r#rz _ANY.__eq__ sr"cyrr!rs r#rz _ANY.__ne__ sr"cy)Nzr!rs r#rz _ANY.__repr__ sr"N)rrrr rrrr!r"r#r r  s8r"r c d|z}d}dj|Dcgc] }t|c}}dj|jDcgc] \}}|d|c}}} |r|}| r |r|dz }|| z }||zScc}wcc}}w)Nz%s(%%s)rz, =)r\reprrE) rwrQrRrformatted_argsrH args_stringrCr kwargs_strings r#r~r~ s$GN))$7$3T#Y$78KII171?:33M$  d "N-' ^ ##8s A>B ceZdZdZ ddZ ddZdZejZdZ dZ dZ d Z e d Ze d Zd Zd Zy)ra A tuple for holding the results of a call to a mock, either in the form `(args, kwargs)` or `(name, args, kwargs)`. If args or kwargs are empty then a call tuple will compare equal to a tuple without those values. This makes comparisons less verbose:: _Call(('name', (), {})) == ('name',) _Call(('name', (1,), {})) == ('name', (1,)) _Call(((), {'a': 'b'})) == ({'a': 'b'},) The `_Call` object provides a useful shortcut for comparing with call:: _Call(((1, 2), {'a': 3})) == call(1, 2, a=3) _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3) If the _Call has no name then it will match any name. Ncnd}i}t|}|dk(r|\}}}nh|dk(r2|\} } t| tr| }t| tr| }n9| }n6| | }}n1|dk(r,|\}t|tr|}nt|tr|}n|}|rtj |||fStj ||||fS)Nr!rr)rr(rNrgr) rrrwrr from_kallrQrR_lenfirstseconds r#rz _Call.__new__ s5z 19!& D$ QY!ME6%%fe,!D#F$ff QYFE%%E5) ==tVn5 5}}S4v"677r"c.||_||_||_yr5)rr_mock_from_kall)rPrrwrrrs r#rAz_Call.__init__ s"(r"c" t|}d}t|dk(r|\}}n|\}}}t|ddr't|ddr|j|jk7ryd}|dk(rdi}}n|dk(r|\}}}nv|dk(r5|\} t | t r| }i}nXt | tr| }di}}nAd}| }n<|dk(r6|\} } t | tr| }t | t r| i}}n d| }}n| | }}ny|r||k7ry||f||fk(S#t$r tcYSwxYw) NrrrFrr!rr)rrrr*rr(rgrN) rPr len_other self_name self_args self_kwargs other_name other_args other_kwargsrrrs r#rz _Call.__eq__ sV "E I t9>%) "I{04 -Iy+ D.$ /GE>SW4X%%););; >')2 J !^38 0J L !^FE%'" ! E3'" +-rL  $ !^!ME6%%" fe,/5r J/16 J+0&L  y0L)i-EEE_ "! ! "s C<<D Dc|jtd||fdS|jdz}t|j||f||S)Nrr%rrrrrs r#rDz_Call.__call__H sH ?? ""dF+$7 7%dootV44MMr"cr|j t|dS|jd|}t||dS)NF)rwrr?)rwrrr))rPrrws r#rz_Call.__getattr__P s6 ?? "de4 4//40$tu==r"c^|tjvrttj||Sr5)rgrkrE__getattribute__)rPrs r#r,z_Call.__getattribute__W s' 5>> ! %%dD11r"cDt|dk(r |\}}||fS|\}}}||fS)Nr)rrs r#_get_call_argumentsz_Call._get_call_arguments] s: t9>LD&V|"& D$V|r"c(|jdSNrr.rs r#rQz _Call.argse '')!,,r"c(|jdS)Nrr1rs r#rRz _Call.kwargsi r2r"c|js(|jxsd}|jdrd|z}|St|dk(rd}|\}}n'|\}}}|sd}n|jdsd|z}nd|z}t |||S)Nrr%zcall%srzcall.%s)rrrVrr~)rPrwrQrRs r#rz_Call.__repr__m s##??,fDt$$K t9>DLD&!% D$__T* 4'$%dD&99r"cg}|}|,|jr|j||j}|,tt |S)zFor a call object that represents multiple calls, `call_list` returns a list of all the intermediate calls as well as the final call.)rr!rrr[)rPvalsthings r# call_listz_Call.call_list sM$$ E"&&E$((r")r!rNFT)r!NNFT)rrrr rrArrgrrDrr,r.rrQrRrr8r!r"r#rr s|$:?8@>C)2Fj]]FN>2 ----:* )r"r)rc t|r t|}t|t}t|rt d|dt |}d|i} |rd|i} n|i} | r|rd| d<|s t ||jd|}|} |d } | j|t} tj|ri} n=|r|r td t} n't|st} n|r|rt!|st} | d||| |d | } t|t"rt%| |} |rt'| nt)|| ||||s| |j*|<|jd d} |r|sd |vrt-||dd| | | _t1|D]}t3|r t5||}d|i}| rt9| |r|j||rd|i}t|t"st;||| ||}|| j*|<n~| }t|t"r | j<}t?|||}||d<tA|rt}nt}|d||||d|}|| j*|<||_t)|||t|t"stC| ||t| r|r| jDdi|| S#t6$rYCwxYw)aCreate a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the `spec` object as their spec. Functions or methods being mocked will have their arguments checked to check that they are called with the correct signature. If `spec_set` is True then attempting to set attributes that don't exist on the spec object will raise an `AttributeError`. If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by passing `instance=True`. The returned mock will only be callable if instances of the mock are callable. `create_autospec` will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock.z'Cannot autospec a Mock object. [object=rrrNTrrwrzJInstance can not be True when create_autospec is mocking an async function)rrrrwrrr%)rZr-rrrdr)rrwrr)rYr!)#rhr7r(r'rr3rrGrrr+isdatadescriptorrr rdr rnr>rzrr[rr rr rr*rEr)r9r= _must_skiprr`r)rrrZrr-rrRis_type is_async_funcr8rr5r=wrappedrAru child_kwargsrrrY child_klasss r#r r s.~Dzt$G"**. 45 5"4(MtnGt$ 8'+#$ f% JJvu %EI  NN6 E%   >? ? t_$ X&8&>$  (W  (& (D$ &dD)  d #tWh78(,u%jj$'GxN&$@+D(T2629;T U   tU+H) ww.   h  / &1L(M2XxuhGC),D   &F$ ."48I(1L %"8,' ' BV%5*0B4@BC),D   &*}C  Xsi @ c= ) D% %gn6%f% KU   s J?? K  K c,t|ts|t|divry|j}|jD]X}|j j |t}|tur,t|ttfryt|tr|cSy|S)z[ Return whether we should skip the first argument on spec's `entry` attribute. rkF) r(r7r*r,rjrkrlrrCrBr>)rrAr<rrvs r#r;r;( s dD ! GD*b1 1~~##E73 W   f|[9 :  .N Nr"ceZdZ ddZy)r9NcX||_||_||_||_||_||_yr5)ridsrrrZrw)rPrrrrwrDrZs r#rAz_SpecState.__init__F s,       r")FNNNF)rrrrAr!r"r#r9r9D s 48/4r"r9cvt|trtj|Stj|Sr5)r(bytesioBytesIOStringIO) read_datas r# _to_streamrK\ s*)U#zz)$${{9%%r"c d t}|dg fd} fd} fd fd fd}tVddl}tt t |j jt t |jat+ddl}tt t |ja |tdt }tt  j_ d j_ d j_ d j _ d j"_ | j_ d < d  j _| j"_ j&_| j(_ fd }||_ |_ |S) a A helper function to create a mock to replace the use of `open`. It works for `open` called directly or used as a context manager. The `mock` argument is the mock object to configure. If `None` (the default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. `read_data` is a string for the `read`, `readline` and `readlines` of the file handle to return. This is an empty string by default. NcjjjjSdj|i|Sr0) readlinesrrQrR_statehandles r#_readlines_side_effectz)mock_open.._readlines_side_effectr sC    ( ( 4##00 0"vay""D3F33r"cjjjjSdj|i|Sr0)readrrOs r#_read_side_effectz$mock_open.._read_side_effectw s= ;; # # /;;++ +vay~~t.v..r"c?`KEd{ dj|i|7wr0)readline)rQrR_iter_side_effectrPs r#_readline_side_effectz(mock_open.._readline_side_effect| s<$&&&$&)$$d5f5 5 's .,.c3Kjj jjdD]}|ywr0)rWr)linerPrQs r#rXz$mock_open.._iter_side_effect sB ?? ' ' 3oo2221IDJsAAcxjjjjStdSr0)rWrr)rPrQsr#_next_side_effectz$mock_open.._next_side_effect s1 ?? ' ' 3??// /F1Ir"ropen)rwr)rrctd<jjdk(rd<dj_tS)Nrr)rKrWrr)rQrRrYrPrQrJs r# reset_datazmock_open..reset_data sHy)q ?? & &&) 3-/F1I*0)FOO 'r")rK file_spec_iorfrir  TextIOWrapperunionrH open_specr^rr:rwriterTrWrNrrr) r=rJ _read_datarRrUr]rbr`rXrYrPrQs ` @@@@r#rrc sWI&J$ F4 / 6  S!2!234::3s3;;?O;PQR S]+,  |f95 I &F$*F! $FLL#FKK#'FOO $(F!/FKK%'F1I"()FOO#9F "3FOO"3FOO"DD Kr"c$eZdZdZdZddZdZy)raW A mock intended to be used as a property, or other descriptor, on a class. `PropertyMock` provides `__get__` and `__set__` methods so you can specify a return value when it is fetched. Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. c tdi|S)Nr!)r)rPrRs r#r'zPropertyMock._get_child_mock s"6""r"Nc|Sr5r!)rPr.obj_types r#r~zPropertyMock.__get__ s v r"c||yr5r!)rPr.rIs r#rzPropertyMock.__set__ s  S r"r5)rrrr r'r~rr!r"r#rr s#r"rcd|_t|D]d} t||}t |t s!t |j j|trK|j|usZt|fy#t$rYswxYw)aDisable the automatic generation of child mocks. Given an input Mock, seals it to ensure no further mocks will be generated when accessing an attribute that was not already defined. The operation recursively seals the mock passed in, meaning that the mock itself, any mocks generated by accessing one of its attributes, and all assigned mocks without a name or spec will be sealed. TN) rr r*rEr(r rrlr9rr)r=rrs r#rr sDD  d#A!_-  a&&**40* =    % G   s A;; BBceZdZdZdZdZy)rz8 Wraps an iterator in an asynchronous iterator. cz||_tt}tj|_||j d<y)Nrr1)iteratorr rr+CO_ITERABLE_COROUTINErrk)rPrprs r#rAz_AsyncIterator.__init__ s/  #X6 $:: $- j!r"c^K t|jS#t$rYtwxYwwr5)rrprrrs r#rz_AsyncIterator.__anext__ s1  & &     s-- *-*-N)rrrr rArr!r"r#rr s. !r"rr)NFNNN)FFNN)Nr)__all__rrrGr+rr2builtinsrHrtypesrrr unittest.utilr functoolsrr threadingrrrr rVr(r rrr/r3r'r:r?rKr[rVrdrhrnrzrtrrrgrrrrMISSINGr{DELETEDr:rrrfrrrrr frozenset removeprefixrWrr3rrrrrJrOrSrrVrnrvrYmultiplestopallr magic_methodsnumericsr\rFinplaceright _non_defaultsrvrr_sync_async_magics _async_magicsrrUrurrrrrrrrrrr rrrrFrArrrGrr r rr~rgrrr r;r9r7rr>rarerKrrrr)rwrs00r#rs &  '22#$CyC"(m Hmd4??33GTm H   @2  F # & 6."b>6) )f )   ;          &**(6  6 X   :   j G DGB""$!!!'(*;*;T"BCIh-K E+TE+P((V 6  f$$v)Ev)r uCGS*/Sl8        &Od4$0!!e] IP l dIs*N;3N;0)O& O:+O OOPK! case.pynu["""Test case implementation""" import sys import functools import difflib import pprint import re import warnings import collections import contextlib import traceback import time import types from . import result from .util import (strclass, safe_repr, _count_diff_all_purpose, _count_diff_hashable, _common_shorten_repr) __unittest = True _subtest_msg_sentinel = object() DIFF_OMITTED = ('\nDiff is %s characters long. ' 'Set self.maxDiff to None to see it.') class SkipTest(Exception): """ 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. """ class _ShouldStop(Exception): """ The test should stop. """ class _UnexpectedSuccess(Exception): """ The test was supposed to fail, but it didn't! """ class _Outcome(object): def __init__(self, result=None): self.expecting_failure = False self.result = result self.result_supports_subtests = hasattr(result, "addSubTest") self.success = True self.expectedFailure = None @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: yield except KeyboardInterrupt: raise except SkipTest as e: self.success = False _addSkip(self.result, test_case, str(e)) except _ShouldStop: pass except: exc_info = sys.exc_info() if self.expecting_failure: self.expectedFailure = exc_info else: self.success = False if subTest: self.result.addSubTest(test_case.test_case, test_case, exc_info) else: _addError(self.result, test_case, exc_info) # explicitly break a reference cycle: # exc_info -> frame -> exc_info exc_info = None else: if subTest and self.success: self.result.addSubTest(test_case.test_case, test_case, None) finally: self.success = self.success and old_success def _addSkip(result, test_case, reason): addSkip = getattr(result, 'addSkip', None) if addSkip is not None: addSkip(test_case, reason) else: warnings.warn("TestResult has no addSkip method, skips not reported", RuntimeWarning, 2) result.addSuccess(test_case) def _addError(result, test, exc_info): if result is not None and exc_info is not None: if issubclass(exc_info[0], test.failureException): result.addFailure(test, exc_info) else: result.addError(test, exc_info) def _id(obj): return obj def _enter_context(cm, addcleanup): # We look up the special methods on the type to match the with # statement. cls = type(cm) try: enter = cls.__enter__ exit = cls.__exit__ except AttributeError: raise TypeError(f"'{cls.__module__}.{cls.__qualname__}' object does " f"not support the context manager protocol") from None result = enter(cm) addcleanup(exit, cm, None, None, None) return result _module_cleanups = [] def addModuleCleanup(function, /, *args, **kwargs): """Same as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).""" _module_cleanups.append((function, args, kwargs)) def enterModuleContext(cm): """Same as enterContext, but module-wide.""" return _enter_context(cm, addModuleCleanup) def doModuleCleanups(): """Execute all module cleanup functions. Normally called for you after tearDownModule.""" exceptions = [] while _module_cleanups: function, args, kwargs = _module_cleanups.pop() try: function(*args, **kwargs) except Exception as exc: exceptions.append(exc) if exceptions: # Swallows all but first exception. If a multi-exception handler # gets written we should use that here instead. raise exceptions[0] def skip(reason): """ Unconditionally skip a test. """ def decorator(test_item): if not isinstance(test_item, type): @functools.wraps(test_item) def skip_wrapper(*args, **kwargs): raise SkipTest(reason) test_item = skip_wrapper test_item.__unittest_skip__ = True test_item.__unittest_skip_why__ = reason return test_item if isinstance(reason, types.FunctionType): test_item = reason reason = '' return decorator(test_item) return decorator def skipIf(condition, reason): """ Skip a test if the condition is true. """ if condition: return skip(reason) return _id def skipUnless(condition, reason): """ Skip a test unless the condition is true. """ if not condition: return skip(reason) return _id def expectedFailure(test_item): test_item.__unittest_expecting_failure__ = True return test_item def _is_subtype(expected, basetype): if isinstance(expected, tuple): return all(_is_subtype(e, basetype) for e in expected) return isinstance(expected, type) and issubclass(expected, basetype) class _BaseTestCaseContext: def __init__(self, test_case): self.test_case = test_case def _raiseFailure(self, standardMsg): msg = self.test_case._formatMessage(self.msg, standardMsg) raise self.test_case.failureException(msg) class _AssertRaisesBaseContext(_BaseTestCaseContext): def __init__(self, expected, test_case, expected_regex=None): _BaseTestCaseContext.__init__(self, test_case) self.expected = expected self.test_case = test_case if expected_regex is not None: expected_regex = re.compile(expected_regex) self.expected_regex = expected_regex self.obj_name = None self.msg = None def handle(self, name, args, kwargs): """ 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. """ try: if not _is_subtype(self.expected, self._base_type): raise TypeError('%s() arg 1 must be %s' % (name, self._base_type_str)) if not args: self.msg = kwargs.pop('msg', None) if kwargs: raise TypeError('%r is an invalid keyword argument for ' 'this function' % (next(iter(kwargs)),)) return self callable_obj, *args = args try: self.obj_name = callable_obj.__name__ except AttributeError: self.obj_name = str(callable_obj) with self: callable_obj(*args, **kwargs) finally: # bpo-23890: manually break a reference cycle self = None class _AssertRaisesContext(_AssertRaisesBaseContext): """A context manager used to implement TestCase.assertRaises* methods.""" _base_type = BaseException _base_type_str = 'an exception type or tuple of exception types' def __enter__(self): return self def __exit__(self, exc_type, exc_value, tb): if exc_type is None: try: exc_name = self.expected.__name__ except AttributeError: exc_name = str(self.expected) if self.obj_name: self._raiseFailure("{} not raised by {}".format(exc_name, self.obj_name)) else: self._raiseFailure("{} not raised".format(exc_name)) else: traceback.clear_frames(tb) if not issubclass(exc_type, self.expected): # let unexpected exceptions pass through return False # store exception, without traceback, for later retrieval self.exception = exc_value.with_traceback(None) if self.expected_regex is None: return True expected_regex = self.expected_regex if not expected_regex.search(str(exc_value)): self._raiseFailure('"{}" does not match "{}"'.format( expected_regex.pattern, str(exc_value))) return True __class_getitem__ = classmethod(types.GenericAlias) class _AssertWarnsContext(_AssertRaisesBaseContext): """A context manager used to implement TestCase.assertWarns* methods.""" _base_type = Warning _base_type_str = 'a warning type or tuple of warning types' def __enter__(self): # The __warningregistry__'s need to be in a pristine state for tests # to work properly. for v in list(sys.modules.values()): if getattr(v, '__warningregistry__', None): v.__warningregistry__ = {} self.warnings_manager = warnings.catch_warnings(record=True) self.warnings = self.warnings_manager.__enter__() warnings.simplefilter("always", self.expected) return self def __exit__(self, exc_type, exc_value, tb): self.warnings_manager.__exit__(exc_type, exc_value, tb) if exc_type is not None: # let unexpected exceptions pass through return try: exc_name = self.expected.__name__ except AttributeError: exc_name = str(self.expected) first_matching = None for m in self.warnings: w = m.message if not isinstance(w, self.expected): continue if first_matching is None: first_matching = w if (self.expected_regex is not None and not self.expected_regex.search(str(w))): continue # store warning for later retrieval self.warning = w self.filename = m.filename self.lineno = m.lineno return # Now we simply try to choose a helpful failure message if first_matching is not None: self._raiseFailure('"{}" does not match "{}"'.format( self.expected_regex.pattern, str(first_matching))) if self.obj_name: self._raiseFailure("{} not triggered by {}".format(exc_name, self.obj_name)) else: self._raiseFailure("{} not triggered".format(exc_name)) class _AssertNotWarnsContext(_AssertWarnsContext): def __exit__(self, exc_type, exc_value, tb): self.warnings_manager.__exit__(exc_type, exc_value, tb) if exc_type is not None: # let unexpected exceptions pass through return try: exc_name = self.expected.__name__ except AttributeError: exc_name = str(self.expected) for m in self.warnings: w = m.message if isinstance(w, self.expected): self._raiseFailure(f"{exc_name} triggered") class _OrderedChainMap(collections.ChainMap): def __iter__(self): seen = set() for mapping in self.maps: for k in mapping: if k not in seen: seen.add(k) yield k class TestCase(object): """A 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. """ failureException = AssertionError longMessage = True maxDiff = 80*8 # If a string is longer than _diffThreshold, use normal comparison instead # of difflib. See #11763. _diffThreshold = 2**16 def __init_subclass__(cls, *args, **kwargs): # Attribute used by TestSuite for classSetUp cls._classSetupFailed = False cls._class_cleanups = [] super().__init_subclass__(*args, **kwargs) def __init__(self, methodName='runTest'): """Create 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. """ self._testMethodName = methodName self._outcome = None self._testMethodDoc = 'No test' try: testMethod = getattr(self, methodName) except AttributeError: if methodName != 'runTest': # we allow instantiation with no explicit method name # but not an *incorrect* or missing method name raise ValueError("no such test method in %s: %s" % (self.__class__, methodName)) else: self._testMethodDoc = testMethod.__doc__ self._cleanups = [] self._subtest = None # Map types to custom assertEqual functions that will compare # instances of said type in more detail to generate a more useful # error message. self._type_equality_funcs = {} self.addTypeEqualityFunc(dict, 'assertDictEqual') self.addTypeEqualityFunc(list, 'assertListEqual') self.addTypeEqualityFunc(tuple, 'assertTupleEqual') self.addTypeEqualityFunc(set, 'assertSetEqual') self.addTypeEqualityFunc(frozenset, 'assertSetEqual') self.addTypeEqualityFunc(str, 'assertMultiLineEqual') def addTypeEqualityFunc(self, typeobj, function): """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. """ self._type_equality_funcs[typeobj] = function def addCleanup(self, function, /, *args, **kwargs): """Add 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).""" self._cleanups.append((function, args, kwargs)) def enterContext(self, cm): """Enters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method. """ return _enter_context(cm, self.addCleanup) @classmethod def addClassCleanup(cls, function, /, *args, **kwargs): """Same as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).""" cls._class_cleanups.append((function, args, kwargs)) @classmethod def enterClassContext(cls, cm): """Same as enterContext, but class-wide.""" return _enter_context(cm, cls.addClassCleanup) def setUp(self): "Hook method for setting up the test fixture before exercising it." pass def tearDown(self): "Hook method for deconstructing the test fixture after testing it." pass @classmethod def setUpClass(cls): "Hook method for setting up class fixture before running tests in the class." @classmethod def tearDownClass(cls): "Hook method for deconstructing the class fixture after running all tests in the class." def countTestCases(self): return 1 def defaultTestResult(self): return result.TestResult() def shortDescription(self): """Returns 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. """ doc = self._testMethodDoc return doc.strip().split("\n")[0].strip() if doc else None def id(self): return "%s.%s" % (strclass(self.__class__), self._testMethodName) def __eq__(self, other): if type(self) is not type(other): return NotImplemented return self._testMethodName == other._testMethodName def __hash__(self): return hash((type(self), self._testMethodName)) def __str__(self): return "%s (%s.%s)" % (self._testMethodName, strclass(self.__class__), self._testMethodName) def __repr__(self): return "<%s testMethod=%s>" % \ (strclass(self.__class__), self._testMethodName) @contextlib.contextmanager def subTest(self, msg=_subtest_msg_sentinel, **params): """Return 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. """ if self._outcome is None or not self._outcome.result_supports_subtests: yield return parent = self._subtest if parent is None: params_map = _OrderedChainMap(params) else: params_map = parent.params.new_child(params) self._subtest = _SubTest(self, msg, params_map) try: with self._outcome.testPartExecutor(self._subtest, subTest=True): yield if not self._outcome.success: result = self._outcome.result if result is not None and result.failfast: raise _ShouldStop elif self._outcome.expectedFailure: # If the test is expecting a failure, we really want to # stop now and register the expected failure. raise _ShouldStop finally: self._subtest = parent def _addExpectedFailure(self, result, exc_info): try: addExpectedFailure = result.addExpectedFailure except AttributeError: warnings.warn("TestResult has no addExpectedFailure method, reporting as passes", RuntimeWarning) result.addSuccess(self) else: addExpectedFailure(self, exc_info) def _addUnexpectedSuccess(self, result): try: addUnexpectedSuccess = result.addUnexpectedSuccess except AttributeError: warnings.warn("TestResult has no addUnexpectedSuccess method, reporting as failure", RuntimeWarning) # We need to pass an actual exception and traceback to addFailure, # otherwise the legacy result can choke. try: raise _UnexpectedSuccess from None except _UnexpectedSuccess: result.addFailure(self, sys.exc_info()) else: addUnexpectedSuccess(self) def _addDuration(self, result, elapsed): try: addDuration = result.addDuration except AttributeError: warnings.warn("TestResult has no addDuration method", RuntimeWarning) else: addDuration(self, elapsed) def _callSetUp(self): self.setUp() def _callTestMethod(self, method): if method() is not None: warnings.warn(f'It is deprecated to return a value that is not None from a ' f'test case ({method})', DeprecationWarning, stacklevel=3) def _callTearDown(self): self.tearDown() def _callCleanup(self, function, /, *args, **kwargs): function(*args, **kwargs) def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): self._callTestMethod(testMethod) outcome.expecting_failure = False with outcome.testPartExecutor(self): self._callTearDown() self.doCleanups() self._addDuration(result, (time.perf_counter() - start_time)) if outcome.success: if expecting_failure: if outcome.expectedFailure: self._addExpectedFailure(result, outcome.expectedFailure) else: self._addUnexpectedSuccess(result) else: result.addSuccess(self) return result finally: # explicitly break reference cycle: # outcome.expectedFailure -> frame -> outcome -> outcome.expectedFailure outcome.expectedFailure = None outcome = None # clear the outcome, no more needed self._outcome = None finally: result.stopTest(self) if stopTestRun is not None: stopTestRun() def doCleanups(self): """Execute all cleanup functions. Normally called for you after tearDown.""" outcome = self._outcome or _Outcome() while self._cleanups: function, args, kwargs = self._cleanups.pop() with outcome.testPartExecutor(self): self._callCleanup(function, *args, **kwargs) # return this for backwards compatibility # even though we no longer use it internally return outcome.success @classmethod def doClassCleanups(cls): """Execute all class cleanup functions. Normally called for you after tearDownClass.""" cls.tearDown_exceptions = [] while cls._class_cleanups: function, args, kwargs = cls._class_cleanups.pop() try: function(*args, **kwargs) except Exception: cls.tearDown_exceptions.append(sys.exc_info()) def __call__(self, *args, **kwds): return self.run(*args, **kwds) def debug(self): """Run the test without collecting errors in a TestResult""" testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) raise SkipTest(skip_why) self._callSetUp() self._callTestMethod(testMethod) self._callTearDown() while self._cleanups: function, args, kwargs = self._cleanups.pop() self._callCleanup(function, *args, **kwargs) def skipTest(self, reason): """Skip this test.""" raise SkipTest(reason) def fail(self, msg=None): """Fail immediately, with the given message.""" raise self.failureException(msg) def assertFalse(self, expr, msg=None): """Check that the expression is false.""" if expr: msg = self._formatMessage(msg, "%s is not false" % safe_repr(expr)) raise self.failureException(msg) def assertTrue(self, expr, msg=None): """Check that the expression is true.""" if not expr: msg = self._formatMessage(msg, "%s is not true" % safe_repr(expr)) raise self.failureException(msg) def _formatMessage(self, msg, standardMsg): """Honour 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 """ if not self.longMessage: return msg or standardMsg if msg is None: return standardMsg try: # don't switch to '{}' formatting in Python 2.X # it changes the way unicode input is handled return '%s : %s' % (standardMsg, msg) except UnicodeDecodeError: return '%s : %s' % (safe_repr(standardMsg), safe_repr(msg)) def assertRaises(self, expected_exception, *args, **kwargs): """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) """ context = _AssertRaisesContext(expected_exception, self) try: return context.handle('assertRaises', args, kwargs) finally: # bpo-23890: manually break a reference cycle context = None def assertWarns(self, expected_warning, *args, **kwargs): """Fail 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) """ context = _AssertWarnsContext(expected_warning, self) return context.handle('assertWarns', args, kwargs) def _assertNotWarns(self, expected_warning, *args, **kwargs): """The opposite of assertWarns. Private due to low demand.""" context = _AssertNotWarnsContext(expected_warning, self) return context.handle('_assertNotWarns', args, kwargs) def assertLogs(self, logger=None, level=None): """Fail 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']) """ # Lazy import to avoid importing logging if it is not needed. from ._log import _AssertLogsContext return _AssertLogsContext(self, logger, level, no_logs=False) def assertNoLogs(self, logger=None, level=None): """ Fail unless no log messages of level *level* or higher are emitted on *logger_name* or its children. This method must be used as a context manager. """ from ._log import _AssertLogsContext return _AssertLogsContext(self, logger, level, no_logs=True) def _getAssertEqualityFunc(self, first, second): """Get a detailed comparison function for the types of the two args. Returns: A callable accepting (first, second, msg=None) that will raise a failure exception if first != second with a useful human readable error message for those types. """ # # NOTE(gregory.p.smith): I considered isinstance(first, type(second)) # and vice versa. I opted for the conservative approach in case # subclasses are not intended to be compared in detail to their super # class instances using a type equality func. This means testing # subtypes won't automagically use the detailed comparison. Callers # should use their type specific assertSpamEqual method to compare # subclasses if the detailed comparison is desired and appropriate. # See the discussion in http://bugs.python.org/issue2578. # if type(first) is type(second): asserter = self._type_equality_funcs.get(type(first)) if asserter is not None: if isinstance(asserter, str): asserter = getattr(self, asserter) return asserter return self._baseAssertEqual def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) raise self.failureException(msg) def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) assertion_func(first, second, msg=msg) def assertNotEqual(self, first, second, msg=None): """Fail if the two objects are equal as determined by the '!=' operator. """ if not first != second: msg = self._formatMessage(msg, '%s == %s' % (safe_repr(first), safe_repr(second))) raise self.failureException(msg) def assertAlmostEqual(self, first, second, places=None, msg=None, delta=None): """Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). If the two objects compare equal then they will automatically compare almost equal. """ if first == second: # shortcut return if delta is not None and places is not None: raise TypeError("specify delta or places not both") diff = abs(first - second) if delta is not None: if diff <= delta: return standardMsg = '%s != %s within %s delta (%s difference)' % ( safe_repr(first), safe_repr(second), safe_repr(delta), safe_repr(diff)) else: if places is None: places = 7 if round(diff, places) == 0: return standardMsg = '%s != %s within %r places (%s difference)' % ( safe_repr(first), safe_repr(second), places, safe_repr(diff)) msg = self._formatMessage(msg, standardMsg) raise self.failureException(msg) def assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=None): """Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). Objects that are equal automatically fail. """ if delta is not None and places is not None: raise TypeError("specify delta or places not both") diff = abs(first - second) if delta is not None: if not (first == second) and diff > delta: return standardMsg = '%s == %s within %s delta (%s difference)' % ( safe_repr(first), safe_repr(second), safe_repr(delta), safe_repr(diff)) else: if places is None: places = 7 if not (first == second) and round(diff, places) != 0: return standardMsg = '%s == %s within %r places' % (safe_repr(first), safe_repr(second), places) msg = self._formatMessage(msg, standardMsg) raise self.failureException(msg) def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None): """An equality assertion for ordered sequences (like lists and tuples). For the purposes of this function, a valid ordered sequence type is one which can be indexed, has a length, and has an equality operator. Args: seq1: The first sequence to compare. seq2: The second sequence to compare. seq_type: The expected datatype of the sequences, or None if no datatype should be enforced. msg: Optional message to use on failure instead of a list of differences. """ if seq_type is not None: seq_type_name = seq_type.__name__ if not isinstance(seq1, seq_type): raise self.failureException('First sequence is not a %s: %s' % (seq_type_name, safe_repr(seq1))) if not isinstance(seq2, seq_type): raise self.failureException('Second sequence is not a %s: %s' % (seq_type_name, safe_repr(seq2))) else: seq_type_name = "sequence" differing = None try: len1 = len(seq1) except (TypeError, NotImplementedError): differing = 'First %s has no length. Non-sequence?' % ( seq_type_name) if differing is None: try: len2 = len(seq2) except (TypeError, NotImplementedError): differing = 'Second %s has no length. Non-sequence?' % ( seq_type_name) if differing is None: if seq1 == seq2: return differing = '%ss differ: %s != %s\n' % ( (seq_type_name.capitalize(),) + _common_shorten_repr(seq1, seq2)) for i in range(min(len1, len2)): try: item1 = seq1[i] except (TypeError, IndexError, NotImplementedError): differing += ('\nUnable to index element %d of first %s\n' % (i, seq_type_name)) break try: item2 = seq2[i] except (TypeError, IndexError, NotImplementedError): differing += ('\nUnable to index element %d of second %s\n' % (i, seq_type_name)) break if item1 != item2: differing += ('\nFirst differing element %d:\n%s\n%s\n' % ((i,) + _common_shorten_repr(item1, item2))) break else: if (len1 == len2 and seq_type is None and type(seq1) != type(seq2)): # The sequences are the same, but have differing types. return if len1 > len2: differing += ('\nFirst %s contains %d additional ' 'elements.\n' % (seq_type_name, len1 - len2)) try: differing += ('First extra element %d:\n%s\n' % (len2, safe_repr(seq1[len2]))) except (TypeError, IndexError, NotImplementedError): differing += ('Unable to index element %d ' 'of first %s\n' % (len2, seq_type_name)) elif len1 < len2: differing += ('\nSecond %s contains %d additional ' 'elements.\n' % (seq_type_name, len2 - len1)) try: differing += ('First extra element %d:\n%s\n' % (len1, safe_repr(seq2[len1]))) except (TypeError, IndexError, NotImplementedError): differing += ('Unable to index element %d ' 'of second %s\n' % (len1, seq_type_name)) standardMsg = differing diffMsg = '\n' + '\n'.join( difflib.ndiff(pprint.pformat(seq1).splitlines(), pprint.pformat(seq2).splitlines())) standardMsg = self._truncateMessage(standardMsg, diffMsg) msg = self._formatMessage(msg, standardMsg) self.fail(msg) def _truncateMessage(self, message, diff): max_diff = self.maxDiff if max_diff is None or len(diff) <= max_diff: return message + diff return message + (DIFF_OMITTED % len(diff)) def assertListEqual(self, list1, list2, msg=None): """A list-specific equality assertion. Args: list1: The first list to compare. list2: The second list to compare. msg: Optional message to use on failure instead of a list of differences. """ self.assertSequenceEqual(list1, list2, msg, seq_type=list) def assertTupleEqual(self, tuple1, tuple2, msg=None): """A tuple-specific equality assertion. Args: tuple1: The first tuple to compare. tuple2: The second tuple to compare. msg: Optional message to use on failure instead of a list of differences. """ self.assertSequenceEqual(tuple1, tuple2, msg, seq_type=tuple) def assertSetEqual(self, set1, set2, msg=None): """A 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). """ try: difference1 = set1.difference(set2) except TypeError as e: self.fail('invalid type when attempting set difference: %s' % e) except AttributeError as e: self.fail('first argument does not support set difference: %s' % e) try: difference2 = set2.difference(set1) except TypeError as e: self.fail('invalid type when attempting set difference: %s' % e) except AttributeError as e: self.fail('second argument does not support set difference: %s' % e) if not (difference1 or difference2): return lines = [] if difference1: lines.append('Items in the first set but not the second:') for item in difference1: lines.append(repr(item)) if difference2: lines.append('Items in the second set but not the first:') for item in difference2: lines.append(repr(item)) standardMsg = '\n'.join(lines) self.fail(self._formatMessage(msg, standardMsg)) def assertIn(self, member, container, msg=None): """Just like self.assertTrue(a in b), but with a nicer default message.""" if member not in container: standardMsg = '%s not found in %s' % (safe_repr(member), safe_repr(container)) self.fail(self._formatMessage(msg, standardMsg)) def assertNotIn(self, member, container, msg=None): """Just like self.assertTrue(a not in b), but with a nicer default message.""" if member in container: standardMsg = '%s unexpectedly found in %s' % (safe_repr(member), safe_repr(container)) self.fail(self._formatMessage(msg, standardMsg)) def assertIs(self, expr1, expr2, msg=None): """Just like self.assertTrue(a is b), but with a nicer default message.""" if expr1 is not expr2: standardMsg = '%s is not %s' % (safe_repr(expr1), safe_repr(expr2)) self.fail(self._formatMessage(msg, standardMsg)) def assertIsNot(self, expr1, expr2, msg=None): """Just like self.assertTrue(a is not b), but with a nicer default message.""" if expr1 is expr2: standardMsg = 'unexpectedly identical: %s' % (safe_repr(expr1),) self.fail(self._formatMessage(msg, standardMsg)) def assertDictEqual(self, d1, d2, msg=None): self.assertIsInstance(d1, dict, 'First argument is not a dictionary') self.assertIsInstance(d2, dict, 'Second argument is not a dictionary') if d1 != d2: standardMsg = '%s != %s' % _common_shorten_repr(d1, d2) diff = ('\n' + '\n'.join(difflib.ndiff( pprint.pformat(d1).splitlines(), pprint.pformat(d2).splitlines()))) standardMsg = self._truncateMessage(standardMsg, diff) self.fail(self._formatMessage(msg, standardMsg)) def assertCountEqual(self, first, second, msg=None): """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. """ first_seq, second_seq = list(first), list(second) try: first = collections.Counter(first_seq) second = collections.Counter(second_seq) except TypeError: # Handle case with unhashable elements differences = _count_diff_all_purpose(first_seq, second_seq) else: if first == second: return differences = _count_diff_hashable(first_seq, second_seq) if differences: standardMsg = 'Element counts were not equal:\n' lines = ['First has %d, Second has %d: %r' % diff for diff in differences] diffMsg = '\n'.join(lines) standardMsg = self._truncateMessage(standardMsg, diffMsg) msg = self._formatMessage(msg, standardMsg) self.fail(msg) def assertMultiLineEqual(self, first, second, msg=None): """Assert that two multi-line strings are equal.""" self.assertIsInstance(first, str, "First argument is not a string") self.assertIsInstance(second, str, "Second argument is not a string") if first != second: # Don't use difflib if the strings are too long if (len(first) > self._diffThreshold or len(second) > self._diffThreshold): self._baseAssertEqual(first, second, msg) # Append \n to both strings if either is missing the \n. # This allows the final ndiff to show the \n difference. The # exception here is if the string is empty, in which case no # \n should be added first_presplit = first second_presplit = second if first and second: if first[-1] != '\n' or second[-1] != '\n': first_presplit += '\n' second_presplit += '\n' elif second and second[-1] != '\n': second_presplit += '\n' elif first and first[-1] != '\n': first_presplit += '\n' firstlines = first_presplit.splitlines(keepends=True) secondlines = second_presplit.splitlines(keepends=True) # Generate the message and diff, then raise the exception standardMsg = '%s != %s' % _common_shorten_repr(first, second) diff = '\n' + ''.join(difflib.ndiff(firstlines, secondlines)) standardMsg = self._truncateMessage(standardMsg, diff) self.fail(self._formatMessage(msg, standardMsg)) def assertLess(self, a, b, msg=None): """Just like self.assertTrue(a < b), but with a nicer default message.""" if not a < b: standardMsg = '%s not less than %s' % (safe_repr(a), safe_repr(b)) self.fail(self._formatMessage(msg, standardMsg)) def assertLessEqual(self, a, b, msg=None): """Just like self.assertTrue(a <= b), but with a nicer default message.""" if not a <= b: standardMsg = '%s not less than or equal to %s' % (safe_repr(a), safe_repr(b)) self.fail(self._formatMessage(msg, standardMsg)) def assertGreater(self, a, b, msg=None): """Just like self.assertTrue(a > b), but with a nicer default message.""" if not a > b: standardMsg = '%s not greater than %s' % (safe_repr(a), safe_repr(b)) self.fail(self._formatMessage(msg, standardMsg)) def assertGreaterEqual(self, a, b, msg=None): """Just like self.assertTrue(a >= b), but with a nicer default message.""" if not a >= b: standardMsg = '%s not greater than or equal to %s' % (safe_repr(a), safe_repr(b)) self.fail(self._formatMessage(msg, standardMsg)) def assertIsNone(self, obj, msg=None): """Same as self.assertTrue(obj is None), with a nicer default message.""" if obj is not None: standardMsg = '%s is not None' % (safe_repr(obj),) self.fail(self._formatMessage(msg, standardMsg)) def assertIsNotNone(self, obj, msg=None): """Included for symmetry with assertIsNone.""" if obj is None: standardMsg = 'unexpectedly None' self.fail(self._formatMessage(msg, standardMsg)) def assertIsInstance(self, obj, cls, msg=None): """Same as self.assertTrue(isinstance(obj, cls)), with a nicer default message.""" if not isinstance(obj, cls): standardMsg = '%s is not an instance of %r' % (safe_repr(obj), cls) self.fail(self._formatMessage(msg, standardMsg)) def assertNotIsInstance(self, obj, cls, msg=None): """Included for symmetry with assertIsInstance.""" if isinstance(obj, cls): standardMsg = '%s is an instance of %r' % (safe_repr(obj), cls) self.fail(self._formatMessage(msg, standardMsg)) def assertRaisesRegex(self, expected_exception, expected_regex, *args, **kwargs): """Asserts 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. """ context = _AssertRaisesContext(expected_exception, self, expected_regex) return context.handle('assertRaisesRegex', args, kwargs) def assertWarnsRegex(self, expected_warning, expected_regex, *args, **kwargs): """Asserts 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. """ context = _AssertWarnsContext(expected_warning, self, expected_regex) return context.handle('assertWarnsRegex', args, kwargs) def assertRegex(self, text, expected_regex, msg=None): """Fail the test unless the text matches the regular expression.""" if isinstance(expected_regex, (str, bytes)): assert expected_regex, "expected_regex must not be empty." expected_regex = re.compile(expected_regex) if not expected_regex.search(text): standardMsg = "Regex didn't match: %r not found in %r" % ( expected_regex.pattern, text) # _formatMessage ensures the longMessage option is respected msg = self._formatMessage(msg, standardMsg) raise self.failureException(msg) def assertNotRegex(self, text, unexpected_regex, msg=None): """Fail the test if the text matches the regular expression.""" if isinstance(unexpected_regex, (str, bytes)): unexpected_regex = re.compile(unexpected_regex) match = unexpected_regex.search(text) if match: standardMsg = 'Regex matched: %r matches %r in %r' % ( text[match.start() : match.end()], unexpected_regex.pattern, text) # _formatMessage ensures the longMessage option is respected msg = self._formatMessage(msg, standardMsg) raise self.failureException(msg) class FunctionTestCase(TestCase): """A 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. """ def __init__(self, testFunc, setUp=None, tearDown=None, description=None): super(FunctionTestCase, self).__init__() self._setUpFunc = setUp self._tearDownFunc = tearDown self._testFunc = testFunc self._description = description def setUp(self): if self._setUpFunc is not None: self._setUpFunc() def tearDown(self): if self._tearDownFunc is not None: self._tearDownFunc() def runTest(self): self._testFunc() def id(self): return self._testFunc.__name__ def __eq__(self, other): if not isinstance(other, self.__class__): return NotImplemented return self._setUpFunc == other._setUpFunc and \ self._tearDownFunc == other._tearDownFunc and \ self._testFunc == other._testFunc and \ self._description == other._description def __hash__(self): return hash((type(self), self._setUpFunc, self._tearDownFunc, self._testFunc, self._description)) def __str__(self): return "%s (%s)" % (strclass(self.__class__), self._testFunc.__name__) def __repr__(self): return "<%s tec=%s>" % (strclass(self.__class__), self._testFunc) def shortDescription(self): if self._description is not None: return self._description doc = self._testFunc.__doc__ return doc and doc.split("\n")[0].strip() or None class _SubTest(TestCase): def __init__(self, test_case, message, params): super().__init__() self._message = message self.test_case = test_case self.params = params self.failureException = test_case.failureException def runTest(self): raise NotImplementedError("subtests cannot be run directly") def _subDescription(self): parts = [] if self._message is not _subtest_msg_sentinel: parts.append("[{}]".format(self._message)) if self.params: params_desc = ', '.join( "{}={!r}".format(k, v) for (k, v) in self.params.items()) parts.append("({})".format(params_desc)) return " ".join(parts) or '()' def id(self): return "{} {}".format(self.test_case.id(), self._subDescription()) def shortDescription(self): """Returns a one-line description of the subtest, or None if no description has been provided. """ return self.test_case.shortDescription() def __str__(self): return "{} {}".format(self.test_case, self._subDescription()) PK!ޙ| _log.pynu[import logging import collections from .case import _BaseTestCaseContext _LoggingWatcher = collections.namedtuple("_LoggingWatcher", ["records", "output"]) class _CapturingHandler(logging.Handler): """ A logging handler capturing all (raw and formatted) logging output. """ def __init__(self): logging.Handler.__init__(self) self.watcher = _LoggingWatcher([], []) def flush(self): pass def emit(self, record): self.watcher.records.append(record) msg = self.format(record) self.watcher.output.append(msg) class _AssertLogsContext(_BaseTestCaseContext): """A context manager for assertLogs() and assertNoLogs() """ LOGGING_FORMAT = "%(levelname)s:%(name)s:%(message)s" def __init__(self, test_case, logger_name, level, no_logs): _BaseTestCaseContext.__init__(self, test_case) self.logger_name = logger_name if level: self.level = logging._nameToLevel.get(level, level) else: self.level = logging.INFO self.msg = None self.no_logs = no_logs def __enter__(self): if isinstance(self.logger_name, logging.Logger): logger = self.logger = self.logger_name else: logger = self.logger = logging.getLogger(self.logger_name) formatter = logging.Formatter(self.LOGGING_FORMAT) handler = _CapturingHandler() handler.setLevel(self.level) handler.setFormatter(formatter) self.watcher = handler.watcher self.old_handlers = logger.handlers[:] self.old_level = logger.level self.old_propagate = logger.propagate logger.handlers = [handler] logger.setLevel(self.level) logger.propagate = False if self.no_logs: return return handler.watcher def __exit__(self, exc_type, exc_value, tb): self.logger.handlers = self.old_handlers self.logger.propagate = self.old_propagate self.logger.setLevel(self.old_level) if exc_type is not None: # let unexpected exceptions pass through return False if self.no_logs: # assertNoLogs if len(self.watcher.records) > 0: self._raiseFailure( "Unexpected logs found: {!r}".format( self.watcher.output ) ) else: # assertLogs if len(self.watcher.records) == 0: self._raiseFailure( "no logs of level {} or higher triggered on {}" .format(logging.getLevelName(self.level), self.logger.name)) PK!F|KK loader.pynu["""Loading unittests.""" import os import re import sys import traceback import types import functools from fnmatch import fnmatch, fnmatchcase from . import case, suite, util __unittest = True # what about .pyc (etc) # we would need to avoid loading the same tests multiple times # from '.py', *and* '.pyc' VALID_MODULE_NAME = re.compile(r'[_a-z]\w*\.py$', re.IGNORECASE) class _FailedTest(case.TestCase): _testMethodName = None def __init__(self, method_name, exception): self._exception = exception super(_FailedTest, self).__init__(method_name) def __getattr__(self, name): if name != self._testMethodName: return super(_FailedTest, self).__getattr__(name) def testFailure(): raise self._exception return testFailure def _make_failed_import_test(name, suiteClass): message = 'Failed to import test module: %s\n%s' % ( name, traceback.format_exc()) return _make_failed_test(name, ImportError(message), suiteClass, message) def _make_failed_load_tests(name, exception, suiteClass): message = 'Failed to call load_tests:\n%s' % (traceback.format_exc(),) return _make_failed_test( name, exception, suiteClass, message) def _make_failed_test(methodname, exception, suiteClass, message): test = _FailedTest(methodname, exception) return suiteClass((test,)), message def _make_skipped_test(methodname, exception, suiteClass): @case.skip(str(exception)) def testSkipped(self): pass attrs = {methodname: testSkipped} TestClass = type("ModuleSkipped", (case.TestCase,), attrs) return suiteClass((TestClass(methodname),)) def _splitext(path): return os.path.splitext(path)[0] class TestLoader(object): """ This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite """ testMethodPrefix = 'test' sortTestMethodsUsing = staticmethod(util.three_way_cmp) testNamePatterns = None suiteClass = suite.TestSuite _top_level_dir = None def __init__(self): super(TestLoader, self).__init__() self.errors = [] # Tracks packages which we have called into via load_tests, to # avoid infinite re-entrancy. self._loading_packages = set() def loadTestsFromTestCase(self, testCaseClass): """Return a suite of all test cases contained in testCaseClass""" if issubclass(testCaseClass, suite.TestSuite): raise TypeError("Test cases should not be derived from " "TestSuite. Maybe you meant to derive from " "TestCase?") if testCaseClass in (case.TestCase, case.FunctionTestCase): # We don't load any tests from base types that should not be loaded. testCaseNames = [] else: testCaseNames = self.getTestCaseNames(testCaseClass) if not testCaseNames and hasattr(testCaseClass, 'runTest'): testCaseNames = ['runTest'] loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames)) return loaded_suite def loadTestsFromModule(self, module, *, pattern=None): """Return a suite of all test cases contained in the given module""" tests = [] for name in dir(module): obj = getattr(module, name) if ( isinstance(obj, type) and issubclass(obj, case.TestCase) and obj not in (case.TestCase, case.FunctionTestCase) ): tests.append(self.loadTestsFromTestCase(obj)) load_tests = getattr(module, 'load_tests', None) tests = self.suiteClass(tests) if load_tests is not None: try: return load_tests(self, tests, pattern) except Exception as e: error_case, error_message = _make_failed_load_tests( module.__name__, e, self.suiteClass) self.errors.append(error_message) return error_case return tests def loadTestsFromName(self, name, module=None): """Return 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. """ parts = name.split('.') error_case, error_message = None, None if module is None: parts_copy = parts[:] while parts_copy: try: module_name = '.'.join(parts_copy) module = __import__(module_name) break except ImportError: next_attribute = parts_copy.pop() # Last error so we can give it to the user if needed. error_case, error_message = _make_failed_import_test( next_attribute, self.suiteClass) if not parts_copy: # Even the top level import failed: report that error. self.errors.append(error_message) return error_case parts = parts[1:] obj = module for part in parts: try: parent, obj = obj, getattr(obj, part) except AttributeError as e: # We can't traverse some part of the name. if (getattr(obj, '__path__', None) is not None and error_case is not None): # This is a package (no __path__ per importlib docs), and we # encountered an error importing something. We cannot tell # the difference between package.WrongNameTestClass and # package.wrong_module_name so we just report the # ImportError - it is more informative. self.errors.append(error_message) return error_case else: # Otherwise, we signal that an AttributeError has occurred. error_case, error_message = _make_failed_test( part, e, self.suiteClass, 'Failed to access attribute:\n%s' % ( traceback.format_exc(),)) self.errors.append(error_message) return error_case if isinstance(obj, types.ModuleType): return self.loadTestsFromModule(obj) elif ( isinstance(obj, type) and issubclass(obj, case.TestCase) and obj not in (case.TestCase, case.FunctionTestCase) ): return self.loadTestsFromTestCase(obj) elif (isinstance(obj, types.FunctionType) and isinstance(parent, type) and issubclass(parent, case.TestCase)): name = parts[-1] inst = parent(name) # static methods follow a different path if not isinstance(getattr(inst, name), types.FunctionType): return self.suiteClass([inst]) elif isinstance(obj, suite.TestSuite): return obj if callable(obj): test = obj() if isinstance(test, suite.TestSuite): return test elif isinstance(test, case.TestCase): return self.suiteClass([test]) else: raise TypeError("calling %s returned %s, not a test" % (obj, test)) else: raise TypeError("don't know how to make test from: %s" % obj) def loadTestsFromNames(self, names, module=None): """Return a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. """ suites = [self.loadTestsFromName(name, module) for name in names] return self.suiteClass(suites) def getTestCaseNames(self, testCaseClass): """Return a sorted sequence of method names found within testCaseClass """ def shouldIncludeMethod(attrname): if not attrname.startswith(self.testMethodPrefix): return False testFunc = getattr(testCaseClass, attrname) if not callable(testFunc): return False fullName = f'%s.%s.%s' % ( testCaseClass.__module__, testCaseClass.__qualname__, attrname ) return self.testNamePatterns is None or \ any(fnmatchcase(fullName, pattern) for pattern in self.testNamePatterns) testFnNames = list(filter(shouldIncludeMethod, dir(testCaseClass))) if self.sortTestMethodsUsing: testFnNames.sort(key=functools.cmp_to_key(self.sortTestMethodsUsing)) return testFnNames def discover(self, start_dir, pattern='test*.py', top_level_dir=None): """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. """ original_top_level_dir = self._top_level_dir set_implicit_top = False if top_level_dir is None and self._top_level_dir is not None: # make top_level_dir optional if called from load_tests in a package top_level_dir = self._top_level_dir elif top_level_dir is None: set_implicit_top = True top_level_dir = start_dir top_level_dir = os.path.abspath(top_level_dir) if not top_level_dir in sys.path: # all test modules must be importable from the top level directory # should we *unconditionally* put the start directory in first # in sys.path to minimise likelihood of conflicts between installed # modules and development versions? sys.path.insert(0, top_level_dir) self._top_level_dir = top_level_dir is_not_importable = False if os.path.isdir(os.path.abspath(start_dir)): start_dir = os.path.abspath(start_dir) if start_dir != top_level_dir: is_not_importable = not os.path.isfile(os.path.join(start_dir, '__init__.py')) else: # support for discovery from dotted module names try: __import__(start_dir) except ImportError: is_not_importable = True else: the_module = sys.modules[start_dir] top_part = start_dir.split('.')[0] try: start_dir = os.path.abspath( os.path.dirname((the_module.__file__))) except AttributeError: if the_module.__name__ in sys.builtin_module_names: # builtin module raise TypeError('Can not use builtin modules ' 'as dotted module names') from None else: raise TypeError( f"don't know how to discover from {the_module!r}" ) from None if set_implicit_top: self._top_level_dir = self._get_directory_containing_module(top_part) sys.path.remove(top_level_dir) if is_not_importable: raise ImportError('Start directory is not importable: %r' % start_dir) tests = list(self._find_tests(start_dir, pattern)) self._top_level_dir = original_top_level_dir return self.suiteClass(tests) def _get_directory_containing_module(self, module_name): module = sys.modules[module_name] full_path = os.path.abspath(module.__file__) if os.path.basename(full_path).lower().startswith('__init__.py'): return os.path.dirname(os.path.dirname(full_path)) else: # here we have been given a module rather than a package - so # all we can do is search the *same* directory the module is in # should an exception be raised instead return os.path.dirname(full_path) def _get_name_from_path(self, path): if path == self._top_level_dir: return '.' path = _splitext(os.path.normpath(path)) _relpath = os.path.relpath(path, self._top_level_dir) assert not os.path.isabs(_relpath), "Path must be within the project" assert not _relpath.startswith('..'), "Path must be within the project" name = _relpath.replace(os.path.sep, '.') return name def _get_module_from_name(self, name): __import__(name) return sys.modules[name] def _match_path(self, path, full_path, pattern): # override this method to use alternative matching strategy return fnmatch(path, pattern) def _find_tests(self, start_dir, pattern): """Used by discovery. Yields test suites it loads.""" # Handle the __init__ in this package name = self._get_name_from_path(start_dir) # name is '.' when start_dir == top_level_dir (and top_level_dir is by # definition not a package). if name != '.' and name not in self._loading_packages: # name is in self._loading_packages while we have called into # loadTestsFromModule with name. tests, should_recurse = self._find_test_path(start_dir, pattern) if tests is not None: yield tests if not should_recurse: # Either an error occurred, or load_tests was used by the # package. return # Handle the contents. paths = sorted(os.listdir(start_dir)) for path in paths: full_path = os.path.join(start_dir, path) tests, should_recurse = self._find_test_path(full_path, pattern) if tests is not None: yield tests if should_recurse: # we found a package that didn't use load_tests. name = self._get_name_from_path(full_path) self._loading_packages.add(name) try: yield from self._find_tests(full_path, pattern) finally: self._loading_packages.discard(name) def _find_test_path(self, full_path, pattern): """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). """ basename = os.path.basename(full_path) if os.path.isfile(full_path): if not VALID_MODULE_NAME.match(basename): # valid Python identifiers only return None, False if not self._match_path(basename, full_path, pattern): return None, False # if the test file matches, load it name = self._get_name_from_path(full_path) try: module = self._get_module_from_name(name) except case.SkipTest as e: return _make_skipped_test(name, e, self.suiteClass), False except: error_case, error_message = \ _make_failed_import_test(name, self.suiteClass) self.errors.append(error_message) return error_case, False else: mod_file = os.path.abspath( getattr(module, '__file__', full_path)) realpath = _splitext( os.path.realpath(mod_file)) fullpath_noext = _splitext( os.path.realpath(full_path)) if realpath.lower() != fullpath_noext.lower(): module_dir = os.path.dirname(realpath) mod_name = _splitext( os.path.basename(full_path)) expected_dir = os.path.dirname(full_path) msg = ("%r module incorrectly imported from %r. Expected " "%r. Is this module globally installed?") raise ImportError( msg % (mod_name, module_dir, expected_dir)) return self.loadTestsFromModule(module, pattern=pattern), False elif os.path.isdir(full_path): if not os.path.isfile(os.path.join(full_path, '__init__.py')): return None, False load_tests = None tests = None name = self._get_name_from_path(full_path) try: package = self._get_module_from_name(name) except case.SkipTest as e: return _make_skipped_test(name, e, self.suiteClass), False except: error_case, error_message = \ _make_failed_import_test(name, self.suiteClass) self.errors.append(error_message) return error_case, False else: load_tests = getattr(package, 'load_tests', None) # Mark this package as being in load_tests (possibly ;)) self._loading_packages.add(name) try: tests = self.loadTestsFromModule(package, pattern=pattern) if load_tests is not None: # loadTestsFromModule(package) has loaded tests for us. return tests, False return tests, True finally: self._loading_packages.discard(name) else: return None, False defaultTestLoader = TestLoader() PK! _t-t-main.pynu["""Unittest main program""" import sys import argparse import os from . import loader, runner from .signals import installHandler __unittest = True _NO_TESTS_EXITCODE = 5 MAIN_EXAMPLES = """\ Examples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py """ MODULE_EXAMPLES = """\ Examples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase """ def _convert_name(name): # on Linux / Mac OS X 'foo.PY' is not importable, but on # Windows it is. Simpler to do a case insensitive match # a better check would be to check that the name is a # valid Python module name. if os.path.isfile(name) and name.lower().endswith('.py'): if os.path.isabs(name): rel_path = os.path.relpath(name, os.getcwd()) if os.path.isabs(rel_path) or rel_path.startswith(os.pardir): return name name = rel_path # on Windows both '\' and '/' are used as path # separators. Better to replace both than rely on os.path.sep return os.path.normpath(name)[:-3].replace('\\', '.').replace('/', '.') return name def _convert_names(names): return [_convert_name(name) for name in names] def _convert_select_pattern(pattern): if not '*' in pattern: pattern = '*%s*' % pattern return pattern class TestProgram(object): """A command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. """ # defaults for testing module=None verbosity = 1 failfast = catchbreak = buffer = progName = warnings = testNamePatterns = None _discovery_parser = None def __init__(self, module='__main__', defaultTest=None, argv=None, testRunner=None, testLoader=loader.defaultTestLoader, exit=True, verbosity=1, failfast=None, catchbreak=None, buffer=None, warnings=None, *, tb_locals=False, durations=None): if isinstance(module, str): self.module = __import__(module) for part in module.split('.')[1:]: self.module = getattr(self.module, part) else: self.module = module if argv is None: argv = sys.argv self.exit = exit self.failfast = failfast self.catchbreak = catchbreak self.verbosity = verbosity self.buffer = buffer self.tb_locals = tb_locals self.durations = durations if warnings is None and not sys.warnoptions: # even if DeprecationWarnings are ignored by default # print them anyway unless other warnings settings are # specified by the warnings arg or the -W python flag self.warnings = 'default' else: # here self.warnings is set either to the value passed # to the warnings args or to None. # If the user didn't pass a value self.warnings will # be None. This means that the behavior is unchanged # and depends on the values passed to -W. self.warnings = warnings self.defaultTest = defaultTest self.testRunner = testRunner self.testLoader = testLoader self.progName = os.path.basename(argv[0]) self.parseArgs(argv) self.runTests() def _print_help(self, *args, **kwargs): if self.module is None: print(self._main_parser.format_help()) print(MAIN_EXAMPLES % {'prog': self.progName}) self._discovery_parser.print_help() else: print(self._main_parser.format_help()) print(MODULE_EXAMPLES % {'prog': self.progName}) def parseArgs(self, argv): self._initArgParsers() if self.module is None: if len(argv) > 1 and argv[1].lower() == 'discover': self._do_discovery(argv[2:]) return self._main_parser.parse_args(argv[1:], self) if not self.tests: # this allows "python -m unittest -v" to still work for # test discovery. self._do_discovery([]) return else: self._main_parser.parse_args(argv[1:], self) if self.tests: self.testNames = _convert_names(self.tests) if __name__ == '__main__': # to support python -m unittest ... self.module = None elif self.defaultTest is None: # createTests will load tests from self.module self.testNames = None elif isinstance(self.defaultTest, str): self.testNames = (self.defaultTest,) else: self.testNames = list(self.defaultTest) self.createTests() def createTests(self, from_discovery=False, Loader=None): if self.testNamePatterns: self.testLoader.testNamePatterns = self.testNamePatterns if from_discovery: loader = self.testLoader if Loader is None else Loader() self.test = loader.discover(self.start, self.pattern, self.top) elif self.testNames is None: self.test = self.testLoader.loadTestsFromModule(self.module) else: self.test = self.testLoader.loadTestsFromNames(self.testNames, self.module) def _initArgParsers(self): parent_parser = self._getParentArgParser() self._main_parser = self._getMainArgParser(parent_parser) self._discovery_parser = self._getDiscoveryArgParser(parent_parser) def _getParentArgParser(self): parser = argparse.ArgumentParser(add_help=False) parser.add_argument('-v', '--verbose', dest='verbosity', action='store_const', const=2, help='Verbose output') parser.add_argument('-q', '--quiet', dest='verbosity', action='store_const', const=0, help='Quiet output') parser.add_argument('--locals', dest='tb_locals', action='store_true', help='Show local variables in tracebacks') parser.add_argument('--durations', dest='durations', type=int, default=None, metavar="N", help='Show the N slowest test cases (N=0 for all)') if self.failfast is None: parser.add_argument('-f', '--failfast', dest='failfast', action='store_true', help='Stop on first fail or error') self.failfast = False if self.catchbreak is None: parser.add_argument('-c', '--catch', dest='catchbreak', action='store_true', help='Catch Ctrl-C and display results so far') self.catchbreak = False if self.buffer is None: parser.add_argument('-b', '--buffer', dest='buffer', action='store_true', help='Buffer stdout and stderr during tests') self.buffer = False if self.testNamePatterns is None: parser.add_argument('-k', dest='testNamePatterns', action='append', type=_convert_select_pattern, help='Only run tests which match the given substring') self.testNamePatterns = [] return parser def _getMainArgParser(self, parent): parser = argparse.ArgumentParser(parents=[parent]) parser.prog = self.progName parser.print_help = self._print_help parser.add_argument('tests', nargs='*', help='a list of any number of test modules, ' 'classes and test methods.') return parser def _getDiscoveryArgParser(self, parent): parser = argparse.ArgumentParser(parents=[parent]) parser.prog = '%s discover' % self.progName parser.epilog = ('For test discovery all test modules must be ' 'importable from the top level directory of the ' 'project.') parser.add_argument('-s', '--start-directory', dest='start', help="Directory to start discovery ('.' default)") parser.add_argument('-p', '--pattern', dest='pattern', help="Pattern to match tests ('test*.py' default)") parser.add_argument('-t', '--top-level-directory', dest='top', help='Top level directory of project (defaults to ' 'start directory)') for arg in ('start', 'pattern', 'top'): parser.add_argument(arg, nargs='?', default=argparse.SUPPRESS, help=argparse.SUPPRESS) return parser def _do_discovery(self, argv, Loader=None): self.start = '.' self.pattern = 'test*.py' self.top = None if argv is not None: # handle command line args for test discovery if self._discovery_parser is None: # for testing self._initArgParsers() self._discovery_parser.parse_args(argv, self) self.createTests(from_discovery=True, Loader=Loader) def runTests(self): if self.catchbreak: installHandler() if self.testRunner is None: self.testRunner = runner.TextTestRunner if isinstance(self.testRunner, type): try: try: testRunner = self.testRunner(verbosity=self.verbosity, failfast=self.failfast, buffer=self.buffer, warnings=self.warnings, tb_locals=self.tb_locals, durations=self.durations) except TypeError: # didn't accept the tb_locals or durations argument testRunner = self.testRunner(verbosity=self.verbosity, failfast=self.failfast, buffer=self.buffer, warnings=self.warnings) except TypeError: # didn't accept the verbosity, buffer or failfast arguments testRunner = self.testRunner() else: # it is assumed to be a TestRunner instance testRunner = self.testRunner self.result = testRunner.run(self.test) if self.exit: if not self.result.wasSuccessful(): sys.exit(1) elif self.result.testsRun == 0 and len(self.result.skipped) == 0: sys.exit(_NO_TESTS_EXITCODE) else: sys.exit(0) main = TestProgram PK!bz async_case.pynu[import asyncio import contextvars import inspect import warnings from .case import TestCase __unittest = True class IsolatedAsyncioTestCase(TestCase): # Names intentionally have a long prefix # to reduce a chance of clashing with user-defined attributes # from inherited test case # # The class doesn't call loop.run_until_complete(self.setUp()) and family # but uses a different approach: # 1. create a long-running task that reads self.setUp() # awaitable from queue along with a future # 2. await the awaitable object passing in and set the result # into the future object # 3. Outer code puts the awaitable and the future object into a queue # with waiting for the future # The trick is necessary because every run_until_complete() call # creates a new task with embedded ContextVar context. # To share contextvars between setUp(), test and tearDown() we need to execute # them inside the same task. # Note: the test case modifies event loop policy if the policy was not instantiated # yet, unless loop_factory=asyncio.EventLoop is set. # asyncio.get_event_loop_policy() creates a default policy on demand but never # returns None # I believe this is not an issue in user level tests but python itself for testing # should reset a policy in every test module # by calling asyncio.set_event_loop_policy(None) in tearDownModule() # or set loop_factory=asyncio.EventLoop loop_factory = None def __init__(self, methodName='runTest'): super().__init__(methodName) self._asyncioRunner = None self._asyncioTestContext = contextvars.copy_context() async def asyncSetUp(self): pass async def asyncTearDown(self): pass def addAsyncCleanup(self, func, /, *args, **kwargs): # A trivial trampoline to addCleanup() # the function exists because it has a different semantics # and signature: # addCleanup() accepts regular functions # but addAsyncCleanup() accepts coroutines # # We intentionally don't add inspect.iscoroutinefunction() check # for func argument because there is no way # to check for async function reliably: # 1. It can be "async def func()" itself # 2. Class can implement "async def __call__()" method # 3. Regular "def func()" that returns awaitable object self.addCleanup(*(func, *args), **kwargs) async def enterAsyncContext(self, cm): """Enters the supplied asynchronous context manager. If successful, also adds its __aexit__ method as a cleanup function and returns the result of the __aenter__ method. """ # We look up the special methods on the type to match the with # statement. cls = type(cm) try: enter = cls.__aenter__ exit = cls.__aexit__ except AttributeError: raise TypeError(f"'{cls.__module__}.{cls.__qualname__}' object does " f"not support the asynchronous context manager protocol" ) from None result = await enter(cm) self.addAsyncCleanup(exit, cm, None, None, None) return result def _callSetUp(self): # Force loop to be initialized and set as the current loop # so that setUp functions can use get_event_loop() and get the # correct loop instance. self._asyncioRunner.get_loop() self._asyncioTestContext.run(self.setUp) self._callAsync(self.asyncSetUp) def _callTestMethod(self, method): if self._callMaybeAsync(method) is not None: warnings.warn(f'It is deprecated to return a value that is not None from a ' f'test case ({method})', DeprecationWarning, stacklevel=4) def _callTearDown(self): self._callAsync(self.asyncTearDown) self._asyncioTestContext.run(self.tearDown) def _callCleanup(self, function, *args, **kwargs): self._callMaybeAsync(function, *args, **kwargs) def _callAsync(self, func, /, *args, **kwargs): assert self._asyncioRunner is not None, 'asyncio runner is not initialized' assert inspect.iscoroutinefunction(func), f'{func!r} is not an async function' return self._asyncioRunner.run( func(*args, **kwargs), context=self._asyncioTestContext ) def _callMaybeAsync(self, func, /, *args, **kwargs): assert self._asyncioRunner is not None, 'asyncio runner is not initialized' if inspect.iscoroutinefunction(func): return self._asyncioRunner.run( func(*args, **kwargs), context=self._asyncioTestContext, ) else: return self._asyncioTestContext.run(func, *args, **kwargs) def _setupAsyncioRunner(self): assert self._asyncioRunner is None, 'asyncio runner is already initialized' runner = asyncio.Runner(debug=True, loop_factory=self.loop_factory) self._asyncioRunner = runner def _tearDownAsyncioRunner(self): runner = self._asyncioRunner runner.close() def run(self, result=None): self._setupAsyncioRunner() try: return super().run(result) finally: self._tearDownAsyncioRunner() def debug(self): self._setupAsyncioRunner() super().debug() self._tearDownAsyncioRunner() def __del__(self): if self._asyncioRunner is not None: self._tearDownAsyncioRunner() PK!~F(( runner.pynu["""Running tests""" import sys import time import warnings from . import result from .case import _SubTest from .signals import registerResult __unittest = True class _WritelnDecorator(object): """Used to decorate file-like objects with a handy 'writeln' method""" def __init__(self,stream): self.stream = stream def __getattr__(self, attr): if attr in ('stream', '__getstate__'): raise AttributeError(attr) return getattr(self.stream,attr) def writeln(self, arg=None): if arg: self.write(arg) self.write('\n') # text-mode streams translate to \r\n if needed class TextTestResult(result.TestResult): """A test result class that can print formatted text results to a stream. Used by TextTestRunner. """ separator1 = '=' * 70 separator2 = '-' * 70 def __init__(self, stream, descriptions, verbosity, *, durations=None): """Construct a TextTestResult. Subclasses should accept **kwargs to ensure compatibility as the interface changes.""" super(TextTestResult, self).__init__(stream, descriptions, verbosity) self.stream = stream self.showAll = verbosity > 1 self.dots = verbosity == 1 self.descriptions = descriptions self._newline = True self.durations = durations def getDescription(self, test): doc_first_line = test.shortDescription() if self.descriptions and doc_first_line: return '\n'.join((str(test), doc_first_line)) else: return str(test) def startTest(self, test): super(TextTestResult, self).startTest(test) if self.showAll: self.stream.write(self.getDescription(test)) self.stream.write(" ... ") self.stream.flush() self._newline = False def _write_status(self, test, status): is_subtest = isinstance(test, _SubTest) if is_subtest or self._newline: if not self._newline: self.stream.writeln() if is_subtest: self.stream.write(" ") self.stream.write(self.getDescription(test)) self.stream.write(" ... ") self.stream.writeln(status) self.stream.flush() self._newline = True def addSubTest(self, test, subtest, err): if err is not None: if self.showAll: if issubclass(err[0], subtest.failureException): self._write_status(subtest, "FAIL") else: self._write_status(subtest, "ERROR") elif self.dots: if issubclass(err[0], subtest.failureException): self.stream.write('F') else: self.stream.write('E') self.stream.flush() super(TextTestResult, self).addSubTest(test, subtest, err) def addSuccess(self, test): super(TextTestResult, self).addSuccess(test) if self.showAll: self._write_status(test, "ok") elif self.dots: self.stream.write('.') self.stream.flush() def addError(self, test, err): super(TextTestResult, self).addError(test, err) if self.showAll: self._write_status(test, "ERROR") elif self.dots: self.stream.write('E') self.stream.flush() def addFailure(self, test, err): super(TextTestResult, self).addFailure(test, err) if self.showAll: self._write_status(test, "FAIL") elif self.dots: self.stream.write('F') self.stream.flush() def addSkip(self, test, reason): super(TextTestResult, self).addSkip(test, reason) if self.showAll: self._write_status(test, "skipped {0!r}".format(reason)) elif self.dots: self.stream.write("s") self.stream.flush() def addExpectedFailure(self, test, err): super(TextTestResult, self).addExpectedFailure(test, err) if self.showAll: self.stream.writeln("expected failure") self.stream.flush() elif self.dots: self.stream.write("x") self.stream.flush() def addUnexpectedSuccess(self, test): super(TextTestResult, self).addUnexpectedSuccess(test) if self.showAll: self.stream.writeln("unexpected success") self.stream.flush() elif self.dots: self.stream.write("u") self.stream.flush() def printErrors(self): if self.dots or self.showAll: self.stream.writeln() self.stream.flush() self.printErrorList('ERROR', self.errors) self.printErrorList('FAIL', self.failures) unexpectedSuccesses = getattr(self, 'unexpectedSuccesses', ()) if unexpectedSuccesses: self.stream.writeln(self.separator1) for test in unexpectedSuccesses: self.stream.writeln(f"UNEXPECTED SUCCESS: {self.getDescription(test)}") self.stream.flush() def printErrorList(self, flavour, errors): for test, err in errors: self.stream.writeln(self.separator1) self.stream.writeln("%s: %s" % (flavour,self.getDescription(test))) self.stream.writeln(self.separator2) self.stream.writeln("%s" % err) self.stream.flush() class TextTestRunner(object): """A test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. """ resultclass = TextTestResult def __init__(self, stream=None, descriptions=True, verbosity=1, failfast=False, buffer=False, resultclass=None, warnings=None, *, tb_locals=False, durations=None): """Construct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. """ if stream is None: stream = sys.stderr self.stream = _WritelnDecorator(stream) self.descriptions = descriptions self.verbosity = verbosity self.failfast = failfast self.buffer = buffer self.tb_locals = tb_locals self.durations = durations self.warnings = warnings if resultclass is not None: self.resultclass = resultclass def _makeResult(self): try: return self.resultclass(self.stream, self.descriptions, self.verbosity, durations=self.durations) except TypeError: # didn't accept the durations argument return self.resultclass(self.stream, self.descriptions, self.verbosity) def _printDurations(self, result): if not result.collectedDurations: return ls = sorted(result.collectedDurations, key=lambda x: x[1], reverse=True) if self.durations > 0: ls = ls[:self.durations] self.stream.writeln("Slowest test durations") if hasattr(result, 'separator2'): self.stream.writeln(result.separator2) hidden = False for test, elapsed in ls: if self.verbosity < 2 and elapsed < 0.001: hidden = True continue self.stream.writeln("%-10s %s" % ("%.3fs" % elapsed, test)) if hidden: self.stream.writeln("\n(durations < 0.001s were hidden; " "use -v to show these durations)") else: self.stream.writeln("") def run(self, test): "Run the given test case or test suite." result = self._makeResult() registerResult(result) result.failfast = self.failfast result.buffer = self.buffer result.tb_locals = self.tb_locals with warnings.catch_warnings(): if self.warnings: # if self.warnings is set, use it to filter all the warnings warnings.simplefilter(self.warnings) startTime = time.perf_counter() startTestRun = getattr(result, 'startTestRun', None) if startTestRun is not None: startTestRun() try: test(result) finally: stopTestRun = getattr(result, 'stopTestRun', None) if stopTestRun is not None: stopTestRun() stopTime = time.perf_counter() timeTaken = stopTime - startTime result.printErrors() if self.durations is not None: self._printDurations(result) if hasattr(result, 'separator2'): self.stream.writeln(result.separator2) run = result.testsRun self.stream.writeln("Ran %d test%s in %.3fs" % (run, run != 1 and "s" or "", timeTaken)) self.stream.writeln() expectedFails = unexpectedSuccesses = skipped = 0 try: results = map(len, (result.expectedFailures, result.unexpectedSuccesses, result.skipped)) except AttributeError: pass else: expectedFails, unexpectedSuccesses, skipped = results infos = [] if not result.wasSuccessful(): self.stream.write("FAILED") failed, errored = len(result.failures), len(result.errors) if failed: infos.append("failures=%d" % failed) if errored: infos.append("errors=%d" % errored) elif run == 0 and not skipped: self.stream.write("NO TESTS RAN") else: self.stream.write("OK") if skipped: infos.append("skipped=%d" % skipped) if expectedFails: infos.append("expected failures=%d" % expectedFails) if unexpectedSuccesses: infos.append("unexpected successes=%d" % unexpectedSuccesses) if infos: self.stream.writeln(" (%s)" % (", ".join(infos),)) else: self.stream.write("\n") self.stream.flush() return result PK!wmock.pynu[# mock.py # Test tools for mocking and patching. # Maintained by Michael Foord # Backport for other versions of Python available from # https://pypi.org/project/mock __all__ = ( 'Mock', 'MagicMock', 'patch', 'sentinel', 'DEFAULT', 'ANY', 'call', 'create_autospec', 'AsyncMock', 'ThreadingMock', 'FILTER_DIR', 'NonCallableMock', 'NonCallableMagicMock', 'mock_open', 'PropertyMock', 'seal', ) import asyncio import contextlib import io import inspect import pprint import sys import builtins import pkgutil from asyncio import iscoroutinefunction import threading from types import CodeType, ModuleType, MethodType from unittest.util import safe_repr from functools import wraps, partial from threading import RLock class InvalidSpecError(Exception): """Indicates that an invalid value was used as a mock spec.""" _builtins = {name for name in dir(builtins) if not name.startswith('_')} FILTER_DIR = True # Workaround for issue #12370 # Without this, the __class__ properties wouldn't be set correctly _safe_super = super def _is_async_obj(obj): if _is_instance_mock(obj) and not isinstance(obj, AsyncMock): return False if hasattr(obj, '__func__'): obj = getattr(obj, '__func__') return iscoroutinefunction(obj) or inspect.isawaitable(obj) def _is_async_func(func): if getattr(func, '__code__', None): return iscoroutinefunction(func) else: return False def _is_instance_mock(obj): # can't use isinstance on Mock objects because they override __class__ # The base class for all mocks is NonCallableMock return issubclass(type(obj), NonCallableMock) def _is_exception(obj): return ( isinstance(obj, BaseException) or isinstance(obj, type) and issubclass(obj, BaseException) ) def _extract_mock(obj): # Autospecced functions will return a FunctionType with "mock" attribute # which is the actual mock object that needs to be used. if isinstance(obj, FunctionTypes) and hasattr(obj, 'mock'): return obj.mock else: return obj def _get_signature_object(func, as_instance, eat_self): """ Given an arbitrary, possibly callable object, try to create a suitable signature object. Return a (reduced func, signature) tuple, or None. """ if isinstance(func, type) and not as_instance: # If it's a type and should be modelled as a type, use __init__. func = func.__init__ # Skip the `self` argument in __init__ eat_self = True elif isinstance(func, (classmethod, staticmethod)): if isinstance(func, classmethod): # Skip the `cls` argument of a class method eat_self = True # Use the original decorated method to extract the correct function signature func = func.__func__ elif not isinstance(func, FunctionTypes): # If we really want to model an instance of the passed type, # __call__ should be looked up, not __init__. try: func = func.__call__ except AttributeError: return None if eat_self: sig_func = partial(func, None) else: sig_func = func try: return func, inspect.signature(sig_func) except ValueError: # Certain callable types are not supported by inspect.signature() return None def _check_signature(func, mock, skipfirst, instance=False): sig = _get_signature_object(func, instance, skipfirst) if sig is None: return func, sig = sig def checksig(self, /, *args, **kwargs): sig.bind(*args, **kwargs) _copy_func_details(func, checksig) type(mock)._mock_check_sig = checksig type(mock).__signature__ = sig def _copy_func_details(func, funcopy): # we explicitly don't copy func.__dict__ into this copy as it would # expose original attributes that should be mocked for attribute in ( '__name__', '__doc__', '__text_signature__', '__module__', '__defaults__', '__kwdefaults__', ): try: setattr(funcopy, attribute, getattr(func, attribute)) except AttributeError: pass def _callable(obj): if isinstance(obj, type): return True if isinstance(obj, (staticmethod, classmethod, MethodType)): return _callable(obj.__func__) if getattr(obj, '__call__', None) is not None: return True return False def _is_list(obj): # checks for list or tuples # XXXX badly named! return type(obj) in (list, tuple) def _instance_callable(obj): """Given an object, return True if the object is callable. For classes, return True if instances would be callable.""" if not isinstance(obj, type): # already an instance return getattr(obj, '__call__', None) is not None # *could* be broken by a class overriding __mro__ or __dict__ via # a metaclass for base in (obj,) + obj.__mro__: if base.__dict__.get('__call__') is not None: return True return False def _set_signature(mock, original, instance=False): # creates a function with signature (*args, **kwargs) that delegates to a # mock. It still does signature checking by calling a lambda with the same # signature as the original. skipfirst = isinstance(original, type) result = _get_signature_object(original, instance, skipfirst) if result is None: return mock func, sig = result def checksig(*args, **kwargs): sig.bind(*args, **kwargs) _copy_func_details(func, checksig) name = original.__name__ if not name.isidentifier(): name = 'funcopy' context = {'_checksig_': checksig, 'mock': mock} src = """def %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs)""" % name exec (src, context) funcopy = context[name] _setup_func(funcopy, mock, sig) return funcopy def _set_async_signature(mock, original, instance=False, is_async_mock=False): # creates an async function with signature (*args, **kwargs) that delegates to a # mock. It still does signature checking by calling a lambda with the same # signature as the original. skipfirst = isinstance(original, type) func, sig = _get_signature_object(original, instance, skipfirst) def checksig(*args, **kwargs): sig.bind(*args, **kwargs) _copy_func_details(func, checksig) name = original.__name__ context = {'_checksig_': checksig, 'mock': mock} src = """async def %s(*args, **kwargs): _checksig_(*args, **kwargs) return await mock(*args, **kwargs)""" % name exec (src, context) funcopy = context[name] _setup_func(funcopy, mock, sig) _setup_async_mock(funcopy) return funcopy def _setup_func(funcopy, mock, sig): funcopy.mock = mock def assert_called_with(*args, **kwargs): return mock.assert_called_with(*args, **kwargs) def assert_called(*args, **kwargs): return mock.assert_called(*args, **kwargs) def assert_not_called(*args, **kwargs): return mock.assert_not_called(*args, **kwargs) def assert_called_once(*args, **kwargs): return mock.assert_called_once(*args, **kwargs) def assert_called_once_with(*args, **kwargs): return mock.assert_called_once_with(*args, **kwargs) def assert_has_calls(*args, **kwargs): return mock.assert_has_calls(*args, **kwargs) def assert_any_call(*args, **kwargs): return mock.assert_any_call(*args, **kwargs) def reset_mock(): funcopy.method_calls = _CallList() funcopy.mock_calls = _CallList() mock.reset_mock() ret = funcopy.return_value if _is_instance_mock(ret) and not ret is mock: ret.reset_mock() funcopy.called = False funcopy.call_count = 0 funcopy.call_args = None funcopy.call_args_list = _CallList() funcopy.method_calls = _CallList() funcopy.mock_calls = _CallList() funcopy.return_value = mock.return_value funcopy.side_effect = mock.side_effect funcopy._mock_children = mock._mock_children funcopy.assert_called_with = assert_called_with funcopy.assert_called_once_with = assert_called_once_with funcopy.assert_has_calls = assert_has_calls funcopy.assert_any_call = assert_any_call funcopy.reset_mock = reset_mock funcopy.assert_called = assert_called funcopy.assert_not_called = assert_not_called funcopy.assert_called_once = assert_called_once funcopy.__signature__ = sig mock._mock_delegate = funcopy def _setup_async_mock(mock): mock._is_coroutine = asyncio.coroutines._is_coroutine mock.await_count = 0 mock.await_args = None mock.await_args_list = _CallList() # Mock is not configured yet so the attributes are set # to a function and then the corresponding mock helper function # is called when the helper is accessed similar to _setup_func. def wrapper(attr, /, *args, **kwargs): return getattr(mock.mock, attr)(*args, **kwargs) for attribute in ('assert_awaited', 'assert_awaited_once', 'assert_awaited_with', 'assert_awaited_once_with', 'assert_any_await', 'assert_has_awaits', 'assert_not_awaited'): # setattr(mock, attribute, wrapper) causes late binding # hence attribute will always be the last value in the loop # Use partial(wrapper, attribute) to ensure the attribute is bound # correctly. setattr(mock, attribute, partial(wrapper, attribute)) def _is_magic(name): return '__%s__' % name[2:-2] == name class _SentinelObject(object): "A unique, named, sentinel object." def __init__(self, name): self.name = name def __repr__(self): return 'sentinel.%s' % self.name def __reduce__(self): return 'sentinel.%s' % self.name class _Sentinel(object): """Access attributes to return a named object, usable as a sentinel.""" def __init__(self): self._sentinels = {} def __getattr__(self, name): if name == '__bases__': # Without this help(unittest.mock) raises an exception raise AttributeError return self._sentinels.setdefault(name, _SentinelObject(name)) def __reduce__(self): return 'sentinel' sentinel = _Sentinel() DEFAULT = sentinel.DEFAULT _missing = sentinel.MISSING _deleted = sentinel.DELETED _allowed_names = { 'return_value', '_mock_return_value', 'side_effect', '_mock_side_effect', '_mock_parent', '_mock_new_parent', '_mock_name', '_mock_new_name' } def _delegating_property(name): _allowed_names.add(name) _the_name = '_mock_' + name def _get(self, name=name, _the_name=_the_name): sig = self._mock_delegate if sig is None: return getattr(self, _the_name) return getattr(sig, name) def _set(self, value, name=name, _the_name=_the_name): sig = self._mock_delegate if sig is None: self.__dict__[_the_name] = value else: setattr(sig, name, value) return property(_get, _set) class _CallList(list): def __contains__(self, value): if not isinstance(value, list): return list.__contains__(self, value) len_value = len(value) len_self = len(self) if len_value > len_self: return False for i in range(0, len_self - len_value + 1): sub_list = self[i:i+len_value] if sub_list == value: return True return False def __repr__(self): return pprint.pformat(list(self)) def _check_and_set_parent(parent, value, name, new_name): value = _extract_mock(value) if not _is_instance_mock(value): return False if ((value._mock_name or value._mock_new_name) or (value._mock_parent is not None) or (value._mock_new_parent is not None)): return False _parent = parent while _parent is not None: # setting a mock (value) as a child or return value of itself # should not modify the mock if _parent is value: return False _parent = _parent._mock_new_parent if new_name: value._mock_new_parent = parent value._mock_new_name = new_name if name: value._mock_parent = parent value._mock_name = name return True # Internal class to identify if we wrapped an iterator object or not. class _MockIter(object): def __init__(self, obj): self.obj = iter(obj) def __next__(self): return next(self.obj) class Base(object): _mock_return_value = DEFAULT _mock_side_effect = None def __init__(self, /, *args, **kwargs): pass class NonCallableMock(Base): """A non-callable version of `Mock`""" # Store a mutex as a class attribute in order to protect concurrent access # to mock attributes. Using a class attribute allows all NonCallableMock # instances to share the mutex for simplicity. # # See https://github.com/python/cpython/issues/98624 for why this is # necessary. _lock = RLock() def __new__( cls, spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs ): # every instance has its own class # so we can create magic methods on the # class without stomping on other mocks bases = (cls,) if not issubclass(cls, AsyncMockMixin): # Check if spec is an async object or function spec_arg = spec_set or spec if spec_arg is not None and _is_async_obj(spec_arg): bases = (AsyncMockMixin, cls) new = type(cls.__name__, bases, {'__doc__': cls.__doc__}) instance = _safe_super(NonCallableMock, cls).__new__(new) return instance def __init__( self, spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs ): if _new_parent is None: _new_parent = parent __dict__ = self.__dict__ __dict__['_mock_parent'] = parent __dict__['_mock_name'] = name __dict__['_mock_new_name'] = _new_name __dict__['_mock_new_parent'] = _new_parent __dict__['_mock_sealed'] = False if spec_set is not None: spec = spec_set spec_set = True if _eat_self is None: _eat_self = parent is not None self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self) __dict__['_mock_children'] = {} __dict__['_mock_wraps'] = wraps __dict__['_mock_delegate'] = None __dict__['_mock_called'] = False __dict__['_mock_call_args'] = None __dict__['_mock_call_count'] = 0 __dict__['_mock_call_args_list'] = _CallList() __dict__['_mock_mock_calls'] = _CallList() __dict__['method_calls'] = _CallList() __dict__['_mock_unsafe'] = unsafe if kwargs: self.configure_mock(**kwargs) _safe_super(NonCallableMock, self).__init__( spec, wraps, name, spec_set, parent, _spec_state ) def attach_mock(self, mock, attribute): """ Attach a mock as an attribute of this one, replacing its name and parent. Calls to the attached mock will be recorded in the `method_calls` and `mock_calls` attributes of this one.""" inner_mock = _extract_mock(mock) inner_mock._mock_parent = None inner_mock._mock_new_parent = None inner_mock._mock_name = '' inner_mock._mock_new_name = None setattr(self, attribute, mock) def mock_add_spec(self, spec, spec_set=False): """Add a spec to a mock. `spec` can either be an object or a list of strings. Only attributes on the `spec` can be fetched as attributes from the mock. If `spec_set` is True then only attributes on the spec can be set.""" self._mock_add_spec(spec, spec_set) def _mock_add_spec(self, spec, spec_set, _spec_as_instance=False, _eat_self=False): if _is_instance_mock(spec): raise InvalidSpecError(f'Cannot spec a Mock object. [object={spec!r}]') _spec_class = None _spec_signature = None _spec_asyncs = [] if spec is not None and not _is_list(spec): if isinstance(spec, type): _spec_class = spec else: _spec_class = type(spec) res = _get_signature_object(spec, _spec_as_instance, _eat_self) _spec_signature = res and res[1] spec_list = dir(spec) for attr in spec_list: static_attr = inspect.getattr_static(spec, attr, None) unwrapped_attr = static_attr try: unwrapped_attr = inspect.unwrap(unwrapped_attr) except ValueError: pass if iscoroutinefunction(unwrapped_attr): _spec_asyncs.append(attr) spec = spec_list __dict__ = self.__dict__ __dict__['_spec_class'] = _spec_class __dict__['_spec_set'] = spec_set __dict__['_spec_signature'] = _spec_signature __dict__['_mock_methods'] = spec __dict__['_spec_asyncs'] = _spec_asyncs def __get_return_value(self): ret = self._mock_return_value if self._mock_delegate is not None: ret = self._mock_delegate.return_value if ret is DEFAULT and self._mock_wraps is None: ret = self._get_child_mock( _new_parent=self, _new_name='()' ) self.return_value = ret return ret def __set_return_value(self, value): if self._mock_delegate is not None: self._mock_delegate.return_value = value else: self._mock_return_value = value _check_and_set_parent(self, value, None, '()') __return_value_doc = "The value to be returned when the mock is called." return_value = property(__get_return_value, __set_return_value, __return_value_doc) @property def __class__(self): if self._spec_class is None: return type(self) return self._spec_class called = _delegating_property('called') call_count = _delegating_property('call_count') call_args = _delegating_property('call_args') call_args_list = _delegating_property('call_args_list') mock_calls = _delegating_property('mock_calls') def __get_side_effect(self): delegated = self._mock_delegate if delegated is None: return self._mock_side_effect sf = delegated.side_effect if (sf is not None and not callable(sf) and not isinstance(sf, _MockIter) and not _is_exception(sf)): sf = _MockIter(sf) delegated.side_effect = sf return sf def __set_side_effect(self, value): value = _try_iter(value) delegated = self._mock_delegate if delegated is None: self._mock_side_effect = value else: delegated.side_effect = value side_effect = property(__get_side_effect, __set_side_effect) def reset_mock(self, visited=None, *, return_value: bool = False, side_effect: bool = False): "Restore the mock object to its initial state." if visited is None: visited = [] if id(self) in visited: return visited.append(id(self)) self.called = False self.call_args = None self.call_count = 0 self.mock_calls = _CallList() self.call_args_list = _CallList() self.method_calls = _CallList() if return_value: self._mock_return_value = DEFAULT if side_effect: self._mock_side_effect = None for child in self._mock_children.values(): if isinstance(child, _SpecState) or child is _deleted: continue child.reset_mock(visited, return_value=return_value, side_effect=side_effect) ret = self._mock_return_value if _is_instance_mock(ret) and ret is not self: ret.reset_mock(visited) def configure_mock(self, /, **kwargs): """Set attributes on the mock through keyword arguments. Attributes plus return values and side effects can be set on child mocks using standard dot notation and unpacking a dictionary in the method call: >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError} >>> mock.configure_mock(**attrs)""" for arg, val in sorted(kwargs.items(), # we sort on the number of dots so that # attributes are set before we set attributes on # attributes key=lambda entry: entry[0].count('.')): args = arg.split('.') final = args.pop() obj = self for entry in args: obj = getattr(obj, entry) setattr(obj, final, val) def __getattr__(self, name): if name in {'_mock_methods', '_mock_unsafe'}: raise AttributeError(name) elif self._mock_methods is not None: if name not in self._mock_methods or name in _all_magics: raise AttributeError("Mock object has no attribute %r" % name) elif _is_magic(name): raise AttributeError(name) if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods): if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST: raise AttributeError( f"{name!r} is not a valid assertion. Use a spec " f"for the mock if {name!r} is meant to be an attribute.") with NonCallableMock._lock: result = self._mock_children.get(name) if result is _deleted: raise AttributeError(name) elif result is None: wraps = None if self._mock_wraps is not None: # XXXX should we get the attribute without triggering code # execution? wraps = getattr(self._mock_wraps, name) result = self._get_child_mock( parent=self, name=name, wraps=wraps, _new_name=name, _new_parent=self ) self._mock_children[name] = result elif isinstance(result, _SpecState): try: result = create_autospec( result.spec, result.spec_set, result.instance, result.parent, result.name ) except InvalidSpecError: target_name = self.__dict__['_mock_name'] or self raise InvalidSpecError( f'Cannot autospec attr {name!r} from target ' f'{target_name!r} as it has already been mocked out. ' f'[target={self!r}, attr={result.spec!r}]') self._mock_children[name] = result return result def _extract_mock_name(self): _name_list = [self._mock_new_name] _parent = self._mock_new_parent last = self dot = '.' if _name_list == ['()']: dot = '' while _parent is not None: last = _parent _name_list.append(_parent._mock_new_name + dot) dot = '.' if _parent._mock_new_name == '()': dot = '' _parent = _parent._mock_new_parent _name_list = list(reversed(_name_list)) _first = last._mock_name or 'mock' if len(_name_list) > 1: if _name_list[1] not in ('()', '().'): _first += '.' _name_list[0] = _first return ''.join(_name_list) def __repr__(self): name = self._extract_mock_name() name_string = '' if name not in ('mock', 'mock.'): name_string = ' name=%r' % name spec_string = '' if self._spec_class is not None: spec_string = ' spec=%r' if self._spec_set: spec_string = ' spec_set=%r' spec_string = spec_string % self._spec_class.__name__ return "<%s%s%s id='%s'>" % ( type(self).__name__, name_string, spec_string, id(self) ) def __dir__(self): """Filter the output of `dir(mock)` to only useful members.""" if not FILTER_DIR: return object.__dir__(self) extras = self._mock_methods or [] from_type = dir(type(self)) from_dict = list(self.__dict__) from_child_mocks = [ m_name for m_name, m_value in self._mock_children.items() if m_value is not _deleted] from_type = [e for e in from_type if not e.startswith('_')] from_dict = [e for e in from_dict if not e.startswith('_') or _is_magic(e)] return sorted(set(extras + from_type + from_dict + from_child_mocks)) def __setattr__(self, name, value): if name in _allowed_names: # property setters go through here return object.__setattr__(self, name, value) elif (self._spec_set and self._mock_methods is not None and name not in self._mock_methods and name not in self.__dict__): raise AttributeError("Mock object has no attribute '%s'" % name) elif name in _unsupported_magics: msg = 'Attempting to set unsupported magic method %r.' % name raise AttributeError(msg) elif name in _all_magics: if self._mock_methods is not None and name not in self._mock_methods: raise AttributeError("Mock object has no attribute '%s'" % name) if not _is_instance_mock(value): setattr(type(self), name, _get_method(name, value)) original = value value = lambda *args, **kw: original(self, *args, **kw) else: # only set _new_name and not name so that mock_calls is tracked # but not method calls _check_and_set_parent(self, value, None, name) setattr(type(self), name, value) self._mock_children[name] = value elif name == '__class__': self._spec_class = value return else: if _check_and_set_parent(self, value, name, name): self._mock_children[name] = value if self._mock_sealed and not hasattr(self, name): mock_name = f'{self._extract_mock_name()}.{name}' raise AttributeError(f'Cannot set {mock_name}') if isinstance(value, PropertyMock): self.__dict__[name] = value return return object.__setattr__(self, name, value) def __delattr__(self, name): if name in _all_magics and name in type(self).__dict__: delattr(type(self), name) if name not in self.__dict__: # for magic methods that are still MagicProxy objects and # not set on the instance itself return obj = self._mock_children.get(name, _missing) if name in self.__dict__: _safe_super(NonCallableMock, self).__delattr__(name) elif obj is _deleted: raise AttributeError(name) if obj is not _missing: del self._mock_children[name] self._mock_children[name] = _deleted def _format_mock_call_signature(self, args, kwargs): name = self._mock_name or 'mock' return _format_call_signature(name, args, kwargs) def _format_mock_failure_message(self, args, kwargs, action='call'): message = 'expected %s not found.\nExpected: %s\n Actual: %s' expected_string = self._format_mock_call_signature(args, kwargs) call_args = self.call_args actual_string = self._format_mock_call_signature(*call_args) return message % (action, expected_string, actual_string) def _get_call_signature_from_name(self, name): """ * If call objects are asserted against a method/function like obj.meth1 then there could be no name for the call object to lookup. Hence just return the spec_signature of the method/function being asserted against. * If the name is not empty then remove () and split by '.' to get list of names to iterate through the children until a potential match is found. A child mock is created only during attribute access so if we get a _SpecState then no attributes of the spec were accessed and can be safely exited. """ if not name: return self._spec_signature sig = None names = name.replace('()', '').split('.') children = self._mock_children for name in names: child = children.get(name) if child is None or isinstance(child, _SpecState): break else: # If an autospecced object is attached using attach_mock the # child would be a function with mock object as attribute from # which signature has to be derived. child = _extract_mock(child) children = child._mock_children sig = child._spec_signature return sig def _call_matcher(self, _call): """ Given a call (or simply an (args, kwargs) tuple), return a comparison key suitable for matching with other calls. This is a best effort method which relies on the spec's signature, if available, or falls back on the arguments themselves. """ if isinstance(_call, tuple) and len(_call) > 2: sig = self._get_call_signature_from_name(_call[0]) else: sig = self._spec_signature if sig is not None: if len(_call) == 2: name = '' args, kwargs = _call else: name, args, kwargs = _call try: bound_call = sig.bind(*args, **kwargs) return call(name, bound_call.args, bound_call.kwargs) except TypeError as e: return e.with_traceback(None) else: return _call def assert_not_called(self): """assert that the mock was never called. """ if self.call_count != 0: msg = ("Expected '%s' to not have been called. Called %s times.%s" % (self._mock_name or 'mock', self.call_count, self._calls_repr())) raise AssertionError(msg) def assert_called(self): """assert that the mock was called at least once """ if self.call_count == 0: msg = ("Expected '%s' to have been called." % (self._mock_name or 'mock')) raise AssertionError(msg) def assert_called_once(self): """assert that the mock was called only once. """ if not self.call_count == 1: msg = ("Expected '%s' to have been called once. Called %s times.%s" % (self._mock_name or 'mock', self.call_count, self._calls_repr())) raise AssertionError(msg) def assert_called_with(self, /, *args, **kwargs): """assert that the last call was made with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.""" if self.call_args is None: expected = self._format_mock_call_signature(args, kwargs) actual = 'not called.' error_message = ('expected call not found.\nExpected: %s\n Actual: %s' % (expected, actual)) raise AssertionError(error_message) def _error_message(): msg = self._format_mock_failure_message(args, kwargs) return msg expected = self._call_matcher(_Call((args, kwargs), two=True)) actual = self._call_matcher(self.call_args) if actual != expected: cause = expected if isinstance(expected, Exception) else None raise AssertionError(_error_message()) from cause def assert_called_once_with(self, /, *args, **kwargs): """assert that the mock was called exactly once and that that call was with the specified arguments.""" if not self.call_count == 1: msg = ("Expected '%s' to be called once. Called %s times.%s" % (self._mock_name or 'mock', self.call_count, self._calls_repr())) raise AssertionError(msg) return self.assert_called_with(*args, **kwargs) def assert_has_calls(self, calls, any_order=False): """assert the mock has been called with the specified calls. The `mock_calls` list is checked for the calls. If `any_order` is False (the default) then the calls must be sequential. There can be extra calls before or after the specified calls. If `any_order` is True then the calls can be in any order, but they must all appear in `mock_calls`.""" expected = [self._call_matcher(c) for c in calls] cause = next((e for e in expected if isinstance(e, Exception)), None) all_calls = _CallList(self._call_matcher(c) for c in self.mock_calls) if not any_order: if expected not in all_calls: if cause is None: problem = 'Calls not found.' else: problem = ('Error processing expected calls.\n' 'Errors: {}').format( [e if isinstance(e, Exception) else None for e in expected]) raise AssertionError( f'{problem}\n' f'Expected: {_CallList(calls)}\n' f' Actual: {safe_repr(self.mock_calls)}' ) from cause return all_calls = list(all_calls) not_found = [] for kall in expected: try: all_calls.remove(kall) except ValueError: not_found.append(kall) if not_found: raise AssertionError( '%r does not contain all of %r in its call list, ' 'found %r instead' % (self._mock_name or 'mock', tuple(not_found), all_calls) ) from cause def assert_any_call(self, /, *args, **kwargs): """assert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if the call is the most recent one.""" expected = self._call_matcher(_Call((args, kwargs), two=True)) cause = expected if isinstance(expected, Exception) else None actual = [self._call_matcher(c) for c in self.call_args_list] if cause or expected not in _AnyComparer(actual): expected_string = self._format_mock_call_signature(args, kwargs) raise AssertionError( '%s call not found' % expected_string ) from cause def _get_child_mock(self, /, **kw): """Create the child mocks for attributes and return value. By default child mocks will be the same type as the parent. Subclasses of Mock may want to override this to customize the way child mocks are made. For non-callable mocks the callable variant will be used (rather than any custom subclass).""" if self._mock_sealed: attribute = f".{kw['name']}" if "name" in kw else "()" mock_name = self._extract_mock_name() + attribute raise AttributeError(mock_name) _new_name = kw.get("_new_name") if _new_name in self.__dict__['_spec_asyncs']: return AsyncMock(**kw) _type = type(self) if issubclass(_type, MagicMock) and _new_name in _async_method_magics: # Any asynchronous magic becomes an AsyncMock klass = AsyncMock elif issubclass(_type, AsyncMockMixin): if (_new_name in _all_sync_magics or self._mock_methods and _new_name in self._mock_methods): # Any synchronous method on AsyncMock becomes a MagicMock klass = MagicMock else: klass = AsyncMock elif not issubclass(_type, CallableMixin): if issubclass(_type, NonCallableMagicMock): klass = MagicMock elif issubclass(_type, NonCallableMock): klass = Mock else: klass = _type.__mro__[1] return klass(**kw) def _calls_repr(self): """Renders self.mock_calls as a string. Example: "\nCalls: [call(1), call(2)]." If self.mock_calls is empty, an empty string is returned. The output will be truncated if very long. """ if not self.mock_calls: return "" return f"\nCalls: {safe_repr(self.mock_calls)}." # Denylist for forbidden attribute names in safe mode _ATTRIB_DENY_LIST = frozenset({ name.removeprefix("assert_") for name in dir(NonCallableMock) if name.startswith("assert_") }) class _AnyComparer(list): """A list which checks if it contains a call which may have an argument of ANY, flipping the components of item and self from their traditional locations so that ANY is guaranteed to be on the left.""" def __contains__(self, item): for _call in self: assert len(item) == len(_call) if all([ expected == actual for expected, actual in zip(item, _call) ]): return True return False def _try_iter(obj): if obj is None: return obj if _is_exception(obj): return obj if _callable(obj): return obj try: return iter(obj) except TypeError: # XXXX backwards compatibility # but this will blow up on first call - so maybe we should fail early? return obj class CallableMixin(Base): def __init__(self, spec=None, side_effect=None, return_value=DEFAULT, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, **kwargs): self.__dict__['_mock_return_value'] = return_value _safe_super(CallableMixin, self).__init__( spec, wraps, name, spec_set, parent, _spec_state, _new_name, _new_parent, **kwargs ) self.side_effect = side_effect def _mock_check_sig(self, /, *args, **kwargs): # stub method that can be replaced with one with a specific signature pass def __call__(self, /, *args, **kwargs): # can't use self in-case a function / method we are mocking uses self # in the signature self._mock_check_sig(*args, **kwargs) self._increment_mock_call(*args, **kwargs) return self._mock_call(*args, **kwargs) def _mock_call(self, /, *args, **kwargs): return self._execute_mock_call(*args, **kwargs) def _increment_mock_call(self, /, *args, **kwargs): self.called = True # handle call_args # needs to be set here so assertions on call arguments pass before # execution in the case of awaited calls with NonCallableMock._lock: # Lock is used here so that call_args_list and call_count are # set atomically otherwise it is possible that by the time call_count # is set another thread may have appended to call_args_list. # The rest of this function relies on list.append being atomic and # skips locking. _call = _Call((args, kwargs), two=True) self.call_args = _call self.call_args_list.append(_call) self.call_count = len(self.call_args_list) # initial stuff for method_calls: do_method_calls = self._mock_parent is not None method_call_name = self._mock_name # initial stuff for mock_calls: mock_call_name = self._mock_new_name is_a_call = mock_call_name == '()' self.mock_calls.append(_Call(('', args, kwargs))) # follow up the chain of mocks: _new_parent = self._mock_new_parent while _new_parent is not None: # handle method_calls: if do_method_calls: _new_parent.method_calls.append(_Call((method_call_name, args, kwargs))) do_method_calls = _new_parent._mock_parent is not None if do_method_calls: method_call_name = _new_parent._mock_name + '.' + method_call_name # handle mock_calls: this_mock_call = _Call((mock_call_name, args, kwargs)) _new_parent.mock_calls.append(this_mock_call) if _new_parent._mock_new_name: if is_a_call: dot = '' else: dot = '.' is_a_call = _new_parent._mock_new_name == '()' mock_call_name = _new_parent._mock_new_name + dot + mock_call_name # follow the parental chain: _new_parent = _new_parent._mock_new_parent def _execute_mock_call(self, /, *args, **kwargs): # separate from _increment_mock_call so that awaited functions are # executed separately from their call, also AsyncMock overrides this method effect = self.side_effect if effect is not None: if _is_exception(effect): raise effect elif not _callable(effect): result = next(effect) if _is_exception(result): raise result else: result = effect(*args, **kwargs) if result is not DEFAULT: return result if self._mock_return_value is not DEFAULT: return self.return_value if self._mock_delegate and self._mock_delegate.return_value is not DEFAULT: return self.return_value if self._mock_wraps is not None: return self._mock_wraps(*args, **kwargs) return self.return_value class Mock(CallableMixin, NonCallableMock): """ Create a new `Mock` object. `Mock` takes several optional arguments that specify the behaviour of the Mock object: * `spec`: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an `AttributeError`. If `spec` is an object (rather than a list of strings) then `mock.__class__` returns the class of the spec object. This allows mocks to pass `isinstance` tests. * `spec_set`: A stricter variant of `spec`. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as `spec_set` will raise an `AttributeError`. * `side_effect`: A function to be called whenever the Mock is called. See the `side_effect` attribute. Useful for raising exceptions or dynamically changing return values. The function is called with the same arguments as the mock, and unless it returns `DEFAULT`, the return value of this function is used as the return value. If `side_effect` is an iterable then each call to the mock will return the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. * `unsafe`: By default, accessing any attribute whose name starts with *assert*, *assret*, *asert*, *aseert*, or *assrt* raises an AttributeError. Additionally, an AttributeError is raised when accessing attributes that match the name of an assertion method without the prefix `assert_`, e.g. accessing `called_once` instead of `assert_called_once`. Passing `unsafe=True` will allow access to these attributes. * `wraps`: Item for the mock object to wrap. If `wraps` is not None then calling the Mock will pass the call through to the wrapped object (returning the real result). Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist will raise an `AttributeError`). If the mock has an explicit `return_value` set then calls are not passed to the wrapped object and the `return_value` is returned instead. * `name`: If the mock has a name then it will be used in the repr of the mock. This can be useful for debugging. The name is propagated to child mocks. Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. """ # _check_spec_arg_typos takes kwargs from commands like patch and checks that # they don't contain common misspellings of arguments related to autospeccing. def _check_spec_arg_typos(kwargs_to_check): typos = ("autospect", "auto_spec", "set_spec") for typo in typos: if typo in kwargs_to_check: raise RuntimeError( f"{typo!r} might be a typo; use unsafe=True if this is intended" ) class _patch(object): attribute_name = None _active_patches = [] def __init__( self, getter, attribute, new, spec, create, spec_set, autospec, new_callable, kwargs, *, unsafe=False ): if new_callable is not None: if new is not DEFAULT: raise ValueError( "Cannot use 'new' and 'new_callable' together" ) if autospec is not None: raise ValueError( "Cannot use 'autospec' and 'new_callable' together" ) if not unsafe: _check_spec_arg_typos(kwargs) if _is_instance_mock(spec): raise InvalidSpecError( f'Cannot spec attr {attribute!r} as the spec ' f'has already been mocked out. [spec={spec!r}]') if _is_instance_mock(spec_set): raise InvalidSpecError( f'Cannot spec attr {attribute!r} as the spec_set ' f'target has already been mocked out. [spec_set={spec_set!r}]') self.getter = getter self.attribute = attribute self.new = new self.new_callable = new_callable self.spec = spec self.create = create self.has_local = False self.spec_set = spec_set self.autospec = autospec self.kwargs = kwargs self.additional_patchers = [] self.is_started = False def copy(self): patcher = _patch( self.getter, self.attribute, self.new, self.spec, self.create, self.spec_set, self.autospec, self.new_callable, self.kwargs ) patcher.attribute_name = self.attribute_name patcher.additional_patchers = [ p.copy() for p in self.additional_patchers ] return patcher def __call__(self, func): if isinstance(func, type): return self.decorate_class(func) if inspect.iscoroutinefunction(func): return self.decorate_async_callable(func) return self.decorate_callable(func) def decorate_class(self, klass): for attr in dir(klass): if not attr.startswith(patch.TEST_PREFIX): continue attr_value = getattr(klass, attr) if not hasattr(attr_value, "__call__"): continue patcher = self.copy() setattr(klass, attr, patcher(attr_value)) return klass @contextlib.contextmanager def decoration_helper(self, patched, args, keywargs): extra_args = [] with contextlib.ExitStack() as exit_stack: for patching in patched.patchings: arg = exit_stack.enter_context(patching) if patching.attribute_name is not None: keywargs.update(arg) elif patching.new is DEFAULT: extra_args.append(arg) args += tuple(extra_args) yield (args, keywargs) def decorate_callable(self, func): # NB. Keep the method in sync with decorate_async_callable() if hasattr(func, 'patchings'): func.patchings.append(self) return func @wraps(func) def patched(*args, **keywargs): with self.decoration_helper(patched, args, keywargs) as (newargs, newkeywargs): return func(*newargs, **newkeywargs) patched.patchings = [self] return patched def decorate_async_callable(self, func): # NB. Keep the method in sync with decorate_callable() if hasattr(func, 'patchings'): func.patchings.append(self) return func @wraps(func) async def patched(*args, **keywargs): with self.decoration_helper(patched, args, keywargs) as (newargs, newkeywargs): return await func(*newargs, **newkeywargs) patched.patchings = [self] return patched def get_original(self): target = self.getter() name = self.attribute original = DEFAULT local = False try: original = target.__dict__[name] except (AttributeError, KeyError): original = getattr(target, name, DEFAULT) else: local = True if name in _builtins and isinstance(target, ModuleType): self.create = True if not self.create and original is DEFAULT: raise AttributeError( "%s does not have the attribute %r" % (target, name) ) return original, local def __enter__(self): """Perform the patch.""" if self.is_started: raise RuntimeError("Patch is already started") new, spec, spec_set = self.new, self.spec, self.spec_set autospec, kwargs = self.autospec, self.kwargs new_callable = self.new_callable self.target = self.getter() # normalise False to None if spec is False: spec = None if spec_set is False: spec_set = None if autospec is False: autospec = None if spec is not None and autospec is not None: raise TypeError("Can't specify spec and autospec") if ((spec is not None or autospec is not None) and spec_set not in (True, None)): raise TypeError("Can't provide explicit spec_set *and* spec or autospec") original, local = self.get_original() if new is DEFAULT and autospec is None: inherit = False if spec is True: # set spec to the object we are replacing spec = original if spec_set is True: spec_set = original spec = None elif spec is not None: if spec_set is True: spec_set = spec spec = None elif spec_set is True: spec_set = original if spec is not None or spec_set is not None: if original is DEFAULT: raise TypeError("Can't use 'spec' with create=True") if isinstance(original, type): # If we're patching out a class and there is a spec inherit = True # Determine the Klass to use if new_callable is not None: Klass = new_callable elif spec is None and _is_async_obj(original): Klass = AsyncMock elif spec is not None or spec_set is not None: this_spec = spec if spec_set is not None: this_spec = spec_set if _is_list(this_spec): not_callable = '__call__' not in this_spec else: not_callable = not callable(this_spec) if _is_async_obj(this_spec): Klass = AsyncMock elif not_callable: Klass = NonCallableMagicMock else: Klass = MagicMock else: Klass = MagicMock _kwargs = {} if spec is not None: _kwargs['spec'] = spec if spec_set is not None: _kwargs['spec_set'] = spec_set # add a name to mocks if (isinstance(Klass, type) and issubclass(Klass, NonCallableMock) and self.attribute): _kwargs['name'] = self.attribute _kwargs.update(kwargs) new = Klass(**_kwargs) if inherit and _is_instance_mock(new): # we can only tell if the instance should be callable if the # spec is not a list this_spec = spec if spec_set is not None: this_spec = spec_set if (not _is_list(this_spec) and not _instance_callable(this_spec)): Klass = NonCallableMagicMock _kwargs.pop('name') new.return_value = Klass(_new_parent=new, _new_name='()', **_kwargs) elif autospec is not None: # spec is ignored, new *must* be default, spec_set is treated # as a boolean. Should we check spec is not None and that spec_set # is a bool? if new is not DEFAULT: raise TypeError( "autospec creates the mock for you. Can't specify " "autospec and new." ) if original is DEFAULT: raise TypeError("Can't use 'autospec' with create=True") spec_set = bool(spec_set) if autospec is True: autospec = original if _is_instance_mock(self.target): raise InvalidSpecError( f'Cannot autospec attr {self.attribute!r} as the patch ' f'target has already been mocked out. ' f'[target={self.target!r}, attr={autospec!r}]') if _is_instance_mock(autospec): target_name = getattr(self.target, '__name__', self.target) raise InvalidSpecError( f'Cannot autospec attr {self.attribute!r} from target ' f'{target_name!r} as it has already been mocked out. ' f'[target={self.target!r}, attr={autospec!r}]') new = create_autospec(autospec, spec_set=spec_set, _name=self.attribute, **kwargs) elif kwargs: # can't set keyword args when we aren't creating the mock # XXXX If new is a Mock we could call new.configure_mock(**kwargs) raise TypeError("Can't pass kwargs to a mock we aren't creating") new_attr = new self.temp_original = original self.is_local = local self._exit_stack = contextlib.ExitStack() self.is_started = True try: setattr(self.target, self.attribute, new_attr) if self.attribute_name is not None: extra_args = {} if self.new is DEFAULT: extra_args[self.attribute_name] = new for patching in self.additional_patchers: arg = self._exit_stack.enter_context(patching) if patching.new is DEFAULT: extra_args.update(arg) return extra_args return new except: if not self.__exit__(*sys.exc_info()): raise def __exit__(self, *exc_info): """Undo the patch.""" if not self.is_started: return if self.is_local and self.temp_original is not DEFAULT: setattr(self.target, self.attribute, self.temp_original) else: delattr(self.target, self.attribute) if not self.create and (not hasattr(self.target, self.attribute) or self.attribute in ('__doc__', '__module__', '__defaults__', '__annotations__', '__kwdefaults__')): # needed for proxy objects like django settings setattr(self.target, self.attribute, self.temp_original) del self.temp_original del self.is_local del self.target exit_stack = self._exit_stack del self._exit_stack self.is_started = False return exit_stack.__exit__(*exc_info) def start(self): """Activate a patch, returning any created mock.""" result = self.__enter__() self._active_patches.append(self) return result def stop(self): """Stop an active patch.""" try: self._active_patches.remove(self) except ValueError: # If the patch hasn't been started this will fail return None return self.__exit__(None, None, None) def _get_target(target): try: target, attribute = target.rsplit('.', 1) except (TypeError, ValueError, AttributeError): raise TypeError( f"Need a valid target to patch. You supplied: {target!r}") return partial(pkgutil.resolve_name, target), attribute def _patch_object( target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, *, unsafe=False, **kwargs ): """ patch the named member (`attribute`) on an object (`target`) with a mock object. `patch.object` can be used as a decorator, class decorator or a context manager. Arguments `new`, `spec`, `create`, `spec_set`, `autospec` and `new_callable` have the same meaning as for `patch`. Like `patch`, `patch.object` takes arbitrary keyword arguments for configuring the mock object it creates. When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. """ if type(target) is str: raise TypeError( f"{target!r} must be the actual object to be patched, not a str" ) getter = lambda: target return _patch( getter, attribute, new, spec, create, spec_set, autospec, new_callable, kwargs, unsafe=unsafe ) def _patch_multiple(target, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs): """Perform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the patches:: with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): ... Use `DEFAULT` as the value if you want `patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, and a dictionary is returned when `patch.multiple` is used as a context manager. `patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments `spec`, `spec_set`, `create`, `autospec` and `new_callable` have the same meaning as for `patch`. These arguments will be applied to *all* patches done by `patch.multiple`. When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX` for choosing which methods to wrap. """ if type(target) is str: getter = partial(pkgutil.resolve_name, target) else: getter = lambda: target if not kwargs: raise ValueError( 'Must supply at least one keyword argument with patch.multiple' ) # need to wrap in a list for python 3, where items is a view items = list(kwargs.items()) attribute, new = items[0] patcher = _patch( getter, attribute, new, spec, create, spec_set, autospec, new_callable, {} ) patcher.attribute_name = attribute for attribute, new in items[1:]: this_patcher = _patch( getter, attribute, new, spec, create, spec_set, autospec, new_callable, {} ) this_patcher.attribute_name = attribute patcher.additional_patchers.append(this_patcher) return patcher def patch( target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, *, unsafe=False, **kwargs ): """ `patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the `target` is patched with a `new` object. When the function/with statement exits the patch is undone. If `new` is omitted, then the target is replaced with an `AsyncMock if the patched object is an async function or a `MagicMock` otherwise. If `patch` is used as a decorator and `new` is omitted, the created mock is passed in as an extra argument to the decorated function. If `patch` is used as a context manager the created mock is returned by the context manager. `target` should be a string in the form `'package.module.ClassName'`. The `target` is imported and the specified object replaced with the `new` object, so the `target` must be importable from the environment you are calling `patch` from. The target is imported when the decorated function is executed, not at decoration time. The `spec` and `spec_set` keyword arguments are passed to the `MagicMock` if patch is creating one for you. In addition you can pass `spec=True` or `spec_set=True`, which causes patch to pass in the object being mocked as the spec/spec_set object. `new_callable` allows you to specify a different class, or callable object, that will be called to create the `new` object. By default `AsyncMock` is used for async functions and `MagicMock` for the rest. A more powerful form of `spec` is `autospec`. If you set `autospec=True` then the mock will be created with a spec from the object being replaced. All attributes of the mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise a `TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. Instead of `autospec=True` you can pass `autospec=some_object` to use an arbitrary object as the spec instead of the one being replaced. By default `patch` will fail to replace attributes that don't exist. If you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! Patch can be used as a `TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods share a common patchings set. `patch` finds tests by looking for method names that start with `patch.TEST_PREFIX`. By default this is `test`, which matches the way `unittest` finds tests. You can specify an alternative prefix by setting `patch.TEST_PREFIX`. Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use "as" then the patched object will be bound to the name after the "as"; very useful if `patch` is creating a mock object for you. Patch will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `patch` takes arbitrary keyword arguments. These will be passed to `AsyncMock` if the patched object is asynchronous, to `MagicMock` otherwise or to `new_callable` if specified. `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are available for alternate use-cases. """ getter, attribute = _get_target(target) return _patch( getter, attribute, new, spec, create, spec_set, autospec, new_callable, kwargs, unsafe=unsafe ) class _patch_dict(object): """ Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test. `in_dict` can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys. `in_dict` can also be a string specifying the name of the dictionary, which will then be fetched by importing it. `values` can be a dictionary of values to set in the dictionary. `values` can also be an iterable of `(key, value)` pairs. If `clear` is True then the dictionary will be cleared before the new values are set. `patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary:: with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()): ... `patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator `patch.dict` honours `patch.TEST_PREFIX` for choosing which methods to wrap. """ def __init__(self, in_dict, values=(), clear=False, **kwargs): self.in_dict = in_dict # support any argument supported by dict(...) constructor self.values = dict(values) self.values.update(kwargs) self.clear = clear self._original = None def __call__(self, f): if isinstance(f, type): return self.decorate_class(f) if inspect.iscoroutinefunction(f): return self.decorate_async_callable(f) return self.decorate_callable(f) def decorate_callable(self, f): @wraps(f) def _inner(*args, **kw): self._patch_dict() try: return f(*args, **kw) finally: self._unpatch_dict() return _inner def decorate_async_callable(self, f): @wraps(f) async def _inner(*args, **kw): self._patch_dict() try: return await f(*args, **kw) finally: self._unpatch_dict() return _inner def decorate_class(self, klass): for attr in dir(klass): attr_value = getattr(klass, attr) if (attr.startswith(patch.TEST_PREFIX) and hasattr(attr_value, "__call__")): decorator = _patch_dict(self.in_dict, self.values, self.clear) decorated = decorator(attr_value) setattr(klass, attr, decorated) return klass def __enter__(self): """Patch the dict.""" self._patch_dict() return self.in_dict def _patch_dict(self): values = self.values if isinstance(self.in_dict, str): self.in_dict = pkgutil.resolve_name(self.in_dict) in_dict = self.in_dict clear = self.clear try: original = in_dict.copy() except AttributeError: # dict like object with no copy method # must support iteration over keys original = {} for key in in_dict: original[key] = in_dict[key] self._original = original if clear: _clear_dict(in_dict) try: in_dict.update(values) except AttributeError: # dict like object with no update method for key in values: in_dict[key] = values[key] def _unpatch_dict(self): in_dict = self.in_dict original = self._original _clear_dict(in_dict) try: in_dict.update(original) except AttributeError: for key in original: in_dict[key] = original[key] def __exit__(self, *args): """Unpatch the dict.""" if self._original is not None: self._unpatch_dict() return False def start(self): """Activate a patch, returning any created mock.""" result = self.__enter__() _patch._active_patches.append(self) return result def stop(self): """Stop an active patch.""" try: _patch._active_patches.remove(self) except ValueError: # If the patch hasn't been started this will fail return None return self.__exit__(None, None, None) def _clear_dict(in_dict): try: in_dict.clear() except AttributeError: keys = list(in_dict) for key in keys: del in_dict[key] def _patch_stopall(): """Stop all active patches. LIFO to unroll nested patches.""" for patch in reversed(_patch._active_patches): patch.stop() patch.object = _patch_object patch.dict = _patch_dict patch.multiple = _patch_multiple patch.stopall = _patch_stopall patch.TEST_PREFIX = 'test' magic_methods = ( "lt le gt ge eq ne " "getitem setitem delitem " "len contains iter " "hash str sizeof " "enter exit " # we added divmod and rdivmod here instead of numerics # because there is no idivmod "divmod rdivmod neg pos abs invert " "complex int float index " "round trunc floor ceil " "bool next " "fspath " "aiter " ) numerics = ( "add sub mul matmul truediv floordiv mod lshift rshift and xor or pow" ) inplace = ' '.join('i%s' % n for n in numerics.split()) right = ' '.join('r%s' % n for n in numerics.split()) # not including __prepare__, __instancecheck__, __subclasscheck__ # (as they are metaclass methods) # __del__ is not supported at all as it causes problems if it exists _non_defaults = { '__get__', '__set__', '__delete__', '__reversed__', '__missing__', '__reduce__', '__reduce_ex__', '__getinitargs__', '__getnewargs__', '__getstate__', '__setstate__', '__getformat__', '__repr__', '__dir__', '__subclasses__', '__format__', '__getnewargs_ex__', } def _get_method(name, func): "Turns a callable object (like a mock) into a real function" def method(self, /, *args, **kw): return func(self, *args, **kw) method.__name__ = name return method _magics = { '__%s__' % method for method in ' '.join([magic_methods, numerics, inplace, right]).split() } # Magic methods used for async `with` statements _async_method_magics = {"__aenter__", "__aexit__", "__anext__"} # Magic methods that are only used with async calls but are synchronous functions themselves _sync_async_magics = {"__aiter__"} _async_magics = _async_method_magics | _sync_async_magics _all_sync_magics = _magics | _non_defaults _all_magics = _all_sync_magics | _async_magics _unsupported_magics = { '__getattr__', '__setattr__', '__init__', '__new__', '__prepare__', '__instancecheck__', '__subclasscheck__', '__del__' } _calculate_return_value = { '__hash__': lambda self: object.__hash__(self), '__str__': lambda self: object.__str__(self), '__sizeof__': lambda self: object.__sizeof__(self), '__fspath__': lambda self: f"{type(self).__name__}/{self._extract_mock_name()}/{id(self)}", } _return_values = { '__lt__': NotImplemented, '__gt__': NotImplemented, '__le__': NotImplemented, '__ge__': NotImplemented, '__int__': 1, '__contains__': False, '__len__': 0, '__exit__': False, '__complex__': 1j, '__float__': 1.0, '__bool__': True, '__index__': 1, '__aexit__': False, } def _get_eq(self): def __eq__(other): ret_val = self.__eq__._mock_return_value if ret_val is not DEFAULT: return ret_val if self is other: return True return NotImplemented return __eq__ def _get_ne(self): def __ne__(other): if self.__ne__._mock_return_value is not DEFAULT: return DEFAULT if self is other: return False return NotImplemented return __ne__ def _get_iter(self): def __iter__(): ret_val = self.__iter__._mock_return_value if ret_val is DEFAULT: return iter([]) # if ret_val was already an iterator, then calling iter on it should # return the iterator unchanged return iter(ret_val) return __iter__ def _get_async_iter(self): def __aiter__(): ret_val = self.__aiter__._mock_return_value if ret_val is DEFAULT: return _AsyncIterator(iter([])) return _AsyncIterator(iter(ret_val)) return __aiter__ _side_effect_methods = { '__eq__': _get_eq, '__ne__': _get_ne, '__iter__': _get_iter, '__aiter__': _get_async_iter } def _set_return_value(mock, method, name): fixed = _return_values.get(name, DEFAULT) if fixed is not DEFAULT: method.return_value = fixed return return_calculator = _calculate_return_value.get(name) if return_calculator is not None: return_value = return_calculator(mock) method.return_value = return_value return side_effector = _side_effect_methods.get(name) if side_effector is not None: method.side_effect = side_effector(mock) class MagicMixin(Base): def __init__(self, /, *args, **kw): self._mock_set_magics() # make magic work for kwargs in init _safe_super(MagicMixin, self).__init__(*args, **kw) self._mock_set_magics() # fix magic broken by upper level init def _mock_set_magics(self): orig_magics = _magics | _async_method_magics these_magics = orig_magics if getattr(self, "_mock_methods", None) is not None: these_magics = orig_magics.intersection(self._mock_methods) remove_magics = set() remove_magics = orig_magics - these_magics for entry in remove_magics: if entry in type(self).__dict__: # remove unneeded magic methods delattr(self, entry) # don't overwrite existing attributes if called a second time these_magics = these_magics - set(type(self).__dict__) _type = type(self) for entry in these_magics: setattr(_type, entry, MagicProxy(entry, self)) class NonCallableMagicMock(MagicMixin, NonCallableMock): """A version of `MagicMock` that isn't callable.""" def mock_add_spec(self, spec, spec_set=False): """Add a spec to a mock. `spec` can either be an object or a list of strings. Only attributes on the `spec` can be fetched as attributes from the mock. If `spec_set` is True then only attributes on the spec can be set.""" self._mock_add_spec(spec, spec_set) self._mock_set_magics() class AsyncMagicMixin(MagicMixin): pass class MagicMock(MagicMixin, Mock): """ MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself. If you use the `spec` or `spec_set` arguments then *only* magic methods that exist in the spec will be created. Attributes and the return value of a `MagicMock` will also be `MagicMocks`. """ def mock_add_spec(self, spec, spec_set=False): """Add a spec to a mock. `spec` can either be an object or a list of strings. Only attributes on the `spec` can be fetched as attributes from the mock. If `spec_set` is True then only attributes on the spec can be set.""" self._mock_add_spec(spec, spec_set) self._mock_set_magics() def reset_mock(self, /, *args, return_value: bool = False, **kwargs): if ( return_value and self._mock_name and _is_magic(self._mock_name) ): # Don't reset return values for magic methods, # otherwise `m.__str__` will start # to return `MagicMock` instances, instead of `str` instances. return_value = False super().reset_mock(*args, return_value=return_value, **kwargs) class MagicProxy(Base): def __init__(self, name, parent): self.name = name self.parent = parent def create_mock(self): entry = self.name parent = self.parent m = parent._get_child_mock(name=entry, _new_name=entry, _new_parent=parent) setattr(parent, entry, m) _set_return_value(parent, m, entry) return m def __get__(self, obj, _type=None): return self.create_mock() try: _CODE_SIG = inspect.signature(partial(CodeType.__init__, None)) _CODE_ATTRS = dir(CodeType) except ValueError: _CODE_SIG = None class AsyncMockMixin(Base): await_count = _delegating_property('await_count') await_args = _delegating_property('await_args') await_args_list = _delegating_property('await_args_list') def __init__(self, /, *args, **kwargs): super().__init__(*args, **kwargs) # iscoroutinefunction() checks _is_coroutine property to say if an # object is a coroutine. Without this check it looks to see if it is a # function/method, which in this case it is not (since it is an # AsyncMock). # It is set through __dict__ because when spec_set is True, this # attribute is likely undefined. self.__dict__['_is_coroutine'] = asyncio.coroutines._is_coroutine self.__dict__['_mock_await_count'] = 0 self.__dict__['_mock_await_args'] = None self.__dict__['_mock_await_args_list'] = _CallList() if _CODE_SIG: code_mock = NonCallableMock(spec_set=_CODE_ATTRS) code_mock.__dict__["_spec_class"] = CodeType code_mock.__dict__["_spec_signature"] = _CODE_SIG else: code_mock = NonCallableMock(spec_set=CodeType) code_mock.co_flags = ( inspect.CO_COROUTINE + inspect.CO_VARARGS + inspect.CO_VARKEYWORDS ) code_mock.co_argcount = 0 code_mock.co_varnames = ('args', 'kwargs') code_mock.co_posonlyargcount = 0 code_mock.co_kwonlyargcount = 0 self.__dict__['__code__'] = code_mock self.__dict__['__name__'] = 'AsyncMock' self.__dict__['__defaults__'] = tuple() self.__dict__['__kwdefaults__'] = {} self.__dict__['__annotations__'] = None async def _execute_mock_call(self, /, *args, **kwargs): # This is nearly just like super(), except for special handling # of coroutines _call = _Call((args, kwargs), two=True) self.await_count += 1 self.await_args = _call self.await_args_list.append(_call) effect = self.side_effect if effect is not None: if _is_exception(effect): raise effect elif not _callable(effect): try: result = next(effect) except StopIteration: # It is impossible to propagate a StopIteration # through coroutines because of PEP 479 raise StopAsyncIteration if _is_exception(result): raise result elif iscoroutinefunction(effect): result = await effect(*args, **kwargs) else: result = effect(*args, **kwargs) if result is not DEFAULT: return result if self._mock_return_value is not DEFAULT: return self.return_value if self._mock_wraps is not None: if iscoroutinefunction(self._mock_wraps): return await self._mock_wraps(*args, **kwargs) return self._mock_wraps(*args, **kwargs) return self.return_value def assert_awaited(self): """ Assert that the mock was awaited at least once. """ if self.await_count == 0: msg = f"Expected {self._mock_name or 'mock'} to have been awaited." raise AssertionError(msg) def assert_awaited_once(self): """ Assert that the mock was awaited exactly once. """ if not self.await_count == 1: msg = (f"Expected {self._mock_name or 'mock'} to have been awaited once." f" Awaited {self.await_count} times.") raise AssertionError(msg) def assert_awaited_with(self, /, *args, **kwargs): """ Assert that the last await was with the specified arguments. """ if self.await_args is None: expected = self._format_mock_call_signature(args, kwargs) raise AssertionError(f'Expected await: {expected}\nNot awaited') def _error_message(): msg = self._format_mock_failure_message(args, kwargs, action='await') return msg expected = self._call_matcher(_Call((args, kwargs), two=True)) actual = self._call_matcher(self.await_args) if actual != expected: cause = expected if isinstance(expected, Exception) else None raise AssertionError(_error_message()) from cause def assert_awaited_once_with(self, /, *args, **kwargs): """ Assert that the mock was awaited exactly once and with the specified arguments. """ if not self.await_count == 1: msg = (f"Expected {self._mock_name or 'mock'} to have been awaited once." f" Awaited {self.await_count} times.") raise AssertionError(msg) return self.assert_awaited_with(*args, **kwargs) def assert_any_await(self, /, *args, **kwargs): """ Assert the mock has ever been awaited with the specified arguments. """ expected = self._call_matcher(_Call((args, kwargs), two=True)) cause = expected if isinstance(expected, Exception) else None actual = [self._call_matcher(c) for c in self.await_args_list] if cause or expected not in _AnyComparer(actual): expected_string = self._format_mock_call_signature(args, kwargs) raise AssertionError( '%s await not found' % expected_string ) from cause def assert_has_awaits(self, calls, any_order=False): """ Assert the mock has been awaited with the specified calls. The :attr:`await_args_list` list is checked for the awaits. If `any_order` is False (the default) then the awaits must be sequential. There can be extra calls before or after the specified awaits. If `any_order` is True then the awaits can be in any order, but they must all appear in :attr:`await_args_list`. """ expected = [self._call_matcher(c) for c in calls] cause = next((e for e in expected if isinstance(e, Exception)), None) all_awaits = _CallList(self._call_matcher(c) for c in self.await_args_list) if not any_order: if expected not in all_awaits: if cause is None: problem = 'Awaits not found.' else: problem = ('Error processing expected awaits.\n' 'Errors: {}').format( [e if isinstance(e, Exception) else None for e in expected]) raise AssertionError( f'{problem}\n' f'Expected: {_CallList(calls)}\n' f'Actual: {self.await_args_list}' ) from cause return all_awaits = list(all_awaits) not_found = [] for kall in expected: try: all_awaits.remove(kall) except ValueError: not_found.append(kall) if not_found: raise AssertionError( '%r not all found in await list' % (tuple(not_found),) ) from cause def assert_not_awaited(self): """ Assert that the mock was never awaited. """ if self.await_count != 0: msg = (f"Expected {self._mock_name or 'mock'} to not have been awaited." f" Awaited {self.await_count} times.") raise AssertionError(msg) def reset_mock(self, /, *args, **kwargs): """ See :func:`.Mock.reset_mock()` """ super().reset_mock(*args, **kwargs) self.await_count = 0 self.await_args = None self.await_args_list = _CallList() class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): """ Enhance :class:`Mock` with features allowing to mock an async function. The :class:`AsyncMock` object will behave so the object is recognized as an async function, and the result of a call is an awaitable: >>> mock = AsyncMock() >>> iscoroutinefunction(mock) True >>> inspect.isawaitable(mock()) True The result of ``mock()`` is an async function which will have the outcome of ``side_effect`` or ``return_value``: - if ``side_effect`` is a function, the async function will return the result of that function, - if ``side_effect`` is an exception, the async function will raise the exception, - if ``side_effect`` is an iterable, the async function will return the next value of the iterable, however, if the sequence of result is exhausted, ``StopIteration`` is raised immediately, - if ``side_effect`` is not defined, the async function will return the value defined by ``return_value``, hence, by default, the async function returns a new :class:`AsyncMock` object. If the outcome of ``side_effect`` or ``return_value`` is an async function, the mock async function obtained when the mock object is called will be this async function itself (and not an async function returning an async function). The test author can also specify a wrapped object with ``wraps``. In this case, the :class:`Mock` object behavior is the same as with an :class:`.Mock` object: the wrapped object may have methods defined as async function functions. Based on Martin Richard's asynctest project. """ class _ANY(object): "A helper object that compares equal to everything." def __eq__(self, other): return True def __ne__(self, other): return False def __repr__(self): return '' ANY = _ANY() def _format_call_signature(name, args, kwargs): message = '%s(%%s)' % name formatted_args = '' args_string = ', '.join([repr(arg) for arg in args]) kwargs_string = ', '.join([ '%s=%r' % (key, value) for key, value in kwargs.items() ]) if args_string: formatted_args = args_string if kwargs_string: if formatted_args: formatted_args += ', ' formatted_args += kwargs_string return message % formatted_args class _Call(tuple): """ A tuple for holding the results of a call to a mock, either in the form `(args, kwargs)` or `(name, args, kwargs)`. If args or kwargs are empty then a call tuple will compare equal to a tuple without those values. This makes comparisons less verbose:: _Call(('name', (), {})) == ('name',) _Call(('name', (1,), {})) == ('name', (1,)) _Call(((), {'a': 'b'})) == ({'a': 'b'},) The `_Call` object provides a useful shortcut for comparing with call:: _Call(((1, 2), {'a': 3})) == call(1, 2, a=3) _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3) If the _Call has no name then it will match any name. """ def __new__(cls, value=(), name='', parent=None, two=False, from_kall=True): args = () kwargs = {} _len = len(value) if _len == 3: name, args, kwargs = value elif _len == 2: first, second = value if isinstance(first, str): name = first if isinstance(second, tuple): args = second else: kwargs = second else: args, kwargs = first, second elif _len == 1: value, = value if isinstance(value, str): name = value elif isinstance(value, tuple): args = value else: kwargs = value if two: return tuple.__new__(cls, (args, kwargs)) return tuple.__new__(cls, (name, args, kwargs)) def __init__(self, value=(), name=None, parent=None, two=False, from_kall=True): self._mock_name = name self._mock_parent = parent self._mock_from_kall = from_kall def __eq__(self, other): try: len_other = len(other) except TypeError: return NotImplemented self_name = '' if len(self) == 2: self_args, self_kwargs = self else: self_name, self_args, self_kwargs = self if (getattr(self, '_mock_parent', None) and getattr(other, '_mock_parent', None) and self._mock_parent != other._mock_parent): return False other_name = '' if len_other == 0: other_args, other_kwargs = (), {} elif len_other == 3: other_name, other_args, other_kwargs = other elif len_other == 1: value, = other if isinstance(value, tuple): other_args = value other_kwargs = {} elif isinstance(value, str): other_name = value other_args, other_kwargs = (), {} else: other_args = () other_kwargs = value elif len_other == 2: # could be (name, args) or (name, kwargs) or (args, kwargs) first, second = other if isinstance(first, str): other_name = first if isinstance(second, tuple): other_args, other_kwargs = second, {} else: other_args, other_kwargs = (), second else: other_args, other_kwargs = first, second else: return False if self_name and other_name != self_name: return False # this order is important for ANY to work! return (other_args, other_kwargs) == (self_args, self_kwargs) __ne__ = object.__ne__ def __call__(self, /, *args, **kwargs): if self._mock_name is None: return _Call(('', args, kwargs), name='()') name = self._mock_name + '()' return _Call((self._mock_name, args, kwargs), name=name, parent=self) def __getattr__(self, attr): if self._mock_name is None: return _Call(name=attr, from_kall=False) name = '%s.%s' % (self._mock_name, attr) return _Call(name=name, parent=self, from_kall=False) def __getattribute__(self, attr): if attr in tuple.__dict__: raise AttributeError return tuple.__getattribute__(self, attr) def _get_call_arguments(self): if len(self) == 2: args, kwargs = self else: name, args, kwargs = self return args, kwargs @property def args(self): return self._get_call_arguments()[0] @property def kwargs(self): return self._get_call_arguments()[1] def __repr__(self): if not self._mock_from_kall: name = self._mock_name or 'call' if name.startswith('()'): name = 'call%s' % name return name if len(self) == 2: name = 'call' args, kwargs = self else: name, args, kwargs = self if not name: name = 'call' elif not name.startswith('()'): name = 'call.%s' % name else: name = 'call%s' % name return _format_call_signature(name, args, kwargs) def call_list(self): """For a call object that represents multiple calls, `call_list` returns a list of all the intermediate calls as well as the final call.""" vals = [] thing = self while thing is not None: if thing._mock_from_kall: vals.append(thing) thing = thing._mock_parent return _CallList(reversed(vals)) call = _Call(from_kall=False) def create_autospec(spec, spec_set=False, instance=False, _parent=None, _name=None, *, unsafe=False, **kwargs): """Create a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the `spec` object as their spec. Functions or methods being mocked will have their arguments checked to check that they are called with the correct signature. If `spec_set` is True then attempting to set attributes that don't exist on the spec object will raise an `AttributeError`. If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by passing `instance=True`. The returned mock will only be callable if instances of the mock are callable. `create_autospec` will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock.""" if _is_list(spec): # can't pass a list instance to the mock constructor as it will be # interpreted as a list of strings spec = type(spec) is_type = isinstance(spec, type) if _is_instance_mock(spec): raise InvalidSpecError(f'Cannot autospec a Mock object. ' f'[object={spec!r}]') is_async_func = _is_async_func(spec) _kwargs = {'spec': spec} if spec_set: _kwargs = {'spec_set': spec} elif spec is None: # None we mock with a normal mock without a spec _kwargs = {} if _kwargs and instance: _kwargs['_spec_as_instance'] = True if not unsafe: _check_spec_arg_typos(kwargs) _name = kwargs.pop('name', _name) _new_name = _name if _parent is None: # for a top level object no _new_name should be set _new_name = '' _kwargs.update(kwargs) Klass = MagicMock if inspect.isdatadescriptor(spec): # descriptors don't have a spec # because we don't know what type they return _kwargs = {} elif is_async_func: if instance: raise RuntimeError("Instance can not be True when create_autospec " "is mocking an async function") Klass = AsyncMock elif not _callable(spec): Klass = NonCallableMagicMock elif is_type and instance and not _instance_callable(spec): Klass = NonCallableMagicMock mock = Klass(parent=_parent, _new_parent=_parent, _new_name=_new_name, name=_name, **_kwargs) if isinstance(spec, FunctionTypes): # should only happen at the top level because we don't # recurse for functions if is_async_func: mock = _set_async_signature(mock, spec) else: mock = _set_signature(mock, spec) else: _check_signature(spec, mock, is_type, instance) if _parent is not None and not instance: _parent._mock_children[_name] = mock # Pop wraps from kwargs because it must not be passed to configure_mock. wrapped = kwargs.pop('wraps', None) if is_type and not instance and 'return_value' not in kwargs: mock.return_value = create_autospec(spec, spec_set, instance=True, _name='()', _parent=mock, wraps=wrapped) for entry in dir(spec): if _is_magic(entry): # MagicMock already does the useful magic methods for us continue # XXXX do we need a better way of getting attributes without # triggering code execution (?) Probably not - we need the actual # object to mock it so we would rather trigger a property than mock # the property descriptor. Likewise we want to mock out dynamically # provided attributes. # XXXX what about attributes that raise exceptions other than # AttributeError on being fetched? # we could be resilient against it, or catch and propagate the # exception when the attribute is fetched from the mock try: original = getattr(spec, entry) except AttributeError: continue child_kwargs = {'spec': original} # Wrap child attributes also. if wrapped and hasattr(wrapped, entry): child_kwargs.update(wraps=original) if spec_set: child_kwargs = {'spec_set': original} if not isinstance(original, FunctionTypes): new = _SpecState(original, spec_set, mock, entry, instance) mock._mock_children[entry] = new else: parent = mock if isinstance(spec, FunctionTypes): parent = mock.mock skipfirst = _must_skip(spec, entry, is_type) child_kwargs['_eat_self'] = skipfirst if iscoroutinefunction(original): child_klass = AsyncMock else: child_klass = MagicMock new = child_klass(parent=parent, name=entry, _new_name=entry, _new_parent=parent, **child_kwargs) mock._mock_children[entry] = new new.return_value = child_klass() _check_signature(original, new, skipfirst=skipfirst) # so functions created with _set_signature become instance attributes, # *plus* their underlying mock exists in _mock_children of the parent # mock. Adding to _mock_children may be unnecessary where we are also # setting as an instance attribute? if isinstance(new, FunctionTypes): setattr(mock, entry, new) # kwargs are passed with respect to the parent mock so, they are not used # for creating return_value of the parent mock. So, this condition # should be true only for the parent mock if kwargs are given. if _is_instance_mock(mock) and kwargs: mock.configure_mock(**kwargs) return mock def _must_skip(spec, entry, is_type): """ Return whether we should skip the first argument on spec's `entry` attribute. """ if not isinstance(spec, type): if entry in getattr(spec, '__dict__', {}): # instance attribute - shouldn't skip return False spec = spec.__class__ for klass in spec.__mro__: result = klass.__dict__.get(entry, DEFAULT) if result is DEFAULT: continue if isinstance(result, (staticmethod, classmethod)): return False elif isinstance(result, FunctionTypes): # Normal method => skip if looked up on type # (if looked up on instance, self is already skipped) return is_type else: return False # function is a dynamically provided attribute return is_type class _SpecState(object): def __init__(self, spec, spec_set=False, parent=None, name=None, ids=None, instance=False): self.spec = spec self.ids = ids self.spec_set = spec_set self.parent = parent self.instance = instance self.name = name FunctionTypes = ( # python function type(create_autospec), # instance method type(ANY.__eq__), ) file_spec = None open_spec = None def _to_stream(read_data): if isinstance(read_data, bytes): return io.BytesIO(read_data) else: return io.StringIO(read_data) def mock_open(mock=None, read_data=''): """ A helper function to create a mock to replace the use of `open`. It works for `open` called directly or used as a context manager. The `mock` argument is the mock object to configure. If `None` (the default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. `read_data` is a string for the `read`, `readline` and `readlines` of the file handle to return. This is an empty string by default. """ _read_data = _to_stream(read_data) _state = [_read_data, None] def _readlines_side_effect(*args, **kwargs): if handle.readlines.return_value is not None: return handle.readlines.return_value return _state[0].readlines(*args, **kwargs) def _read_side_effect(*args, **kwargs): if handle.read.return_value is not None: return handle.read.return_value return _state[0].read(*args, **kwargs) def _readline_side_effect(*args, **kwargs): yield from _iter_side_effect() while True: yield _state[0].readline(*args, **kwargs) def _iter_side_effect(): if handle.readline.return_value is not None: while True: yield handle.readline.return_value for line in _state[0]: yield line def _next_side_effect(): if handle.readline.return_value is not None: return handle.readline.return_value return next(_state[0]) def _exit_side_effect(exctype, excinst, exctb): handle.close() global file_spec if file_spec is None: import _io file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))) global open_spec if open_spec is None: import _io open_spec = list(set(dir(_io.open))) if mock is None: mock = MagicMock(name='open', spec=open_spec) handle = MagicMock(spec=file_spec) handle.__enter__.return_value = handle handle.write.return_value = None handle.read.return_value = None handle.readline.return_value = None handle.readlines.return_value = None handle.read.side_effect = _read_side_effect _state[1] = _readline_side_effect() handle.readline.side_effect = _state[1] handle.readlines.side_effect = _readlines_side_effect handle.__iter__.side_effect = _iter_side_effect handle.__next__.side_effect = _next_side_effect handle.__exit__.side_effect = _exit_side_effect def reset_data(*args, **kwargs): _state[0] = _to_stream(read_data) if handle.readline.side_effect == _state[1]: # Only reset the side effect if the user hasn't overridden it. _state[1] = _readline_side_effect() handle.readline.side_effect = _state[1] return DEFAULT mock.side_effect = reset_data mock.return_value = handle return mock class PropertyMock(Mock): """ A mock intended to be used as a property, or other descriptor, on a class. `PropertyMock` provides `__get__` and `__set__` methods so you can specify a return value when it is fetched. Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. """ def _get_child_mock(self, /, **kwargs): return MagicMock(**kwargs) def __get__(self, obj, obj_type=None): return self() def __set__(self, obj, val): self(val) _timeout_unset = sentinel.TIMEOUT_UNSET class ThreadingMixin(Base): DEFAULT_TIMEOUT = None def _get_child_mock(self, /, **kw): if isinstance(kw.get("parent"), ThreadingMixin): kw["timeout"] = kw["parent"]._mock_wait_timeout elif isinstance(kw.get("_new_parent"), ThreadingMixin): kw["timeout"] = kw["_new_parent"]._mock_wait_timeout return super()._get_child_mock(**kw) def __init__(self, *args, timeout=_timeout_unset, **kwargs): super().__init__(*args, **kwargs) if timeout is _timeout_unset: timeout = self.DEFAULT_TIMEOUT self.__dict__["_mock_event"] = threading.Event() # Event for any call self.__dict__["_mock_calls_events"] = [] # Events for each of the calls self.__dict__["_mock_calls_events_lock"] = threading.Lock() self.__dict__["_mock_wait_timeout"] = timeout def reset_mock(self, /, *args, **kwargs): """ See :func:`.Mock.reset_mock()` """ super().reset_mock(*args, **kwargs) self.__dict__["_mock_event"] = threading.Event() self.__dict__["_mock_calls_events"] = [] def __get_event(self, expected_args, expected_kwargs): with self._mock_calls_events_lock: for args, kwargs, event in self._mock_calls_events: if (args, kwargs) == (expected_args, expected_kwargs): return event new_event = threading.Event() self._mock_calls_events.append((expected_args, expected_kwargs, new_event)) return new_event def _mock_call(self, *args, **kwargs): ret_value = super()._mock_call(*args, **kwargs) call_event = self.__get_event(args, kwargs) call_event.set() self._mock_event.set() return ret_value def wait_until_called(self, *, timeout=_timeout_unset): """Wait until the mock object is called. `timeout` - time to wait for in seconds, waits forever otherwise. Defaults to the constructor provided timeout. Use None to block undefinetively. """ if timeout is _timeout_unset: timeout = self._mock_wait_timeout if not self._mock_event.wait(timeout=timeout): msg = (f"{self._mock_name or 'mock'} was not called before" f" timeout({timeout}).") raise AssertionError(msg) def wait_until_any_call_with(self, *args, **kwargs): """Wait until the mock object is called with given args. Waits for the timeout in seconds provided in the constructor. """ event = self.__get_event(args, kwargs) if not event.wait(timeout=self._mock_wait_timeout): expected_string = self._format_mock_call_signature(args, kwargs) raise AssertionError(f'{expected_string} call not found') class ThreadingMock(ThreadingMixin, MagicMixin, Mock): """ A mock that can be used to wait until on calls happening in a different thread. The constructor can take a `timeout` argument which controls the timeout in seconds for all `wait` calls of the mock. You can change the default timeout of all instances via the `ThreadingMock.DEFAULT_TIMEOUT` attribute. If no timeout is set, it will block undefinetively. """ pass def seal(mock): """Disable the automatic generation of child mocks. Given an input Mock, seals it to ensure no further mocks will be generated when accessing an attribute that was not already defined. The operation recursively seals the mock passed in, meaning that the mock itself, any mocks generated by accessing one of its attributes, and all assigned mocks without a name or spec will be sealed. """ mock._mock_sealed = True for attr in dir(mock): try: m = getattr(mock, attr) except AttributeError: continue if not isinstance(m, NonCallableMock): continue if isinstance(m._mock_children.get(attr), _SpecState): continue if m._mock_new_parent is mock: seal(m) class _AsyncIterator: """ Wraps an iterator in an asynchronous iterator. """ def __init__(self, iterator): self.iterator = iterator code_mock = NonCallableMock(spec_set=CodeType) code_mock.co_flags = inspect.CO_ITERABLE_COROUTINE self.__dict__['__code__'] = code_mock async def __anext__(self): try: return next(self.iterator) except StopIteration: pass raise StopAsyncIteration PK!a2 NN&__pycache__/mock.cpython-311.opt-1.pycnu[ 0iH`dZddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZGdd eZd eeDZd ZeZd Zd ZdZdZdZ dZ!dydZ"dZ#dZ$dZ%dZ&dydZ'dZ(dZ)dZ*Gdde+Z,Gdde+Z-e-Z.e.j/Z/e.j0Z1e.j2Z3hd Z4d!Z5Gd"d#e6Z7d$Z8Gd%d&e+Z9Gd'd(e+Z:Gd)d*e:Z;ej<e;j=Z>Gd+d,e6Z?d-Z@Gd.d/e:ZAGd0d1eAe;ZBd2ZCGd3d4e+ZDd5ZEe/dddddfdd6d7ZF dzd8ZGe/dddddfdd6d9ZHGd:d;e+ZId<ZJd=ZKeFeH_+eIeH_LeGeH_MeKeH_Nd>eH_Od?ZPd@ZQdARdBeQSDZTdARdCeQSDZUhdDZVdEZWdFdARePeQeTeUgSDZXhdGZYdHhZZeYeZzZ[eXeVzZ\e\e[zZ]hdIZ^dJdKdLdMdNZ_e`e`e`e`dOddddPdQd dOddR ZadSZbdTZcdUZddVZeebecedeedWZfdXZgGdYdZe:ZhGd[d\ehe;ZiGd]d^ehZjGd_d`eheBZkGdadbe:ZlGdcdde:ZmGdedfemejeBZnGdgdhe+ZoeoZpdiZqGdjdkerZsesdlZt d{dd6dmZudnZvGdodpe+ZwexeuexepjyfZzda{da|dqZ}d|dsZ~GdtdueBZdvZGdwdxZdS)})Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockceZdZdZdS)InvalidSpecErrorz8Indicates that an invalid value was used as a mock spec.N__name__ __module__ __qualname____doc__4/opt/alt/python311/lib64/python3.11/unittest/mock.pyrr)sBBBBr"rc<h|]}|d|S_ startswith).0names r# r+-s) H H Hd4??33G3G HT H H Hr"Tct|rt|tsdSt|drt |d}t |pt j|S)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r# _is_async_objr65sgji&@&@usJ'c:&& s # # ?w':3'?'??r"cFt|ddrt|SdS)N__code__F)r1r)funcs r#_is_async_funcr:=s)tZ&&"4(((ur"cFtt|tSN) issubclasstyper r4s r#r.r.Ds d3ii 1 11r"ct|tp)t|tot|tSr<)r/ BaseExceptionr>r=r4s r# _is_exceptionrAJs63 && A3@*S-"@"@r"c^t|trt|dr|jS|SNmock)r/ FunctionTypesr0rDr4s r# _extract_mockrFQs3#}%%'#v*>*>x r"ct|tr |s |j}d}njt|ttfrt|trd}|j}n/t|t s |j}n#t$rYdSwxYw|rt|d}n|} |tj |fS#t$rYdSwxYw)z Given an arbitrary, possibly callable object, try to create a suitable signature object. Return a (reduced func, signature) tuple, or None. TN) r/r>__init__ classmethod staticmethodr-rE__call__AttributeErrorrr2 signature ValueError)r9 as_instanceeat_selfsig_funcs r#_get_signature_objectrRZs $k} D; 5 6 6  dK ( ( H} m , , =DD   44 4&&W&x0000 tts$3A;; B B "B88 CCFct|||dS\}fd}t|||t|_t|_dS)Nc"j|i|dSr<bind)selfargskwargssigs r#checksigz"_check_signature..checksig $!&!!!!!r")rR_copy_func_detailsr>_mock_check_sig __signature__)r9rD skipfirstinstancer[rZs @r#_check_signaturerb}sr h : :C {ID#"""""tX&&&!)DJJ"DJJr"c pdD]2} t||t||##t$rY/wxYwdS)N)rr __text_signature__r __defaults____kwdefaults__)setattrr1rL)r9funcopy attributes r#r]r]sa   GYi(@(@ A A A A    D  s & 33ct|trdSt|tttfrt |jSt|dddSdS)NTrKF)r/r>rJrIr _callabler-r1r4s r#rkrks^#tt# k:>??'&&&sJ%%1t 5r"c<t|ttfvSr<)r>listtupler4s r#_is_listros 99u %%r"ct|tst|ddduS|f|jzD]}|jddS dS)ztGiven an object, return True if the object is callable. For classes, return True if instances would be callable.rKNTF)r/r>r1__mro____dict__get)r5bases r#_instance_callablerusn c4 :sJ--T99$ =  Z ( ( 444 5 5r"c0 t|t}t|||}||S|\} fd}t|||j}|sd}||d}d|z} t | |||} t| | | S)Nc"j|i|dSr<rU)rXrYrZs r#r[z _set_signature..checksigr\r"rh) _checksig_rDzYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r/r>rRr]r isidentifierexec _setup_func) rDoriginalrar`resultr9r[r*contextsrcrhrZs @r#_set_signaturers 8T**I "8Xy A AF ~ ID#"""""tX&&&  D     %t44G $&* +C #wdmGs### Nr"c_fd}fd}fd}fd}fd}fd}fd} fd} d _d _d_t _t _t _j_j _ j _ |_ |_ |_ | _| _|_|_|_|__dS) Ncj|i|Sr<)assert_called_withrXrYrDs r#rz'_setup_func..assert_called_with&t&7777r"cj|i|Sr<) assert_calledrs r#rz"_setup_func..assert_calleds!t!426222r"cj|i|Sr<)assert_not_calledrs r#rz&_setup_func..assert_not_calleds%t%t6v666r"cj|i|Sr<)assert_called_oncers r#rz'_setup_func..assert_called_oncerr"cj|i|Sr<)assert_called_once_withrs r#rz,_setup_func..assert_called_once_withs+t+T.assert_has_callss$t$d5f555r"cj|i|Sr<)assert_any_callrs r#rz$_setup_func..assert_any_calls#t#T4V444r"ct_t_j}t |r|ur|dSdSdSr<) _CallList method_calls mock_calls reset_mock return_valuer.)retrhrDs r#rz_setup_func..reset_mockso({{&[[ " S ! ! #++ NN       ++r"Fr)rDcalled call_count call_argsrcall_args_listrrr side_effect_mock_childrenrrrrrrrrr__mock_delegate) rhrDrZrrrrrrrrs `` r#r{r{sGL88888333337777788888=====6666655555GNGG&[[G$;;G"G,G*G!0G!3G&=G#/G-G#G)G 1G!3GG!Dr"c tjj_d_d_t _fd}dD]!}t|t||"dS)Nrc:tj||i|Sr<)r1rD)attrrXrYrDs r#wrapperz"_setup_async_mock..wrapper s$'wty$''8888r")assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listrgr)rDrris` r#_setup_async_mockrs +9DDDO$;;D 99999, > >  i)! >r"c$d|ddz|kS)N__%s__r!r*s r# _is_magicrs d1R4j D ((r"c$eZdZdZdZdZdZdS)_SentinelObjectz!A unique, named, sentinel object.c||_dSr<rrWr*s r#rHz_SentinelObject.__init__"s  r"cd|jzSNz sentinel.%srrWs r#__repr__z_SentinelObject.__repr__%ty((r"cd|jzSrrrs r# __reduce__z_SentinelObject.__reduce__(rr"N)rrrr rHrrr!r"r#rr sG''))))))))r"rc$eZdZdZdZdZdZdS) _SentinelzAAccess attributes to return a named object, usable as a sentinel.ci|_dSr<) _sentinelsrs r#rHz_Sentinel.__init__.s r"cl|dkrt|j|t|S)N __bases__)rLr setdefaultrrs r# __getattr__z_Sentinel.__getattr__1s3 ;   ))$0E0EFFFr"cdS)Nrr!rs r#rz_Sentinel.__reduce__7szr"N)rrrr rHrrr!r"r#rr,sJKKGGG r"r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecxt|d|z}||fd}||fd}t||S)N_mock_cT|j}|t||St||Sr<)rr1)rWr* _the_namerZs r#_getz"_delegating_property.._getLs/! ;4++ +sD!!!r"cR|j}| ||j|<dSt|||dSr<)rrrrg)rWvaluer*rrZs r#_setz"_delegating_property.._setQs9! ;',DM) $ $ $ Cu % % % % %r")_allowed_namesaddproperty)r*rrrs r#_delegating_propertyrIset4I """" $y&&&& D$  r"ceZdZdZdZdS)rct|tst||St|}t|}||krdSt d||z dzD]}||||z}||krdSdS)NFrT)r/rm __contains__lenrange)rWr len_valuelen_selfisub_lists r#rz_CallList.__contains__^s%&& 2$$T511 1JJ t99 x  5q(Y.233  AAa kM*H5  tt!ur"cDtjt|Sr<)pprintpformatrmrs r#rz_CallList.__repr__ls~d4jj)))r"N)rrrrrr!r"r#rr\s2   *****r"rct|}t|sdS|js|js|j|jdS|}|||urdS|j}||r||_||_|r||_||_dS)NFT)rFr.rrrr)parentrr*new_name_parents r#_check_and_set_parentrps % E U # #u  U1   '   +uG   e  5*  (!''  # 4r"ceZdZdZdZdS) _MockIterc.t||_dSr<)iterr5)rWr5s r#rHz_MockIter.__init__s99r"c*t|jSr<)nextr5rs r#__next__z_MockIter.__next__sDH~~r"N)rrrrHrr!r"r#rrs2r"rceZdZeZdZdZdS)BaseNcdSr<r!rWrXrYs r#rHz Base.__init__s r")rrrrrrrHr!r"r#rrs/      r"rceZdZdZeZdZ d-dZdZd.dZ d/d Z d Z d Z d Z ee e e Zed ZedZedZedZedZedZdZdZeeeZd0ddddZdZdZdZdZdZdZ dZ!dZ"d1d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d.d(Z+d)Z,d*Z-d2d,Z.dS)3r z A non-callable version of `Mock`cz|f}t|ts]tj|g|Ri|j}|d|d}|t |r t|f}t|j|d|j i}tt| |}|S)Nspec_setspecr ) r=AsyncMockMixin _MOCK_SIG bind_partial argumentsrsr6r>rr _safe_superr __new__)clsrXkwbases bound_argsspec_argnewras r#rzNonCallableMock.__new__s#~.. ."/AdAAAbAAKJ!~~j*..2H2HIIH# h(?(?#'-3<CK(@AA44<rRrr) rWrrrrr&r(r*rresrrs r#rzNonCallableMock._mock_add_specs' T " " T"#R#R#R#RSS S  II * *D"74t#<#<== *##D)))  HTNN $%% )" "4jj '(99FFC!nc!fOt99D="- (&5"#$(!#/   r"c|j}|j |jj}|tur%|j||d}||_|S)N()rr)rrrrr_get_child_mock)rWrs r#__get_return_valuez"NonCallableMock.__get_return_values]%   *%2C '>>d.6&& D'C!$D  r"cb|j||j_dS||_t||dddS)Nr/)rrrr)rWrs r#__set_return_valuez"NonCallableMock.__set_return_value%s>   */4D  , , ,&+D # !$tT : : : : :r"z1The value to be returned when the mock is called.c<|jt|S|jSr<)r&r>rs r# __class__zNonCallableMock.__class__1s   #:: r"rrrrrc|j}||jS|j}|It|s:t |t s%t |st |}||_|Sr<)rrrcallabler/rrA)rW delegatedsfs r#__get_side_effectz!NonCallableMock.__get_side_effect>sj'  ) )  " N8B<>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError} >>> mock.configure_mock(**attrs)c8|ddS)Nr.)count)entrys r#z0NonCallableMock.configure_mock..sq1D1Dr")keyrIN)sorteditemssplitpopr1rg)rWrYargvalrXfinalr5rKs r#rzNonCallableMock.configure_mockrsv||~~$E#D FFF % %HC 99S>>DHHJJEC * *c5)) C $ $ $ $ % %r"c |dvrt||j%||jvs |tvrtd|znt|rt||js:|jr ||jvr*|drt|d|dt j5|j |}|turt||Cd}|j t|j |}| |||||}||j|<nt|trv t!|j|j|j|j|j}n>#t,$r1|jdp|}t-d|d |d |d |jd wxYw||j|<dddn #1swxYwY|S) N>rr)zMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)rr*rrrrCannot autospec attr from target , as it has already been mocked out. [target=, attr=r%)rLr) _all_magicsrrr(r _lockrrsrDrr1r1r/rCr rrrarr*rrr)rWr*r}r target_names r#rzNonCallableMock.__getattr__s 4 4 4 && &   +4---1D1D$%F%MNNN2E t__ ' && &  N$*< NDL^@^@^OPP N$MM'+MMMNNN " 4 4(,,T22F!!$T***#/$D$4d;;E--d%4 $..4#D))FJ// 4 D, V_fo v{FF(DDD"&- "="EK*CCC&CC#'CC28+CCCDDDD .4#D); 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4> s++B F:9,E&%F:&;F!! F::F>F>cn|jg}|j}|}d}|dgkrd}|7|}||j|zd}|jdkrd}|j}|7tt |}|jpd}t |dkr|ddvr|dz }||d<d|S)NrIr/r rDr)r/z().r)rrr,rmreversedrrjoin)rW _name_listrlastdot_firsts r#_extract_mock_namez"NonCallableMock._extract_mock_names)* ' $  C!D   g4s: ; ; ;C%--.G!(:..// *F z??Q  !}M11#  1 wwz"""r"c|}d}|dvrd|z}d}|jd}|jrd}||jjz}dt |j||dt |dS) Nr )rDzmock.z name=%rz spec=%rz spec_set=%r)rir&r'rr>rA)rWr* name_string spec_strings r#rzNonCallableMock.__repr__s&&(( ( ( ($t+K   '$K~ -, %(8(AAK JJ   K KK tHHHH   r"cvtst|S|jpg}t t |}t |j}d|j D}d|D}d|D}tt||z|z|zS)z8Filter the output of `dir(mock)` to only useful members.c*g|]\}}|tu|Sr!)rD)r)m_namem_values r# z+NonCallableMock.__dir__..s1(((&vwh&& &&&r"c<g|]}|d|Sr%r'r)es r#rrz+NonCallableMock.__dir__..s)CCC1c1B1BCQCCCr"cZg|](}|drt|&|)Sr%)r(rrts r#rrz+NonCallableMock.__dir__..sE###1c1B1B#q\\#Q###r") r object__dir__r)r+r>rmrrrrOrNset)rWextras from_type from_dictfrom_child_mockss r#rxzNonCallableMock.__dir__s (>>$'' '#)rT OO '' ((*.*=*C*C*E*E(((DC CCC ## ### c&9,y8;KKLLMMMr"cT|tvrt||Sjr+j$|jvr|jvrt d|z|tvrd|z}t ||tvrj|jvrt d|zt|s5tt|t|||fd}nft|d|tt|||j|<n+|dkr |_dSt|||r |j|<jr;t#|s+d|}t d|t||S)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.cg|Ri|Sr<r!)rXrr|rWs r#rLz-NonCallableMock.__setattr__.. s!HHT,GD,G,G,GB,G,Gr"r6rIz Cannot set )rrw __setattr__r'r)rrrL_unsupported_magicsr_r.rgr> _get_methodrrr&r r0ri)rWr*rmsg mock_namer|s` @r#rzNonCallableMock.__setattr__s > ! !%%dD%88 8n 2!3!? * * *  % % !Dt!KLL L ( ( (BTIC %% % [ !-$d>P2P2P$%H4%OPPP$U++ 2T D+dE*B*BCCC GGGGG&dE4>>>T D%000,1#D)) [ $D  F$T5$== 2,1#D)   |t|jvr(tt||||jvrdS|j|t }||jvr)tt| |n|turt||t ur|j|=t|j|<dSr<) r_r>rrdelattrrrs_missingrr __delattr__rDrL)rWr*r5s r#rzNonCallableMock.__delattr__!s ;  44::+>#>#> DJJ % % %4=((!%%dH55 4=  . . : :4 @ @ @ @ H__ && & h  #D)$,D!!!r"c6|jpd}t|||SrC)r_format_call_signaturerWrXrYr*s r#_format_mock_call_signaturez+NonCallableMock._format_mock_call_signature3s (&%dD&999r"rcdd}|||}|j}|j|}||||fzS)Nz0expected %s not found. Expected: %s Actual: %s)rr)rWrXrYactionmessageexpected_stringr actual_strings r#_format_mock_failure_messagez,NonCallableMock._format_mock_failure_message8sDF::4HHN 88)D &/=AAAr"c|s|jSd}|ddd}|j}|D]M}||}|t |t rnt|}|j}|j}N|S)aH * If call objects are asserted against a method/function like obj.meth1 then there could be no name for the call object to lookup. Hence just return the spec_signature of the method/function being asserted against. * If the name is not empty then remove () and split by '.' to get list of names to iterate through the children until a potential match is found. A child mock is created only during attribute access so if we get a _SpecState then no attributes of the spec were accessed and can be safely exited. Nr/r rI)r(replacerPrrsr/rCrF)rWr*rZnameschildrenrFs r#_get_call_signature_from_namez-NonCallableMock._get_call_signature_from_name@s (' ' T2&&,,S11& , ,DLL&&E} 5* = =} &e,, /+ r"ct|tr/t|dkr||d}n|j}|vt|dkrd}|\}}n|\}}} |j|i|}t ||j|jS#t$r}| dcYd}~Sd}~wwxYw|S)a Given a call (or simply an (args, kwargs) tuple), return a comparison key suitable for matching with other calls. This is a best effort method which relies on the spec's signature, if available, or falls back on the arguments themselves. rrNr ) r/rnrrr(rVrrXrY TypeErrorwith_traceback)rW_callrZr*rXrY bound_callrus r# _call_matcherzNonCallableMock._call_matcheras eU # # 'E Q44U1X>>CC&C ?5zzQ$ ff%*"dF .%SXt6v66 D*/:3DEEE . . .''-------- .Ls0'B C"B<6C<Cc|jdkr8d|jpdd|jd|}t|dS)z/assert that the mock was never called. r Expected 'rDz"' to not have been called. Called  times.Nrr _calls_reprAssertionErrorrWrs r#rz!NonCallableMock.assert_not_called|s^ ?a   o///ooo&&(((*C!%% % r"cR|jdkrd|jpdz}t|dS)z6assert that the mock was called at least once rz"Expected '%s' to have been called.rDN)rrrrs r#rzNonCallableMock.assert_calleds; ?a  7O-v/C %% % r"c|jdks8d|jpdd|jd|}t|dS)z3assert that the mock was called only once. rrrDz#' to have been called once. Called rNrrs r#rz"NonCallableMock.assert_called_onces^!###o///ooo&&(((*C!%% % $#r"ctj/}d}d|d|}t|fd}t fd}j}||kr1t |t r|nd}t||dS)zassert that the last call was made with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.Nz not called.z#expected call not found. Expected: z Actual: c4}|Sr<rrrXrYrWs r#_error_messagez:NonCallableMock.assert_called_with.._error_messages33D&AACJr"Ttwo)rrrr_Callr/ Exception)rWrXrYexpectedactual error_messagercauses``` r#rz"NonCallableMock.assert_called_withs > !77fEEH"FFxx)M // /       %%eT6N&E&E&EFF##DN33 X   *8Y ? ?IHHTE !1!122 =  r"c|jdks8d|jpdd|jd|}t||j|i|S)ziassert that the mock was called exactly once and that that call was with the specified arguments.rrrDz' to be called once. Called r)rrrrrrWrXrYrs r#rz'NonCallableMock.assert_called_once_withsn!###o///ooo&&(((*C!%% %&t&7777r"cfd|D}td|Dd}tfdjD}|su||vro|d}ndd|D}t |dt|d d |dSt|}g}|D]=} ||#t$r| |Y:wxYw|r-t j pd d t|d|d|dS)aassert the mock has been called with the specified calls. The `mock_calls` list is checked for the calls. If `any_order` is False (the default) then the calls must be sequential. There can be extra calls before or after the specified calls. If `any_order` is True then the calls can be in any order, but they must all appear in `mock_calls`.c:g|]}|Sr!rr)crWs r#rrz4NonCallableMock.assert_has_calls..'999aD&&q))999r"c3DK|]}t|t|VdSr<r/rrts r# z3NonCallableMock.assert_has_calls..1FFAZ9-E-EFaFFFFFFr"Nc3BK|]}|VdSr<rrs r#rz3NonCallableMock.assert_has_calls..s1MMd0033MMMMMMr"zCalls not found.z+Error processing expected calls. Errors: {}c@g|]}t|tr|ndSr<rrts r#rrz4NonCallableMock.assert_has_calls..;$7$7$7()*4Ay)A)A$KAAt$7$7$7r" Expected: z Actual)prefixrIrDz does not contain all of z in its call list, found z instead) rrrformatrrrstriprmremoverNr,rrn) rWcalls any_orderrr all_callsproblem not_foundkalls ` r#rz NonCallableMock.assert_has_callss:9995999FFFFFMMMMMMT_MMMMM  y((=0GG ,-3V$7$7-5$7$7$7.8.8%II!*5!1!1I''z'::AA#FFII  FOO   ' 'D '  &&&& ' ' '  &&&&& '   &*o&?&?&?&+I&6&6&6&6 C    sC--DDc$t||fd}t|tr|nd}fdjD}|s|t |vr)||}td|z|dS)zassert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if the call is the most recent one.TrNc:g|]}|Sr!rrs r#rrz3NonCallableMock.assert_any_call..s'EEEA$$$Q''EEEr"z%s call not found)rrr/rr _AnyComparerrrrWrXrYrrrrs` r#rzNonCallableMock.assert_any_calls %%eT6N&E&E&EFF&x;;EEEEE1DEEE  HL$8$888">>tVLLO #o5 98r"c |jr7d|vr d|dnd}||z}t||d}||jdvr t di|St |}t|tr|tvrt }nt|tr)|tvs|j r||j vrt}ndt }n\t|ts:t|trt}n*t|trt }n |jd}|di|S)aPCreate the child mocks for attributes and return value. By default child mocks will be the same type as the parent. Subclasses of Mock may want to override this to customize the way child mocks are made. For non-callable mocks the callable variant will be used (rather than any custom subclass).r*rIr/rr*rr!)r rirLrsrrr r>r=r_async_method_magicsr_all_sync_magicsr) CallableMixinr r rrq)rWrrirr_typeklasss r#r1zNonCallableMock._get_child_mocks[   ,,2bLL(BvJ(((dI//11I=I ++ +FF;''  n5 5 5??r?? "T  eY ' ' %I9M,M,MEE ~ . . %---&.+48J+J+J!!E=11 %%!566 !E?33 M!$Eu{{r{{r"CallscJ|jsdSd|dt|jdS)zRenders self.mock_calls as a string. Example: " Calls: [call(1), call(2)]." If self.mock_calls is empty, an empty string is returned. The output will be truncated if very long. r  z: rI)rr)rWrs r#rzNonCallableMock._calls_reprs6 2;F;;i88;;;;r") NNNNNNr NFNFF)FFr<)r)r)/rrrr rr`rrHrr#r"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr6rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrrrrrirrxrrrrrrrrrrrrrr1rr!r"r#r r s** EGGE   ">BEI   ;;;M8.0B.00L  X " !( + +F%%l33J$$[11I))*:;;N%%l33J   ***(,.?@@K$u%$$$$$<%%%,---`###6   *NNN$$5$5$5N---$::: BBBBB6&&&&&&&&&>>>, 8 8 8****Z    ###L < < < < < .5s1$HfF"r"TF)allzip)rWitemrs r#rz_AnyComparer.__contains__2s^  E(+D%(8(8 tt   ur"N)rrrr rr!r"r#rr-s-r"rc||St|r|St|r|S t|S#t$r|cYSwxYwr<)rArkrrr4s r#r=r==sk { S ~~ Cyy  s7 AAc HeZdZddedddddddf dZdZdZdZdZdZ dS) rNr c x||jd<tt|j||||||| | fi| ||_dS)Nr)rrrrrHr) rWrrrrr*rrrrrrYs r#rHzCallableMixin.__init__Nsa/; *+1 M4((1 %x K  39   'r"cdSr<r!rs r#r^zCallableMixin._mock_check_sigZs r"cP|j|i||j|i||j|i|Sr<)r^_increment_mock_call _mock_callrs r#rKzCallableMixin.__call___sK d-f---!!426222t////r"c|j|i|Sr<)_execute_mock_callrs r#rzCallableMixin._mock_callgs&t&7777r"c~d|_|xjdz c_t||fd}||_|j||jdu}|j}|j}|dk}|j td||f|j }||rB|j t|||f|jdu}|r |jdz|z}t|||f} |j | |jr|rd} nd} |jdk}|j| z|z}|j }|dSdS)NTrrr/r rI) rrrrrr,rrrrrr) rWrXrYrdo_method_callsmethod_call_namemock_call_name is_a_callrthis_mock_callrgs r#rz"CallableMixin._increment_mock_calljs  1 tVn$/// ""5)))+47?,"d*  ub$%788999+ % W(//7Gv6V0W0WXXX"-":$"F"W'2'='CFV'V$#ND&#ABBN  " ) ). 9 9 9) SCCC'6$> !,!;c!AN!R&6K-%%%%%r"c^|j}|Tt|r|t|s!t|}t|r|n||i|}|tur|S|jtur|jS|jr|jjtur|jS|j |j|i|S|jSr<) rrArkrrrrrr)rWrXrYeffectr}s r#rz CallableMixin._execute_mock_calls!  V$$ 1 v&& 1f ((! L! 000W$$  "' 1 1$ $   %4#6#C7#R#R$ $   '#4#T4V44 4  r") rrrrrHr^rKrrrr!r"r#rrLs d$d!RT ' ' ' '   000888,7,7,7\!!!!!r"rceZdZdZdS)ra Create a new `Mock` object. `Mock` takes several optional arguments that specify the behaviour of the Mock object: * `spec`: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an `AttributeError`. If `spec` is an object (rather than a list of strings) then `mock.__class__` returns the class of the spec object. This allows mocks to pass `isinstance` tests. * `spec_set`: A stricter variant of `spec`. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as `spec_set` will raise an `AttributeError`. * `side_effect`: A function to be called whenever the Mock is called. See the `side_effect` attribute. Useful for raising exceptions or dynamically changing return values. The function is called with the same arguments as the mock, and unless it returns `DEFAULT`, the return value of this function is used as the return value. If `side_effect` is an iterable then each call to the mock will return the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. * `unsafe`: By default, accessing any attribute whose name starts with *assert*, *assret*, *asert*, *aseert* or *assrt* will raise an AttributeError. Passing `unsafe=True` will allow access to these attributes. * `wraps`: Item for the mock object to wrap. If `wraps` is not None then calling the Mock will pass the call through to the wrapped object (returning the real result). Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist will raise an `AttributeError`). If the mock has an explicit `return_value` set then calls are not passed to the wrapped object and the `return_value` is returned instead. * `name`: If the mock has a name then it will be used in the repr of the mock. This can be useful for debugging. The name is propagated to child mocks. Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. Nrr!r"r#rrs5555r"rc@d}|D]}||vrt|ddS)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r#_check_spec_arg_typosrsN 2E ? " "PPP  #r"c~eZdZdZgZdddZdZdZdZe j dZ d Z d Z d Zd Zd ZdZdZdS)_patchNFrc |)|turtd|td| st| t|rt d|d|dt|rt d|d|d||_||_||_||_||_ ||_ d|_ ||_ ||_ | |_g|_dS)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=r%z? as the spec_set target has already been mocked out. [spec_set=F)rrNrr.rgetterrir  new_callablercreate has_localrautospecrYadditional_patchers) rWrrir rrrr rrYrs r#rHz_patch.__init__sV  #'!! B# G * !& ) ) ) T " " A"@I@@6:@@@AA A X & & P"OIOOAIOOOPP P "(       #%   r"c t|j|j|j|j|j|j|j|j|j }|j |_ d|j D|_ |S)Nc6g|]}|Sr!)copy)r)ps r#rrz_patch.copy..,s-' ' ' AFFHH' ' ' r") rrrir rrrr rrYattribute_namer )rWpatchers r#rz _patch.copy%sq K49 K M4,dk   "&!4' ' "6' ' ' #r"ct|tr||Stj|r||S||Sr<r/r>decorate_classr2rdecorate_async_callabledecorate_callable)rWr9s r#rKz_patch.__call__2sc dD ! ! -&&t,, ,  &t , , 6//55 5%%d+++r"ct|D]q}|tjs"t ||}t |dsC|}t||||r|SNrK)r+r(r TEST_PREFIXr1r0rrg)rWrr attr_valuers r#rz_patch.decorate_class:sJJ 6 6D??5#455  --J:z22 iikkG E4!4!4 5 5 5 5 r"c#TKg}tj5}|jD]W}||}|j||4|jtur||X|t|z }||fVddddS#1swxYwYdSr<) contextlib ExitStack patchings enter_contextrupdater rr,rn)rWpatchedrXkeywargs extra_args exit_stackpatchingrRs r#decoration_helperz_patch.decoration_helperHs  ! # # #z#- + + ..x88*6OOC((((\W,,%%c*** E*%% %D" " " " # # # # # # # # # # # # # # # # # #sA8BB!$B!ctdrjStfdg_S)Nrc|||5\}}|i|cdddS#1swxYwYdSr<r&rXr"newargs newkeywargsr9r!rWs r#r!z)_patch.decorate_callable..patched]s''(,(022 55Kg{tW4 44 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s 155r0rr,rrWr9r!s``@r#rz_patch.decorate_callableWsv 4 % %  N ! !$ ' ' 'K t 5 5 5 5 5 5  5 "Fr"ctdrjStfdg_S)NrcK||5\}}|i|d{VcdddS#1swxYwYdSr<r)r*s r#r!z/_patch.decorate_async_callable..patchedns''(,(022 ;5Kg{!T7:k:::::::: ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;s 9==r-r.s``@r#rz_patch.decorate_async_callablehsv 4 % %  N ! !$ ' ' 'K t ; ; ; ; ; ;  ; "Fr"c`|}|j}t}d} |j|}d}n-#tt f$rt ||t}YnwxYw|tvrt|trd|_ |j s|turt |d|||fS)NFTz does not have the attribute ) rrirrrrLKeyErrorr1 _builtinsr/rr)rWtargetr*r|locals r# get_originalz_patch.get_originalys~ t,HEE) 6 6 6vtW55HHH 6 9  FJ!?!? DK{ x722 7=vvttD s 6'A A c |j|j|j}}}|j|j}}|j}||_|durd}|durd}|durd}||td|||dvrtd| \}}|tur|d} |dur |}|dur|}d}n| |dur|}d}n|dur|}||/|turtdt|trd} |t|rt} nt} i} ||} nN||J|} ||} t!| rd| v} nt#|  } t| rt} n | rt$} ||| d <||| d <t| tr&t'| t(r|jr |j| d <| || di| }| r_t/|rP|} ||} t!| st1| st$} | d | d|d d | |_n||turtd|turtdt7|}|dur|}t/|jr#t9d|jd|jd|dt/|rAt;|jd|j}t9d|jd|d|jd|d t=|f||jd|}n|rtd|}||_||_ tCj"|_# tI|j|j||j%ci}|jtur |||j%<|j&D]?}|j#'|}|jtur||@|S|S#|j(tSj*sYdSxYw)zPerform the patch.FNzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerKrrr*r/r0zBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=Truer[z: as the patch target has already been mocked out. [target=r^r%rr\r])r_namez.Can't pass kwargs to a mock we aren't creatingr!)+r rrr rYrrr4rr6rr/r>r6r rror8r r=r rir r.rurQrboolrr1r temp_originalis_localrr _exit_stackrgrr r__exit__sysexc_info)rWr rrr rYrr|r5inheritKlass_kwargs this_spec not_callableranew_attrr#r%rRs r# __enter__z_patch.__enter__s"h 4=8T=$+&( kkmm  5==D u  H u  H   4=>> >  !5 L ( (TUU U++--% '>>h.Gt||t##'HD!t###HDT!!#8#7w&&#$GHHHh--#"G| h 7 7|!!G'$!X%9 ' (II&&;#-Y#>LL'/ ':':#:L ++1%EE!10E"&#&. #5$'' 15/22 17;~ 1"&. NN6 " " "%""'""C 4,S11 4! ' (I ++1&y1110E F####(5$4SD$4$4+2$4$4  !'!!(7"" GHHHH~~H4# -- D&CDNCC#{CC5=CCCDDD!** D%dk:t{KK &CDNCC"CC#{CC5=CCCDDD "(BX(,BB:@BBCC  NLMM M% %/11  DK : : :". 8w&&7:Jt23 $ 8//H*88BBC|w.."))#...!!J  4=#,..1    sBOOO<ch|jr/|jtur!t|j|j|jndt |j|j|jsCt|j|jr |jdvr t|j|j|j|`|`|`|j }|` |j |S)zUndo the patch.)r rre__annotations__rf) r;r:rrgr4rirrr0r<r=)rWr?r$s r#r=z_patch.__exit__#s = IT/w>> DK1C D D D D DK 0 0 0; I T^(L(L I+=== T^T5GHHH   M K%  "z"H--r"cb|}|j||Sz-Activate a patch, returning any created mock.)rF_active_patchesr,rWr}s r#startz _patch.start8s-!! ##D))) r"c |j|n#t$rYdSwxYw|dddSzStop an active patch.N)rKrrNr=rs r#stopz _patch.stop?s[   ' ' - - - -   44 }}T4...s  ++)rrrrrKrHrrKrrcontextmanagerr&rrr6rFr=rMrPr!r"r#rrsNOAF"&"&"&"&"&J   ,,,    # # #""0PPPd...*/////r"rc |dd\}}n-#tttf$rtd|wxYwt t j||fS)NrIrz,Need a valid target to patch. You supplied: )rsplitrrNrLrpkgutil resolve_name)r4ris r# _get_targetrVKsG"MM#q11 z> 2GGG E6 E EGG GG 7' 0 0) ;;s *Arc tturtdfd} t| |||||||| | S)a patch the named member (`attribute`) on an object (`target`) with a mock object. `patch.object` can be used as a decorator, class decorator or a context manager. Arguments `new`, `spec`, `create`, `spec_set`, `autospec` and `new_callable` have the same meaning as for `patch`. Like `patch`, `patch.object` takes arbitrary keyword arguments for configuring the mock object it creates. When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. z3 must be the actual object to be patched, not a strcSr<r!r4sr#rLz_patch_object..jsVr"r)r>strrr) r4rir rrrr rrrYrs ` r# _patch_objectr[Tsn$ F||s L L L   ^^^F  3f(L&   r"c tturttj}nfd}|st dt |}|d\} } t|| | |||||i } | | _ |ddD]=\} } t|| | |||||i } | | _ | j | >| S)aPerform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the patches:: with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): ... Use `DEFAULT` as the value if you want `patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, and a dictionary is returned when `patch.multiple` is used as a context manager. `patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments `spec`, `spec_set`, `create`, `autospec` and `new_callable` have the same meaning as for `patch`. These arguments will be applied to *all* patches done by `patch.multiple`. When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX` for choosing which methods to wrap. cSr<r!rYsr#rLz!_patch_multiple..sr"z=Must supply at least one keyword argument with patch.multiplerrN) r>rZrrTrUrNrmrOrrr r,) r4rrrr rrYrrOrir r this_patchers ` r#_patch_multipler_qs , F||s-v66   K     E1XNIs 3fh,G'G)99 3 IsD&( lB  '0 ##**<8888 Nr"c Xt|\} } t| | |||||||| S)a: `patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the `target` is patched with a `new` object. When the function/with statement exits the patch is undone. If `new` is omitted, then the target is replaced with an `AsyncMock if the patched object is an async function or a `MagicMock` otherwise. If `patch` is used as a decorator and `new` is omitted, the created mock is passed in as an extra argument to the decorated function. If `patch` is used as a context manager the created mock is returned by the context manager. `target` should be a string in the form `'package.module.ClassName'`. The `target` is imported and the specified object replaced with the `new` object, so the `target` must be importable from the environment you are calling `patch` from. The target is imported when the decorated function is executed, not at decoration time. The `spec` and `spec_set` keyword arguments are passed to the `MagicMock` if patch is creating one for you. In addition you can pass `spec=True` or `spec_set=True`, which causes patch to pass in the object being mocked as the spec/spec_set object. `new_callable` allows you to specify a different class, or callable object, that will be called to create the `new` object. By default `AsyncMock` is used for async functions and `MagicMock` for the rest. A more powerful form of `spec` is `autospec`. If you set `autospec=True` then the mock will be created with a spec from the object being replaced. All attributes of the mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise a `TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. Instead of `autospec=True` you can pass `autospec=some_object` to use an arbitrary object as the spec instead of the one being replaced. By default `patch` will fail to replace attributes that don't exist. If you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! Patch can be used as a `TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods share a common patchings set. `patch` finds tests by looking for method names that start with `patch.TEST_PREFIX`. By default this is `test`, which matches the way `unittest` finds tests. You can specify an alternative prefix by setting `patch.TEST_PREFIX`. Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use "as" then the patched object will be bound to the name after the "as"; very useful if `patch` is creating a mock object for you. Patch will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `patch` takes arbitrary keyword arguments. These will be passed to `AsyncMock` if the patched object is asynchronous, to `MagicMock` otherwise or to `new_callable` if specified. `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are available for alternate use-cases. r)rVr) r4r rrrr rrrYrris r#rrsDV$F++FI  3f(L&   r"cVeZdZdZddZdZdZdZdZd Z d Z d Z d Z d Z dZdS) _patch_dicta# Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test. `in_dict` can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys. `in_dict` can also be a string specifying the name of the dictionary, which will then be fetched by importing it. `values` can be a dictionary of values to set in the dictionary. `values` can also be an iterable of `(key, value)` pairs. If `clear` is True then the dictionary will be cleared before the new values are set. `patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary:: with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()): ... `patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator `patch.dict` honours `patch.TEST_PREFIX` for choosing which methods to wrap. r!Fc ||_t||_|j|||_d|_dSr<)in_dictdictrBr clear _original)rWrdrBrfrYs r#rHz_patch_dict.__init__s> 6ll  6""" r"ct|tr||Stj|r||S||Sr<r)rWfs r#rKz_patch_dict.__call__sc a   *&&q)) )  &q ) ) 3//22 2%%a(((r"c@tfd}|S)Nc |i|S#wxYwr<rb _unpatch_dictrXrrirWs r#_innerz-_patch_dict.decorate_callable.._inner#sV       %q$~"~~""$$$$""$$$$s 3A rrWriros`` r#rz_patch_dict.decorate_callable"9 q % % % % %  % r"c@tfd}|S)NcK |i|d{V S#wxYwr<rlrns r#roz3_patch_dict.decorate_async_callable.._inner/so       %Q^^^+++++++""$$$$""$$$$s <Arprqs`` r#rz#_patch_dict.decorate_async_callable.rrr"c t|D]}}t||}|tjrLt |dr"/ ==DL,  -||~~HH - - -H - - '   - -  - "  !   + NN6 " " " " " + + + + +%c{  + + + +s$A$$BBB66CCc|j}|j}t| ||dS#t$r|D] }||||<YdSwxYwr<)rdrgrzr rL)rWrdr|rMs r#rmz_patch_dict._unpatch_dictgs,>G - NN8 $ $ $ $ $ - - - - -'}  - - - -s6AAc<|j|dS)zUnpatch the dict.NF)rgrm)rWrXs r#r=z_patch_dict.__exit__ts! > %    ur"cl|}tj||SrJ)rFrrKr,rLs r#rMz_patch_dict.start{s-!!%%d+++ r"c tj|n#t$rYdSwxYw|dddSrO)rrKrrNr=rs r#rPz_patch_dict.stops[   " ) )$ / / / /   44 }}T4...s " 00N)r!F)rrrr rHrKrrrrFrbrmr=rMrPr!r"r#rbrbs8)))       +++8 - - -/////r"rbc |dS#t$rt|}|D]}||=YdSwxYwr<)rfrLrm)rdkeysrMs r#rzrzse  G}}  C    s !==cfttjD]}|dS)z7Stop all active patches. LIFO to unroll nested patches.N)rcrrKrP)rs r#_patch_stopallrs5&011 r"testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c# K|] }d|zV dS)zi%sNr!r)ns r#rrs&77519777777r"c# K|] }d|zV dS)zr%sNr!rs r#rrs&55q555555r">rx__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c fd}||_|S)z:Turns a callable object (like a mock) into a real functionc|g|Ri|Sr<r!)rWrXrr9s r#methodz_get_method..methods#tD&4&&&2&&&r")r)r*r9rs ` r#rrs('''''FO Mr"ch|]}d|zS)rr!)r)rs r#r+r+s*    Hv   r"> __aexit__ __anext__ __aenter__ __aiter__>__del__rrHr __prepare__r__instancecheck____subclasscheck__c6t|Sr<)rw__hash__rs r#rLrLsV__T22r"c6t|Sr<)rw__str__rs r#rLrLsFNN400r"c6t|Sr<)rw __sizeof__rs r#rLrLsv0066r"cxt|jd|dt|S)N/)r>rrirArs r#rLrLs;$t**"5^^8O8O8Q8Q^^TVW[T\T\^^r")rrr __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r= __complex__ __float____bool__ __index__rcfd}|S)NcLjj}|tur|S|urdStSNT)__eq__rrNotImplemented)otherret_valrWs r#rz_get_eq..__eq__s1+0 ' ! !N 5==4r"r!)rWrs` r#_get_eqrs# Mr"cfd}|S)NcRjjturtS|urdStSNF)__ne__rrr)rrWs r#rz_get_ne..__ne__s, ; ) 8 8N 5==5r"r!)rWrs` r#_get_ners# Mr"cfd}|S)Ncjjj}|turtgSt|Sr<)__iter__rrrrrWs r#rz_get_iter..__iter__s1-2 g  88OG}}r"r!)rWrs` r# _get_iterr s# Or"cfd}|S)Ncjj}|turtt gStt |Sr<)rrr_AsyncIteratorrrs r#rz"_get_async_iter..__aiter__s@.3 g  !$r((++ +d7mm,,,r"r!)rWrs` r#_get_async_iterrs$----- r")rrrrc&t|t}|tur ||_dSt|}|||}||_dSt |}||||_dSdSr<)_return_valuesrsrr_calculate_return_value_side_effect_methodsr)rDrr*fixedreturn_calculatorr side_effectors r#_set_return_valuer(s   tW - -E G#/33D99$((.. *(,,T22M *]400! r"ceZdZdZdZdS) MagicMixinc|tt|j|i||dSr<)_mock_set_magicsrrrHrWrXrs r#rHzMagicMixin.__init__;sN . J%%.;;;; r"c ttz}|}t|ddX||j}t }||z }|D](}|t |jvrt||)|t t |jz }t |}|D]!}t||t||"dS)Nr)) _magicsrr1 intersectionr)ryr>rrrrg MagicProxy)rW orig_magics these_magics remove_magicsrKrs r#rzMagicMixin._mock_set_magicsAs 44 " 4$ / / ;&33D4FGGLEEM',6M& ) )DJJ///D%((($c$t***=&>&>> T ! ; ;E E5*UD"9"9 : : : : ; ;r"N)rrrrHrr!r"r#rr:s2   ;;;;;r"rceZdZdZddZdS)r z-A version of `MagicMock` that isn't callable.FcZ||||dSr!rrr"s r#r#z"NonCallableMagicMock.mock_add_spec[2 D(+++ r"Nrrrrr r#r!r"r#r r Ys.77      r"r ceZdZdZdS)AsyncMagicMixinc|tt|j|i||dSr<)rrrrHrs r#rHzAsyncMagicMixin.__init__fsN 3 OT**3T@R@@@ r"NrrrrHr!r"r#rres#     r"rceZdZdZddZdS)ra MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself. If you use the `spec` or `spec_set` arguments then *only* magic methods that exist in the spec will be created. Attributes and the return value of a `MagicMock` will also be `MagicMocks`. FcZ||||dSr!rr"s r#r#zMagicMock.mock_add_specvrr"Nrrr!r"r#rrks2        r"rc"eZdZdZdZddZdS)rc"||_||_dSr<r*r)rWr*rs r#rHzMagicProxy.__init__s  r"c|j}|j}||||}t|||t ||||S)N)r*rr)r*rr1rgr)rWrKrms r# create_mockzMagicProxy.create_mocksZ   " "/5 # 7 7q!!!&!U+++r"Nc*|Sr<)r)rWr5rs r#rzMagicProxy.__get__s!!!r"r<)rrrrHrrr!r"r#rrsF""""""r"rceZdZedZedZedZfdZdZdZ dZ dZ d Z d Z dd Zd ZfdZxZS)rrrrctj|i|tjj|jd<d|jd<d|jd<t |jd<tt}tj tj ztj z|_ d|_d|_d|_d|_||jd<d |jd <t%|jd <i|jd <d|jd <dS)Nrr_mock_await_count_mock_await_args_mock_await_args_listr)rXrYr8r rrerfrH)superrHrrrrrrr rr2 CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountrn)rWrXrY code_mockr6s r#rHzAsyncMockMixin.__init__s$)&)))*1);)I o&-. )*,0 ()1: -.#X666    !$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(((r"c`Kt||fd}|xjdz c_||_|j||j}|t |r|t|s8 t|}n#t$rtwxYwt |r|n&t|r||i|d{V}n||i|}|tur|S|j tur|jS|j4t|jr|j|i|d{VS|j|i|S|jS)NTrr)rrrrr,rrArkr StopIterationStopAsyncIterationrrrrr)rWrXrYrrr}s r#rz!AsyncMockMixin._execute_mock_callstVn$/// A ##E***!  V$$ 1 v&& 1-!&\\FF$----,-!((! L!$V,, 1%vt6v66666666000W$$  "' 1 1$ $   '"4#344 ?-T-t>v>>>>>>>>>#4#T4V44 4  s 1BBcT|jdkrd|jpdd}t|dS)zA Assert that the mock was awaited at least once. r Expected rDz to have been awaited.Nrrrrs r#rzAsyncMockMixin.assert_awaiteds?  q Odo7OOOC %% % ! r"cd|jdks$d|jpdd|jd}t|dS)z@ Assert that the mock was awaited exactly once. rrrD$ to have been awaited once. Awaited rNrrs r#rz"AsyncMockMixin.assert_awaited_oncesW1$$9t8&99#/999C %% %%$r"chj)}td|dfd}t fd}j}||kr1t |t r|nd}t||dS)zN Assert that the last await was with the specified arguments. NzExpected await: z Not awaitedc8d}|S)Nawait)rrrs r#rz:AsyncMockMixin.assert_awaited_with.._error_messages"33D&3QQCJr"Tr)rrrrrr/r)rWrXrYrrrrs``` r#rz"AsyncMockMixin.assert_awaited_withs ? "77fEEH !KH!K!K!KLL L       %%eT6N&E&E&EFF##DO44 X   *8Y ? ?IHHTE !1!122 =  r"cz|jdks$d|jpdd|jd}t||j|i|S)zi Assert that the mock was awaited exactly once and with the specified arguments. rrrDr r)rrrrrs r#rz'AsyncMockMixin.assert_awaited_once_withsg 1$$9t8&99#/999C %% %'t'8888r"c$t||fd}t|tr|nd}fdjD}|s|t |vr)||}td|z|dS)zU Assert the mock has ever been awaited with the specified arguments. TrNc:g|]}|Sr!rrs r#rrz3AsyncMockMixin.assert_any_await.. s'FFFA$$$Q''FFFr"z%s await not found)rrr/rrrrrrs` r#rzAsyncMockMixin.assert_any_await s%%eT6N&E&E&EFF&x;;EFFFF1EFFF  HL$8$888">>tVLLO $6 98r"Fc*fd|D}td|Dd}tfdjD}|sT||vrN|d}ndd|D}t |dt|d j|dSt |}g}|D]=} ||#t$r||Y:wxYw|r t t|d |dS) a Assert the mock has been awaited with the specified calls. The :attr:`await_args_list` list is checked for the awaits. If `any_order` is False (the default) then the awaits must be sequential. There can be extra calls before or after the specified awaits. If `any_order` is True then the awaits can be in any order, but they must all appear in :attr:`await_args_list`. c:g|]}|Sr!rrs r#rrz4AsyncMockMixin.assert_has_awaits..# rr"c3DK|]}t|t|VdSr<rrts r#rz3AsyncMockMixin.assert_has_awaits..$ rr"Nc3BK|]}|VdSr<rrs r#rz3AsyncMockMixin.assert_has_awaits..% s1SSt11!44SSSSSSr"zAwaits not found.z,Error processing expected awaits. Errors: {}c@g|]}t|tr|ndSr<rrts r#rrz4AsyncMockMixin.assert_has_awaits..- rr"rz Actual: z not all found in await list) rrrrrrmrrNr,rn) rWrrrr all_awaitsrrrs ` r#rz AsyncMockMixin.assert_has_awaits s:9995999FFFFFMMSSSSd>RSSSSS  z))=1GG ,-3V$7$7-5$7$7$7.8.8%66!*5!1!166#366  F*%%   ' 'D '!!$'''' ' ' '  &&&&& '   49)4D4D4D4DF   s6C  C.-C.cd|jdkr$d|jpdd|jd}t|dS)z9 Assert that the mock was never awaited. rrrDz# to not have been awaited. Awaited rNrrs r#rz!AsyncMockMixin.assert_not_awaitedC sW  q 9t8&99#/999C %% % ! r"c|tj|i|d|_d|_t |_dS)z0 See :func:`.Mock.reset_mock()` rN)rrrrrr)rWrXrYr6s r#rzAsyncMockMixin.reset_mockL sB D+F+++({{r"r)rrrrrrrrHrrrrrrrrr __classcell__)r6s@r#rrs&&}55K%%l33J**+<==O000008&!&!&!P&&&&&&>>>$ 9 9 9   ****X&&&+++++++++r"rceZdZdZdS)r aY Enhance :class:`Mock` with features allowing to mock an async function. The :class:`AsyncMock` object will behave so the object is recognized as an async function, and the result of a call is an awaitable: >>> mock = AsyncMock() >>> iscoroutinefunction(mock) True >>> inspect.isawaitable(mock()) True The result of ``mock()`` is an async function which will have the outcome of ``side_effect`` or ``return_value``: - if ``side_effect`` is a function, the async function will return the result of that function, - if ``side_effect`` is an exception, the async function will raise the exception, - if ``side_effect`` is an iterable, the async function will return the next value of the iterable, however, if the sequence of result is exhausted, ``StopIteration`` is raised immediately, - if ``side_effect`` is not defined, the async function will return the value defined by ``return_value``, hence, by default, the async function returns a new :class:`AsyncMock` object. If the outcome of ``side_effect`` or ``return_value`` is an async function, the mock async function obtained when the mock object is called will be this async function itself (and not an async function returning an async function). The test author can also specify a wrapped object with ``wraps``. In this case, the :class:`Mock` object behavior is the same as with an :class:`.Mock` object: the wrapped object may have methods defined as async function functions. Based on Martin Richard's asynctest project. Nrr!r"r#r r V s''''r"r c$eZdZdZdZdZdZdS)_ANYz2A helper object that compares equal to everything.cdSrr!rWrs r#rz _ANY.__eq__ str"cdSrr!rs r#rz _ANY.__ne__ sur"cdS)Nzr!rs r#rz _ANY.__repr__ swr"N)rrrr rrrr!r"r#rr sG88r"rcd|z}d}dd|D}dd|D}|r|}|r |r|dz }||z }||zS)Nz%s(%%s)r z, c,g|]}t|Sr!)repr)r)rRs r#rrz*_format_call_signature.. s7773T#YY777r"c"g|] \}}|d| S)=r!)r)rMrs r#rrz*_format_call_signature.. s4#-3333r")rdrO)r*rXrYrformatted_args args_string kwargs_strings r#rr s$GN))77$77788KII17M%$(  # d "N-' ^ ##r"ceZdZdZ ddZ ddZd ZejZd Z d Z d Z d Z e dZe dZdZdZdS)ra A tuple for holding the results of a call to a mock, either in the form `(args, kwargs)` or `(name, args, kwargs)`. If args or kwargs are empty then a call tuple will compare equal to a tuple without those values. This makes comparisons less verbose:: _Call(('name', (), {})) == ('name',) _Call(('name', (1,), {})) == ('name', (1,)) _Call(((), {'a': 'b'})) == ({'a': 'b'},) The `_Call` object provides a useful shortcut for comparing with call:: _Call(((1, 2), {'a': 3})) == call(1, 2, a=3) _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3) If the _Call has no name then it will match any name. r!r NFTcd}i}t|}|dkr|\}}}n~|dkr<|\} } t| tr| }t| tr| }nD| }nA| | }}n<|dkr6|\}t|tr|}nt|tr|}n|}|rt|||fSt||||fS)Nr!rr)rr/rZrnr) rrr*rr from_kallrXrY_lenfirstseconds r#rz _Call.__new__ s5zz 199!& D$ QYY!ME6%%% -fe,,$!DD#FF$ff QYYFE%%% E5))   6==tVn55 5}}S4v"6777r"c0||_||_||_dSr<)rr_mock_from_kall)rWrr*rrr+s r#rHz_Call.__init__ s"(r"cr t|}n#t$r tcYSwxYwd}t|dkr|\}}n|\}}}t|ddr#t|ddr|j|jkrdSd}|dkrdi}}n|dkr|\}}}n|dkr?|\} t | t r| }i}nit | tr| }di}}nMd}| }nH|dkr@|\} } t | tr!| }t | t r| i}}n d| }}n| | }}ndS|r||krdS||f||fkS) Nr rrFrr!r*r)rrrr1rr/rnrZ) rWr len_other self_name self_args self_kwargs other_name other_args other_kwargsrr-r.s r#rz _Call.__eq__ s "E II " " "! ! ! ! " t99>>%) "I{{04 -Iy+ D.$ / / GE>SW4X4X %);;;5 >>')2 JJ !^^38 0J LL !^^FE%'' %" ! E3'' %" +-rL  $ !^^!ME6%%% 9" fe,,:/5r JJ/16 JJ+0&L 5  y005L)i-EEEs &&c|jtd||fdS|jdz}t|j||f||S)Nr r/rrrrrs r#rKz_Call.__call__ sN ? ""dF+$777 7%dotV44MMMMr"cn|jt|dS|jd|}t||dS)NF)r*r+rI)r*rr+r:)rWrr*s r#rz_Call.__getattr__ sD ? "de444 4///440$tu====r"cb|tjvrtt||Sr<)rnrrrL__getattribute__)rWrs r#r=z_Call.__getattribute__$ s+ 5> ! ! %%dD111r"cHt|dkr|\}}n|\}}}||fS)Nr)rrs r#_get_call_argumentsz_Call._get_call_arguments* s2 t99>>LD&&!% D$V|r"c6|dSNrr?rs r#rXz _Call.args2 ''))!,,r"c6|dS)NrrBrs r#rYz _Call.kwargs6 rCr"c|js%|jpd}|drd|z}|St|dkrd}|\}}n+|\}}}|sd}n |dsd|z}nd|z}t |||S)Nrr/zcall%srzcall.%s)r0rr(rr)rWr*rXrYs r#rz_Call.__repr__: s# ?,fDt$$ '$K t99>>DLD&&!% D$ '__T** ' 4'$%dD&999r"cg}|}|%|jr|||j}|%tt |S)zFor a call object that represents multiple calls, `call_list` returns a list of all the intermediate calls as well as the final call.)r0r,rrrc)rWvalsthings r# call_listz_Call.call_listO sW$ # E"""&E$(((r")r!r NFT)r!NNFT)rrrr rrHrrwrrKrr=r?rrXrYrrIr!r"r#rr s$:?8888@>C))))2F2F2Fj]FNNN>>>222 --X---X-:::* ) ) ) ) )r"r)r+c $t|rt|}t|t}t|rt d|dt |}d|i} |rd|i} n|i} | r|rd| d<|st || |t} tj |ri} nL|r|rtdt} n1t|st} n|r|rt|st} | d |}|} |d } | d||| |d | } t|t"r"t%| |} |rt'| nt)|| ||| |s | |j|<|d } |r |sd |vrt/||dd| | | _t3|D];}t5|r t7||}n#t8$rY1wxYwd|i}| r&t;| |r|||rd|i}t|t"st=||| ||}|| j|<n{| }t|t"r| j}tA|||}||d<tC|rt}nt}|d||||d|}|| j|<t)|||t|t"rtE| ||=| S)aCreate a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the `spec` object as their spec. Functions or methods being mocked will have their arguments checked to check that they are called with the correct signature. If `spec_set` is True then attempting to set attributes that don't exist on the spec object will raise an `AttributeError`. If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by passing `instance=True`. The returned mock will only be callable if instances of the mock are callable. `create_autospec` will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock.z'Cannot autospec a Mock object. [object=r%rrNTrzJInstance can not be True when create_autospec is mocking an async functionr*r )rrrr*rrr/)rar8rrrpr)rr*rr)r`r!)#ror>r/r.rr:rr rr2isdatadescriptorrr rkr rurQrErrrbrrsr rr+rr1rLr0rCrD _must_skiprrg)rrrarr8rrYis_type is_async_funcrBrArrDwrappedrKr|r rr` child_klasss r#r r _ s.~~Dzzt$$G5 4*. 4 4 455 5"4((MtnGt$ ,8,'+#$ &f%%% NN6 E%% % %  ? >?? ? t__%$ %X%&8&>&>%$ KK & &EI 5 (W  ( (& ( (D$ &&8dD))  $ d # # #tWh7778(,u%jj!!G;x;N&$@$@+D(T2629;;;T3&3& U     tU++HH    H (#  *ww.. * MMM ) ) )  , (+F(M22 AXxuhGGC),D  & &F$ .. #"488I"+F; "8,, (' ' +(V%5*0(( &((C*-D  & Xsi @ @ @ @ c= ) ) & D% % % % Ks'G88 HHcDt|ts|t|divrdS|j}|jD]f}|j|t}|tur,t|ttfrdSt|tr|cSdS|S)z[ Return whether we should skip the first argument on spec's `entry` attribute. rrF) r/r>r1r6rqrrrsrrJrIrE)rrKrMrr}s r#rLrL s dD ! ! GD*b11 1 15~  ##E733 W    f|[9 : : 55  . . NNN55 Nr"ceZdZ ddZdS)rCFNcZ||_||_||_||_||_||_dSr<)ridsrrrar*)rWrrrr*rTras r#rHz_SpecState.__init__ s0       r")FNNNFrr!r"r#rCrC s.48/4r"rCc|t|trtj|Stj|Sr<)r/bytesioBytesIOStringIO) read_datas r# _to_streamr[% s4)U##&z)$$${9%%%r"r c V t}|dg fd} fd} fd fd fd}tdddl}tt t |jt t |jat2ddl}tt t |j a |tdt }tt  j _ d j_ d j_ d j_ d j_ | j_ d < d  j_| j_ j_| j_ fd }||_ |_ |S) a A helper function to create a mock to replace the use of `open`. It works for `open` called directly or used as a context manager. The `mock` argument is the mock object to configure. If `None` (the default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. `read_data` is a string for the `read`, `readline` and `readlines` of the file handle to return. This is an empty string by default. NcZjj jjSdj|i|SrA) readlinesrrXrY_statehandles r#_readlines_side_effectz)mock_open.._readlines_side_effect; s7   ( 4#0 0"vay"D3F333r"cZjj jjSdj|i|SrA)readrr_s r#_read_side_effectz$mock_open.._read_side_effect@ s4 ; # /;+ +vay~t.v...r"c?VKEd{V dj|i|VNTr)readline)rXrY_iter_side_effectr`s r#_readline_side_effectz(mock_open.._readline_side_effectE sT$$&&&&&&&&& 6$&)$d5f55 5 5 5 6r"c3bKjj jjVdD]}|VdSrg)rhr)liner`ras r#riz$mock_open.._iter_side_effectJ sU ? ' 3 3o2222 31I  DJJJJ  r"c^jj jjStdSrA)rhrr)r`rasr#_next_side_effectz$mock_open.._next_side_effectQ s) ? ' 3?/ /F1Ir"ropen)r*r)rrctd<jjdkrd<dj_tS)Nrr)r[rhrr)rXrYrjr`rarZs r# reset_datazmock_open..reset_dataq sMy))q ? &&) 3 3--//F1I*0)FO 'r")r[ file_spec_iormryr+ TextIOWrapperunionrX open_specrorrFrwriterdrhr^rrr) rDrZ _read_datarbrernrsrqrirjr`ras ` @@@@r#rr, sI&&J$ F444444 ////// 666666   S!23344::3s3;?O?O;P;PQQRR  S]]++,,  |f9555 I & & &F$*F! $FL#FK#'FO $(F!/FK%%''F1I"()FO#9F "3FO"3FO"DD Kr"c&eZdZdZdZddZdZdS)raW A mock intended to be used as a property, or other descriptor, on a class. `PropertyMock` provides `__get__` and `__set__` methods so you can specify a return value when it is fetched. Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. c tdi|S)Nr!)r)rWrYs r#r1zPropertyMock._get_child_mock s""6"""r"Nc|Sr<r!)rWr5obj_types r#rzPropertyMock.__get__ s tvv r"c||dSr<r!)rWr5rSs r#rzPropertyMock.__set__ s S r"r<)rrrr r1rrr!r"r#rr~ sP###r"rc4d|_t|D]} t||}n#t$rY wxYwt |t s:t |j|trh|j |urt|dS)aDisable the automatic generation of child mocks. Given an input Mock, seals it to ensure no further mocks will be generated when accessing an attribute that was not already defined. The operation recursively seals the mock passed in, meaning that the mock itself, any mocks generated by accessing one of its attributes, and all assigned mocks without a name or spec will be sealed. TN) r r+r1rLr/r rrsrCrr)rDrrs r#rr sDD   d##AA    H !_--   a&**400* = =    % % GGG  s + 88ceZdZdZdZdZdS)rz8 Wraps an iterator in an asynchronous iterator. ct||_tt}tj|_||jd<dS)Nrr8)iteratorr rr2CO_ITERABLE_COROUTINErrr)rWrrs r#rHz_AsyncIterator.__init__ s6  #X666 $: $- j!!!r"c^K t|jS#t$rYnwxYwtr<)rrrrrs r#rz_AsyncIterator.__anext__ sA  && &    D   s  %%N)rrrr rHrr!r"r#rr s<... !!!!!r"rr)NFNNN)FFNN)Nr )__all__rrrWr2rr>builtinsrTrtypesrrr unittest.utilr functoolsrr threadingrrrr+r3r rrr6r:r.rArFrRrbr]rkrorurr{rrrwrrrrMISSINGrDELETEDrDrrrmrrrrr rMrHrrr=rrrrrVr[r_rrbrzrremultiplestopallr magic_methodsnumericsrdrPinplaceright _non_defaultsrrr_sync_async_magics _async_magicsrr_rrrrrrrrrrrr rrrrr rrrrnrrr rLrCr>rrErrrvr[rrrrr!r"r#rs5  &  ''''''2222222222######$$$$$$$$CCCCCyCCC I Hcc(mm H H H   @@@222    F # # # #   &&&   6."."."b>>>6))) ) ) ) ) )f ) ) )         9;;         &********(6      6   N <N <N <N <N       :         j        D   ,""""""""$@+@+@+@+@+T@+@+@+F((((((((V     6    dff$$$$v)v)v)v)v)Ev)v)v)r uuCGO*/OOOOOd8         DD     &&&OOOOd4$0!!!!!!!!!!r"PK!D5D5&__pycache__/main.cpython-311.opt-2.pycnu[ 0i, ddlZddlZddlZddlZddlmZmZddlmZdZ dZ dZ dZ d Z d ZGd d eZeZdS) N)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase cVtj|r|drtj|rstj|tj}tj|s|tj r|S|}tj |dd dd ddS|S)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths 4/opt/alt/python311/lib64/python3.11/unittest/main.py _convert_namers  w~~dP 5 5e < <P 7==   wtRY[[99Hw}}X&& (*=*=bi*H*H  Dw%%crc*224==EEc3OOO Kcd|DS)Nc,g|]}t|S)r).0rs r z"_convert_names../s 2 2 2DM$   2 2 2rr)namess r_convert_namesr#.s 2 2E 2 2 22rcd|vrd|z}|S)N*z*%s*r)patterns r_convert_select_patternr'2s '>>7" Nrc eZdZ dZdZdxZxZxZxZxZ Z dZ dddde j ddddddf dddZddZd Zd Zdd Zd Zd ZdZdZddZdZdS) TestProgramNr__main__TF) tb_localsc Vt|trOt||_|dddD]} t |j| |_n||_| t j}||_||_ | |_ ||_ | |_ | |_ | t jsd|_n| |_||_||_||_t&j|d|_|||dS)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr+ warnoptionswarnings defaultTest testRunner testLoaderr r basenameprogName parseArgsrunTests)selfr1r=r5r>r?r6r9r7r8r:r<r+parts r__init__zTestProgram.__init__Bs fc " " !$V,,DK S))!""- 9 9%dk488  9!DK <8D   $" "  CO &DMM%DM&$$((a11  t rctjdt|rt||j||tjddS)NzHTestProgram.usageExit() is deprecated and will be removed in Python 3.13) r<warnDeprecationWarningprint_discovery_parser_initArgParsers _print_helpr4r6)rDmsgs r usageExitzTestProgram.usageExithsr 01C E E E   #JJJ  ! )  " " "   rcZ|j_t|jttd|jiz|jdSt|jttd|jizdS)Nprog) r1rK _main_parser format_help MAIN_EXAMPLESrArL print_helpMODULE_EXAMPLES)rDargskwargss rrNzTestProgram._print_helprs ;  $#//11 2 2 2 -64="99 : : :  " - - / / / / / $#//11 2 2 2 /VT]$;; < < < < !>""48,,,   ( (abb4 8 8 8: ""2&&&     ( (abb4 8 8 8 : 4+DJ77DN:%%"   %!DNN (# . . 4".0DNN!$"233DN rc^|jr|j|j_|r;||jn |}|j|j|j|j|_dS|j&|j|j |_dS|j |j|j |_dSN) testNamePatternsr?r[startr&toptestr`loadTestsFromModuler1loadTestsFromNames)rDfrom_discoveryLoaderrs rrczTestProgram.createTestss   E/3/DDO ,  H(.T__FFHHF' DL$(KKDIII ^ #;;DKHHDIII::4>;?;HHDIIIrc|}|||_|||_dSre)_getParentArgParser_getMainArgParserrS_getDiscoveryArgParserrL)rD parent_parsers rrMzTestProgram._initArgParserssE0022  22=AA!%!rTextTestRunnerr.r|r9r7r:r<r+ TypeErrorrunriresultr6r4 wasSuccessful)rDr>s rrCzTestProgram.runTestssY ?      ? "$3DO dot , , ) / I!%4>:>-8< :>-;?> "1"K"KJJ !III!%4>:>-8< :>-"1"I"IJJJI  / / /!__..  / J nnTY// 9 6 H22444 5 5 5 5 5 6 6s0 3A>=B<>7B85B<7B88B<<CCre)FN)ra __module__ __qualname__r1r9r7r8r:rAr<rfrLrdefaultTestLoaderrFrPrNrBrcrMrorprqr]rCrrrr)r)8s9 FINRRHRzRFRXR;K(d#0HTd$$>C$$$$$L===: H H H HLLL !!!F   * = = = =66666rr))r4r}r r<rrsignalsr __unittestrUrWrr#r'objectr)mainrrrrs  ######    333 \6\6\6\6\6&\6\6\6|rPK!>>(__pycache__/runner.cpython-311.opt-2.pycnu[ 0i$ ddlZddlZddlZddlmZddlmZddlmZdZ Gdde Z Gd d ej Z Gd d e ZdS) N)result)_SubTest)registerResultTc$eZdZ dZdZddZdS)_WritelnDecoratorc||_dSN)stream)selfr s 6/opt/alt/python311/lib64/python3.11/unittest/runner.py__init__z_WritelnDecorator.__init__s  cR|dvrt|t|j|S)N)r __getstate__)AttributeErrorgetattrr )r attrs r __getattr__z_WritelnDecorator.__getattr__s. - - - && &t{4(((rNc^|r|||ddSN )write)r args r writelnz_WritelnDecorator.writelns1   JJsOOO 4rr )__name__ __module__ __qualname__rrrrr rrsIJ))) rrceZdZ dZdZfdZdZfdZdZfdZ fdZ fd Z fd Z fd Z fd Zfd ZdZdZxZS)TextTestResultzF======================================================================zF----------------------------------------------------------------------ctt||||||_|dk|_|dk|_||_d|_dS)NrT)superr!rr showAlldots descriptions_newline)r r r& verbosity __class__s r rzTextTestResult.__init__&sU nd##,,V\9MMM  1} N ( rc|}|jr&|r$dt||fSt|Sr)shortDescriptionr&joinstr)r testdoc_first_lines r getDescriptionzTextTestResult.getDescription.sN..00    99c$ii899 9t99 rc8tt|||jri|j|||jd|jd|_dSdS)N ... F) r#r! startTestr$r rr0flushr'r r.r)s r r3zTextTestResult.startTest5s nd##--d333 < " K  d11$77 8 8 8 K  g & & & K     !DMMM  " "rct|t}|s|jr|js|j|r|jd|j|||jd|j||jd|_dS)Nz r2T) isinstancerr'r rrr0r4)r r.status is_subtests r _write_statuszTextTestResult._write_status=sh//  ' '= & ##%%% ( !!$''' K  d11$77 8 8 8 K  g & & & F###  rc||jrIt|d|jr||dn||dnp|jrit|d|jr|jdn|jd|jtt| |||dS)NrFAILERRORFE) r$ issubclassfailureExceptionr:r%r rr4r#r! addSubTest)r r.subtesterrr)s r rBzTextTestResult.addSubTestJs ?| $c!fg&>??9&&w7777&&w8888 $c!fg&>??+K%%c****K%%c*** !!### nd##..tWcBBBBBrctt|||jr||ddS|jr5|jd|jdSdS)Nok.) r#r! addSuccessr$r:r%r rr4r5s r rHzTextTestResult.addSuccessYs nd##..t444 <   tT * * * * * Y K  c " " " K         rctt||||jr||ddS|jr5|jd|jdSdS)Nr=r?) r#r!addErrorr$r:r%r rr4r r.rDr)s r rJzTextTestResult.addErroras nd##,,T3777 <   tW - - - - - Y K  c " " " K         rctt||||jr||ddS|jr5|jd|jdSdS)Nr<r>) r#r! addFailurer$r:r%r rr4rKs r rMzTextTestResult.addFailureis nd##..tS999 <   tV , , , , , Y K  c " " " K         rc6tt||||jr+||d|dS|jr5|jd|j dSdS)Nz skipped {0!r}s) r#r!addSkipr$r:formatr%r rr4)r r.reasonr)s r rPzTextTestResult.addSkipqs nd##++D&999 <   t_%;%;F%C%C D D D D D Y K  c " " " K         rcJtt||||jr5|jd|jdS|jr5|jd|jdSdS)Nzexpected failurex) r#r!addExpectedFailurer$r rr4r%rrKs r rUz!TextTestResult.addExpectedFailureys nd##66tSAAA < K   2 3 3 3 K        Y K  c " " " K         rcHtt|||jr5|jd|jdS|jr5|jd|jdSdS)Nzunexpected successu) r#r!addUnexpectedSuccessr$r rr4r%rr5s r rXz#TextTestResult.addUnexpectedSuccesss nd##88>>> < K   4 5 5 5 K        Y K  c " " " K         rc|js|jr2|j|j|d|j|d|jt|dd}|ro|j|j |D]2}|jd| |3|jdSdS)Nr=r<unexpectedSuccessesrzUNEXPECTED SUCCESS: ) r%r$r rr4printErrorListerrorsfailuresr separator1r0)r rZr.s r printErrorszTextTestResult.printErrorss 9   K   ! ! ! K      GT[111 FDM222%d,A2FF  K   0 0 0+ X X ##$V4;N;Nt;T;T$V$VWWWW K          rcb|D]\}}|j|j|j|d|||j|j|jd|z|jdS)Nz: z%s)r rr^r0 separator2r4)r flavourr\r.rDs r r[zTextTestResult.printErrorLists  ID# K   0 0 0 K  GGGD4G4G4M4M4M N O O O K   0 0 0 K  s + + + K         r)rrrr^rarr0r3r:rBrHrJrMrPrUrXr_r[ __classcell__)r)s@r r!r!sRJJ"""""    C C C C C                                         rr!c2eZdZ eZ d dddZdZdZdS) TextTestRunnerNTrF) tb_localsc | tj}t||_||_||_||_||_||_||_ | ||_ dSdSr ) sysstderrrr r&r(failfastbufferrfwarnings resultclass) r r r&r(rjrkrmrlrfs r rzTextTestRunner.__init__sk >ZF'// ("   "   "*D    # "rcN||j|j|jSr )rmr r&r()r s r _makeResultzTextTestRunner._makeResults! T->OOOrc |}t||j|_|j|_|j|_t j5|jr>t j|j|jdvrt jdtdtj }t|dd}| | ||t|dd}| |n##t|dd}| |wwxYwtj }dddn #1swxYwY||z }|j t|dr|j|j|j}|jd||d krd pd |fz|jd x} x} } t't(|j|j|jf} | \} } } n#t0$rYnwxYwg} |jsw|jd t)|jt)|j}}|r| d|z|r| d|zn|jd| r| d| z| r| d| z| r| d| z| r2|jdd| dn|jd|j|S)N)defaultalwaysmodulezPlease use assert\w+ instead.)categorymessage startTestRun stopTestRunrazRan %d test%s in %.3fsrrOrFAILEDz failures=%dz errors=%dOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rorrjrkrfrlcatch_warnings simplefilterfilterwarningsDeprecationWarningtime perf_counterrr_hasattrr rratestsRunmaplenexpectedFailuresrZskippedr wasSuccessfulrr]r\appendr,r4)r r.r startTimervrwstopTime timeTakenrun expectedFailsrZrresultsinfosfailederroreds r rzTextTestRunner.runs0!!##v-  >  $ & & + +} F%dm444 =$999+H%7$DFFFF)++I"6>4@@L'  "V %fmTBB *KMMM&fmTBB *KMMMM+(**H/ + + + + + + + + + + + + + + +0y(  6< ( ( 3 K   1 2 2 2o 4 #("2s"8b)DE F F F 899 9+g B# 7 & : & 011G ;B 7M.    D  #v#%% $ K  h ' ' '!&/22C 4F4FGF 5 ]V3444 4 [72333 K  d # # #  1 LL/ 0 0 0  A LL/-? @ @ @  J LL25HH I I I  $ K   499U+;+;+;+; = > > > > K  d # # #  s=A6D> C<D>< DD>>EE'H HH)NTrFFNN)rrrr!rmrrorrrr reresm !KABJN+#+++++(PPPGGGGGrre)rhrrlrxrcasersignalsr __unittestobjectr TestResultr!rerrr rs ######           @ @ @ @ @ V&@ @ @ FfffffVfffffrPK!,__pycache__/async_case.cpython-311.opt-1.pycnu[ 0iYNddlZddlZddlZddlZddlmZGddeZdS)N)TestCaseceZdZdfd ZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdfd ZfdZdZxZS)IsolatedAsyncioTestCaserunTestct|d|_tj|_dSN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s :/opt/alt/python311/lib64/python3.11/unittest/async_case.pyr z IsolatedAsyncioTestCase.__init__#s: $$$"#.#;#=#=   c KdSr rs r asyncSetUpz"IsolatedAsyncioTestCase.asyncSetUp(  rc KdSr rrs r asyncTearDownz%IsolatedAsyncioTestCase.asyncTearDown+rrc(|j|g|Ri|dSr ) addCleanuprfuncargskwargss raddAsyncCleanupz'IsolatedAsyncioTestCase.addAsyncCleanup.s) $1&11111rcKt|} |j}|j}n/#t$r"t d|jd|jddwxYw||d{V}|||ddd|S)zEnters the supplied asynchronous context manager. If successful, also adds its __aexit__ method as a cleanup function and returns the result of the __aenter__ method. '.zC' object does not support the asynchronous context manager protocolN)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r")rcmclsenterexitresults renterAsyncContextz)IsolatedAsyncioTestCase.enterAsyncContext=s2hh 'NE=DD ' ' 'UUU1AUUU"& ' 'uRyy T2tT4888 s ",Ac|j|j|j||jdSr )r get_looprrunsetUp _callAsyncrrs r _callSetUpz"IsolatedAsyncioTestCase._callSetUpQsL $$&&&  $$TZ000 (((((rct||"tjd|dtddSdS)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethodz'IsolatedAsyncioTestCase._callTestMethodYsd    ' ' 3 M2(.2223ERS U U U U U U 4 3rcx||j|j|jdSr )r7rrr5tearDownrs r _callTearDownz%IsolatedAsyncioTestCase._callTearDown^s6 *+++  $$T]33333rc(|j|g|Ri|dSr )r=)rfunctionr r!s r _callCleanupz$IsolatedAsyncioTestCase._callCleanupbs+X777777777rcP|j||i||jSN)context)r r5rrs rr7z"IsolatedAsyncioTestCase._callAsynces<"&& D$ !& ! !,'   rctj|r'|j||i||jS|jj|g|Ri|SrJ)inspectiscoroutinefunctionr r5rrs rr=z'IsolatedAsyncioTestCase._callMaybeAsyncmsv  &t , , G&**d%f%%0+  04+/FtFFFvFF Frc>tjd}||_dS)NT)debug)asyncioRunnerr rrunners r_setupAsyncioRunnerz+IsolatedAsyncioTestCase._setupAsyncioRunnerws"d+++$rc<|j}|dSr )r closerSs r_tearDownAsyncioRunnerz.IsolatedAsyncioTestCase._tearDownAsyncioRunner|s$ rNc| t||S#|wxYwr )rUr r5rX)rr1rs rr5zIsolatedAsyncioTestCase.runsZ   """ *77;;v&&  ' ' ) ) ) )D ' ' ) ) ) )s A A"c|t|dSr )rUr rPrX)rrs rrPzIsolatedAsyncioTestCase.debugs>   """   ##%%%%%rc@|j|dSdSr )r rXrs r__del__zIsolatedAsyncioTestCase.__del__s+   *  ' ' ) ) ) ) ) + *r)rr )__name__r+r,r rrr"r2r8rBrErHr7r=rUrXr5rPr\ __classcell__)rs@rrr s=4>>>>>>        2 2 2()))UUU 444888   GGG%%% ******&&&&& *******rr)rQr rMr>caserrrrrr`s|E*E*E*E*E*hE*E*E*E*E*rPK!qS_ *__pycache__/__init__.cpython-311.opt-2.pycnu[ 0i^ gdZegddZddlmZddlmZmZmZm Z m Z m Z m Z m Z mZmZddlmZmZddlmZmZddlmZmZdd lmZmZdd lmZmZmZmZdd lm Z m!Z!m"Z"eZ#d Z$d Z%dZ&dS)) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContext)getTestCaseNames makeSuite findTestCasesT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrr)rrrcvddl}|jt}|||S)N) start_dirpattern)os.pathpathdirname__file__discover)loadertestsr!osthis_dirs 8/opt/alt/python311/lib64/python3.11/unittest/__init__.py load_testsr,Os4NNNwx((H ??Xw? ? ??cJtdhzS)Nr)globalskeysr-r+__dir__r2Zs 99>>  89 99r-c\|dkr ddlmatStdtd|)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r+ __getattr__r8]sE (((777777&& I8IIII J JJr-N)'__all__extend __unittestresultrcaserrrr r r rrrrsuiterrr'rr r rrunnerrrsignalsrrrrrrr_TextTestResultr,r2r8r1r-r+rBs,\ I I IAAABBB  '''''''''''''''''''''''',+++++++11111111########22222222PPPPPPPPPPPP>>>>>>>>>>! @@@:::KKKKKr-PK!Fpz __pycache__/_log.cpython-311.pycnu[ 0i ddlZddlZddlmZejdddgZGddejZGd d eZdS) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc$eZdZdZdZdZdZdS)_CapturingHandlerzM A logging handler capturing all (raw and formatted) logging output. cntj|tgg|_dSN)loggingHandler__init__rwatcherselfs 4/opt/alt/python311/lib64/python3.11/unittest/_log.pyrz_CapturingHandler.__init__s-  &&&&r2.. cdSr rs rflushz_CapturingHandler.flushs rc|jj|||}|jj|dSr )rrappendformatr)rrecordmsgs remitz_CapturingHandler.emitsK ##F+++kk&!! ""3'''''rN)__name__ __module__ __qualname____doc__rrrrrrr r sK///   (((((rr c(eZdZdZdZdZdZdZdS)_AssertLogsContextz6A context manager for assertLogs() and assertNoLogs() z"%(levelname)s:%(name)s:%(message)sctj||||_|r&tj|||_ntj|_d|_||_ dSr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser$r'r)s rrz_AssertLogsContext.__init__!s\%dI666&  & -11%??DJJ DJ rc,t|jtjr|jx}|_n tj|jx}|_tj|j}t}| |j | ||j |_ |j dd|_|j |_|j|_|g|_ | |j d|_|jrdS|j S)NF) isinstancer$r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr' setFormatterrhandlers old_handlers old_level propagate old_propagater))rr. formatterhandlers r __enter__z_AssertLogsContext.__enter__+s d& 7 7 G#'#3 3FT[[#*#4T5E#F#F FFT[%d&9:: #%%$$$Y''' "OAAA.#-") ###  <  Frc|j|j_|j|j_|j|j|dS|jrSt|j j dkr4| d |j j dSdSt|j j dkrL| d tj|j|jjdSdS)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r5r.r4r8r7r2r6r)lenrr _raiseFailurerrr getLevelNamer'name)rexc_type exc_valuetbs r__exit__z_AssertLogsContext.__exit__?s#0  $ 2  T^,,,  5 < Q4<'((1,,""188 +-,4<'((A--""CVG0<NOOQQQQQ.-rN)rrrr r1rr;rDrrrr"r"sQ@@9N(QQQQQrr") r collectionscaser namedtuplerr r r"rrrrHs&&&&&&)+():*3X)>@@(((((((($:Q:Q:Q:Q:Q-:Q:Q:Q:Q:QrPK!R__(__pycache__/loader.cpython-311.opt-2.pycnu[ 0iXj ddlZddlZddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z dZ ejdejZGdde jZd Zd Zd Zd Zd ZGddeZeZddZe jdfdZde je jfdZde je jfdZ dS)N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c,eZdZdZfdZfdZxZS) _FailedTestNcf||_tt||dSN) _exceptionsuperr __init__)self method_name exception __class__s 6/opt/alt/python311/lib64/python3.11/unittest/loader.pyrz_FailedTest.__init__s.# k4  ))+66666cz|jkr(tt|Sfd}|S)Ncjr )r rsr testFailurez,_FailedTest.__getattr__..testFailure!s / !r)_testMethodNamerr __getattr__)rnamerrs` rrz_FailedTest.__getattr__sO 4' ' 'd++77== = " " " " "r)__name__ __module__ __qualname__rrr __classcell__rs@rr r sVO77777rr crd|dtj}t|t|||S)NzFailed to import test module:  ) traceback format_exc_make_failed_test ImportError)r suiteClassmessages r_make_failed_import_testr*&s< i"$$$&G T;w#7#7W M MMrcRdtj}t||||S)NzFailed to call load_tests: )r$r%r&)rrr(r)s r_make_failed_load_testsr,+s32;2F2H2H2HJG  iW . ..rc>t||}||f|fSr )r ) methodnamerr(r)tests rr&r&0s( z9 - -D :tg   ''rctjt|d}||i}tdtjf|}|||fS)NcdSr rs r testSkippedz'_make_skipped_test..testSkipped5s r ModuleSkipped)rskipstrtypeTestCase)r.rr(r3attrs TestClasss r_make_skipped_testr;4si Ys9~~    %E_t}&6>>I :yy,,. / //rc|dr |ddStj|dS)Nz $py.classir)lowerendswithospathsplitext)r@s r_jython_aware_splitextrB<sI zz||[))CRCy 7  D ! !! $$rceZdZ dZeejZdZe j Z dZ fdZ dZdddZddZddZd Zdd Zd Zd ZdZdZdZdZxZS) TestLoaderr/Nctt|g|_t |_dSr )rrDrerrorsset_loading_packages)rrs rrzTestLoader.__init__Ms: j$((*** "%rc. t|tjrtd|tjtjfvrg}n*||}|st|drdg}| t||}|S)NzYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?runTest) issubclassr TestSuite TypeErrorrr8FunctionTestCasegetTestCaseNameshasattrr(map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCasez TestLoader.loadTestsFromTestCaseTsI mU_ 5 5 )()) ) T]D,AB B BMM 11-@@M  ,W]I%F%F ,!* s=-'H'HII rpatternc t|dksd|vr0tjdt|ddt|dkr4t|dz}t d|t|dkr7t|d}t d|g}t|D]}t||}t|tr\t|tjrB|tjtjfvr(|||t|dd} ||}| _ | |||S#t&$rD} t)|j| |j\} } |j| | cYd} ~ Sd} ~ wwxYw|S)Nruse_load_testsz(use_load_tests is deprecated and ignoredrzCloadTestsFromModule() takes 1 positional argument but {} were givenz=loadTestsFromModule() got an unexpected keyword argument '{}' load_tests)lenwarningswarnDeprecationWarningpoprMformatsorteddirgetattr isinstancer7rKrr8rNappendrUr( Exceptionr,rrF) rmodulerWargskws complainttestsrobjrZe error_case error_messages rloadTestsFromModulezTestLoader.loadTestsFromModulefsL t99q==,33 MD, . . . GG$d + + + t99q==D A Iahhirsstt t s88q== s AI[bbclmmnn nKK > >D&$''C3%% >sDM22 > t/DEEE T77<<===V\488 &&  ! "!z$w777 " " ",COQ-9-9) M ""=111!!!!!!!  "  s F%% G3/9G.(G3.G3c x |d}d\}}||dd}|r d|}t|}n^#t$rO|}t ||j\}}|s|j||cYSYnwxYw||dd}|} |D]} | t| | } } #t$r} t| dd%|#|j||cYd} ~ cSt| | |jdtj \}}|j||cYd} ~ cSd} ~ wwxYwt| tjr|| St| t$rIt'| t(jr/| t(jt(jfvr|| St| tjrt| t$rlt'| t(jrR|d}| |} tt| |tjs|| gSnt| t2jr| St7| rl| }t|t2jr|St|t(jr||gSt9d| d|d t9d | z) N.NNr__path__zFailed to access attribute: zcalling z returned z , not a testz$don't know how to make test from: %s)splitjoin __import__r'r_r*r(rFrercAttributeErrorr&r$r%rdtypes ModuleTyperpr7rKrr8rNrU FunctionTyperrLcallablerM)rrrgpartsrnro parts_copy module_namenext_attributerlpartparentrminstr/s rloadTestsFromNamezTestLoader.loadTestsFromNames  3$.! M >qqqJ * *"%((:"6"6K' 44F"***%/^^%5%5N0H&1919-J %* **=999))))** *  *!""IE & &D &!73#5#5! & & &CT22>". K&&}555%%%%%%%%%1Ba%022251616-J K&&}555%%%%%%%%%% &( c5+ , , ++C00 0 sD ! ! 3 .. DM4+@AAA--c22 2e011 && // 9D6$<z1TestLoader.loadTestsFromNames..s)III4$((v66IIIr)r()rnamesrgsuitess` ` rloadTestsFromNameszTestLoader.loadTestsFromNamess: JIIII5IIIv&&&rc fd}tt|t}jr-|t jj|S)Nc|jsdSt|}t|sdSdjj|fzjduptfdjDS)NFz%s.%s.%sc38K|]}t|VdSr )r)rrWfullNames r zKTestLoader.getTestCaseNames..shouldIncludeMethod..s-XXwK'22XXXXXXr) startswithtestMethodPrefixrcr}rrtestNamePatternsany)attrnametestFuncrrrRs @rshouldIncludeMethodz8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<== u}h77HH%% u"(-*Dh&H(D0YXXXX$BWXXXXX Yr)key)listfilterrbsortTestMethodsUsingsort functools cmp_to_key)rrRr testFnNamess`` rrOzTestLoader.getTestCaseNamess  Y Y Y Y Y Y6"5s=7I7IJJKK  $ R   !5d6O!P!P  Q Q Qrtest*.pyc d}||j|j}n|d}|}tj|}|tjvr tjd|||_d}tjtj|retj|}||kr>tjtj|d }n t|tj |}| dd} tjtj |j }nD#t$r7|jtjvrt#ddt#d|dwxYw|r9|||_tj|n#t($rd}YnwxYw|rt)d|zt+|||}||S) NFTr __init__.pyrrz2Can 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@abspathsysinsertisdirisfilerwrxmodulesrvdirname__file__ryrbuiltin_module_namesrM _get_directory_containing_moduleremover'r _find_testsr() r start_dirrW top_level_dirset_implicit_topis_not_importable the_moduletop_partrks rdiscoverzTestLoader.discoversj 6!  T%8%D /MM  "# %M 66 (( HOOA} - - -+! 7==33 4 4 3 22IM))(*rw||I}7]7](^(^$^! 39%%%![3 $??3//2 ( ")<>>!@!@II%(((!*c.FFF')ABBGKL(MzMM#'( ($3*.*O*OPX*Y*YD'HOOM222) ) ) )$(!!! ),  SE QRR RT%%i99::u%%%s HAFAG H! H!ctj|}tj|j}tj|dr> > 7??9-- -rc ||jkrdSttj|}tj||j}|tjjd}|SNrr)rrBr?r@normpathrelpathreplacesep)rr@_relpathrs r_get_name_from_pathzTestLoader._get_name_from_path]sj 4& & &3%bg&6&6t&<&<==7??4)<== S11 rcDt|tj|Sr )rxrr)rrs r_get_module_from_namez TestLoader._get_module_from_nameis4{4  rc"t||Sr )r)rr@rrWs r _match_pathzTestLoader._match_pathmstW%%%rc#tK ||}|dkr,||jvr#|||\}}||V|sdStt j|}|D]}tj||}|||\}}||V|r||}|j| | ||Ed{V|j |#|j |wxYwdSr) rrH_find_test_pathrar?listdirr@rwaddrdiscard) rrrWrrkshould_recursepathsr@rs rrzTestLoader._find_testsqsw='' 22 3;;4t'===%)$8$8G$L$L !E>  ! rz),,-- 9 9D Y55I$($8$8G$L$L !E>   9// ::&**40009#// 7CCCCCCCCC*2248888D*2248888 9 9 9s !DD4c tj|}tj|rt|sdS||||sdS||} ||}tj t|d|}ttj |}ttj |}| | krtj|} ttj|} tj|} d} t| | | | fz|||dfS#t"j$r"} t'|| |jdfcYd} ~ Sd} ~ wt+||j\}}|j||dfcYSxYwtj|rztjtj|dsdSd}d}||} ||}t|dd}|j| |||}||df|j|S|df|j|S#|j|wxYw#t"j$r"} t'|| |jdfcYd} ~ Sd} ~ wt+||j\}}|j||dfcYSxYwdS) N)NFrzW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?rVFrrZT)r?r@rrVALID_MODULE_NAMEmatchrrrrrcrBrealpathr=rr'rprSkipTestr;r(r*rFrerrwrHrr)rrrWrrrgmod_filerfullpath_noext module_dirmod_name expected_dirmsgrmrnrorZrkpackages rrzTestLoader._find_test_paths 7##I.. 7>>) $ $? $**844 #"{##HiAA #"{++I66D P33D997??FJ ::<<1G$$X..00!7G$$Y//"1"1>>##~';';'='===!#!:!:J5((33 5 5H#%7??9#=#=LDC%x\BBDDD///HH%OO/= K K K)$4?CCUJJJJJJJ ),T4?CC* M ""=111!5(((($W]]9 % % 7>>"',,y-"H"HII #"{JE++I66D 944T::%WlDAA &**40009 44Wg4NNE!-$e|*2248888!$;*2248888D*2248888%= K K K)$4?CCUJJJJJJJ ),T4?CC* M ""=111!5((((;sN G++I:HI;INM&M&&NO.N1+O.1;O.r )rN)rrrr staticmethodr three_way_cmprrrrLr(rrrUrprrrOrrrrrrrr r!s@rrDrDBsS'<(:;;JN'''''$:>*****XPJPJPJPJd''''&Q&Q&Q&Q&f . . .   !!!&&&999@HHHHHHHrrDc^t}||_||_||_|r||_|Sr )rDrrrr()prefix sortUsingr(rloaders r _makeLoaderrs8 \\F"+F$F.F'& Mrcddl}|jdtdt||||S)Nrzunittest.getTestCaseNames() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.getTestCaseNames() instead. stacklevel)r)r\r]r^rrO)rRrrrr\s rrOrOsXOOOHM Eq vy;K L L L ] ]^k l llrr/cddl}|jdtdt||||S)Nrzunittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.rr)r\r]r^rrU)rRrrr(r\s r makeSuitersZOOOHM Jq vy* 5 5 K K  rcddl}|jdtdt||||S)Nrzunittest.findTestCases() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromModule() instead.rr)r\r]r^rrp)rgrrr(r\s r findTestCasesrsZOOOHM Hq vy* 5 5 I I  rrs)!r?rerr$rzrr\rrrrr __unittestcompile IGNORECASErr8r r*r,r&r;rBobjectrDdefaultTestLoaderrrrOrLrrr2rrrs  ((((((((  BJ0"-@@     $-   NNN ... (((000%%% WWWWWWWWt JLL 7;6H[_mmmm%+d6H    "(43E"_      rPK!&66 __pycache__/case.cpython-311.pycnu[ 0iBdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZmZmZdZeZdZGdd eZGd d eZGd d eZGddeZdZdZdZdZgZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(GddZ)Gdde)Z*Gd d!e*Z+Gd"d#e*Z,Gd$d%ej-Z.Gd&d'eZ/Gd(d)e/Z0Gd*d+e/Z1dS),zTest 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.ceZdZdZdS)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__4/opt/alt/python311/lib64/python3.11/unittest/case.pyr r srr ceZdZdZdS) _ShouldStopz The test should stop. Nr rrrrr!rrceZdZdZdS)_UnexpectedSuccessz7 The test was supposed to fail, but it didn't! Nr rrrrr&rrrc8eZdZddZejddZdS)_OutcomeNchd|_||_t|d|_d|_d|_dS)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init__z_Outcome.__init__-s8!& (/ (E(E% #rFc#BK|j}d|_ dV|r(|jr!|j|j|dn#t$rt $r4}d|_t |j|t|Yd}~nzd}~wt$rYnktj }|j r||_ nAd|_|r"|j|j||nt|j||d}YnxYw|jo||_dS#|jo||_wxYw)NTF)r rr test_caseKeyboardInterruptr _addSkipstrrsysexc_inforr! _addError)r"r%subTest old_successer*s rtestPartExecutorz_Outcome.testPartExecutor4sql   8 EEE, M4< M &&y':ItLLL-!     5 5 5 DL T[)SVV 4 4 4 4 4 4 4 4    D |~~H% @'/$$$ @K**9+> 8TTTTdk9h???HHH  <7KDLLL4<7KDL 7 7 7 7s;A+DC;*B?D C;DA&C;9DDN)F)r rrr# contextlibcontextmanagerr/rrrrr,sL$$$$888888rrct|dd}||||dStjdtd|j|dS)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr%reasonr4s rr'r'Usffi..G 6""""" L$a ) ) ))$$$$$rc|C|Ct|d|jr|j||dS|j||dSdSdS)Nr) issubclassfailureException addFailureaddError)rtestr*s rr+r+^si h2 hqk4#8 9 9 , F dH - - - - - FOD( + + + + + 22rc|Sr0r)objs r_idrDes Jrct|} |j}|j}n/#t$r"t d|jd|jddwxYw||}|||ddd|S)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrRis r((CO | OOODCNDDS-=DDDEEJN OOU2YYFJtRtT*** Ms  ,A c@t|||fdS)znSame as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).N)_module_cleanupsappend)functionargskwargss raddModuleCleanuprYys%XtV455555rc,t|tS)z&Same as enterContext, but module-wide.)rRrY)rMs renterModuleContextr[~s ". / //rcg}trZt\}}} ||i|n,#t$r}||Yd}~nd}~wwxYwtZ|r|ddS)zWExecute all module cleanup functions. Normally called for you after tearDownModule.Nr)rTpop ExceptionrU) exceptionsrVrWrXexcs rdoModuleCleanupsrasJ #!1!5!5!7!7$ # Hd %f % % % % # # #   c " " " " " " " " # # ms1 AAAcdfd}ttjr}d||S|S)z& Unconditionally skip a test. ct|ts!tj|fd}|}d|_|_|S)Nc"tr0r )rWrXr;s r skip_wrapperz-skip..decorator..skip_wrappersv&&&rT) isinstancerH functoolswraps__unittest_skip____unittest_skip_why__) test_itemrfr;s r decoratorzskip..decorators^)T** % _Y ' ' ' ' ' '( ' '$I&* #*0 'r)rgtypes FunctionType)r;rmrls` rskiprqsS     &%,--$ y### rc2|rt|StS)z/ Skip a test if the condition is true. rqrD conditionr;s rskipIfrvsF|| Jrc2|st|StS)z3 Skip a test unless the condition is true. rsrts r skipUnlessrxs F|| Jrcd|_|S)NT)__unittest_expecting_failure__)rls rr!r!s/3I, rct|trtfd|DSt|tot |S)Nc38K|]}t|VdSr0) _is_subtype).0r.basetypes r z_is_subtype..s->>;q(++>>>>>>r)rgtupleallrHr=)expectedrs `rr}r}sW(E""?>>>>X>>>>>> h % % H*Xx*H*HHrceZdZdZdZdS)_BaseTestCaseContextc||_dSr0)r%)r"r%s rr#z_BaseTestCaseContext.__init__s "rcv|j|j|}|j|r0)r%_formatMessagemsgr>)r" standardMsgrs r _raiseFailurez"_BaseTestCaseContext._raiseFailures1n++DHkBBn--c222rN)r rrr#rrrrrrs2###33333rrceZdZddZdZdS)_AssertRaisesBaseContextNct||||_||_|t j|}||_d|_d|_dSr0) rr#rr%recompileexpected_regexobj_namer)r"rr%rs rr#z!_AssertRaisesBaseContext.__init__sU%%dI666  "  %Z77N, rc t|j|jst|d|j|sM|dd|_|r,ttt|d|d}S|^}} |j |_ n$#t$rt||_ YnwxYw|5||i|dddn #1swxYwYd}dS#d}wxYw)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. z() arg 1 must be rNz1 is an invalid keyword argument for this function) r}r _base_typerL_base_type_strr]rnextiterr rrKr()r"namerWrX callable_objs rhandlez_AssertRaisesBaseContext.handlesz t}do>> =!%t':':!<=== !::eT22M#7;DLL7I7I7I7I%LMMMDD#' L4 2 , 5 ! 2 2 2 #L 1 1  2 . . d-f--- . . . . . . . . . . . . . . .DDD4DKKKKsZA?C C BC B74C 6B77C < C C CC CC C$r0)r rrr#rrrrrrs7rrcFeZdZdZeZdZdZdZe e j Z dS)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typesc|Sr0rr"s rrIz_AssertRaisesContext.__enter__s rc| |jj}n$#t$rt|j}YnwxYw|jr/|d||jn=|d|ntj|t||jsdS| d|_ |j dS|j }| t|s;|d|jt|dS)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rr rKr(rrformat traceback clear_framesr=with_traceback exceptionrsearchpattern)r"exc_type exc_valuetbexc_namers rrJz_AssertRaisesContext.__exit__se   .=1! . . .t}-- .} E""#8#?#?@D $O$OPPPP""?#9#9(#C#CDDDD  "2 & & &(DM22 5"11$77   &4,$$S^^44 >   9@@#+S^^ = = > > >ts 22N) r rrr BaseExceptionrrrIrJ classmethodro GenericAlias__class_getitem__rrrrrsSMMJDN6$ E$677rrc&eZdZdZeZdZdZdZdS)_AssertWarnsContextzBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typesc6ttjD]}t |ddri|_t jd|_|j |_t j d|j |S)N__warningregistry__T)recordalways) listr)modulesvaluesr6rr7catch_warningswarnings_managerrI simplefilterr)r"vs rrIz_AssertWarnsContext.__enter__ sck((**++ + +Aq/66 +(*% ( 7t D D D-7799 h 666 rc|j||||dS |jj}n$#t$rt |j}YnwxYwd}|jD]s}|j}t||js||}|j (|j t |sR||_ |j |_ |j |_ dS|@|d|j jt ||jr0|d||jdS|d|dS)Nrz{} not triggered by {}z{} not triggered)rrJrr rKr(r7messagergrrwarningfilenamelinenorrrr)r"rrrrfirst_matchingmws rrJz_AssertWarnsContext.__exit__+s &&xB???   F *}-HH * * *4=))HHH *  A Aa// %!"#/'..s1vv660DLJDM(DK FF  %   9@@(0#n2E2E G G H H H = D   7>>x?C} N N O O O O O   188BB C C C C Cs /AAN) r rrrWarningrrrIrJrrrrrsGLLJ?N    D D D D DrrceZdZdZdS)_OrderedChainMapc#~Kt}|jD]$}|D]}||vr|||V %dSr0)setmapsadd)r"seenmappingks r__iter__z_OrderedChainMap.__iter__Os`uuy  G  D==HHQKKKGGG   rN)r rrrrrrrrNs#rrceZdZdZeZdZdZdZfdZ dOdZ dZ d Z d Z ed Zed Zd ZdZedZedZdZdZdZdZdZdZdZdZejefdZ dZ!dZ"dZ#dZ$dZ%dZ&dPd!Z'd"Z(ed#Z)d$Z*d%Z+d&Z,dPd'Z-dPd(Z.dPd)Z/d*Z0d+Z1d,Z2dQd-Z3dQd.Z4d/Z5dPd0Z6dPd1Z7dPd2Z8 dRd3Z9 dRd4Z:dQd5Z;d6ZdPd9Z?dPd:Z@dPd;ZAdPd<ZBdPd=ZCdPd>ZDdPd?ZEdPd@ZFdPdAZGdPdBZHdPdCZIdPdDZJdPdEZKdPdFZLdPdGZMdPdHZNdPdIZOdJZPdKZQdPdLZRdPdMZSdNZTeTe7xZUZVeTe8xZWZXeTe9xZYZZeTe:xZ[Z\eTe/xZ]Z^eTe1Z_eTe.Z`eTePZaeTeRZbeTeSZcxZdS)STestCaseaWA 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. TiicVd|_g|_tj|i|dS)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rOrWrX __class__s rrzTestCase.__init_subclass__s5 % !!42622222rrunTestc:||_d|_d|_ t||}|j|_n0#t $r#|dkrt d|jd|YnwxYwg|_d|_ i|_ | td| td| td| td | t d | t"d 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 : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr6rrK ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr()r" methodName testMethods rr#zTestCase.__init__sA * ' 5 z22J#-"4D   4 4 4Y&&!j~~~zz"3444'& 4 %'!   '8999   '8999   (:;;;   &6777   ,<===   &<=====s4*A! A!c||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)r"typeobjrVs rrzTestCase.addTypeEqualityFuncs.6!'***rc@|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).N)rrUr"rVrWrXs r addCleanupzTestCase.addCleanups' xv677777rc,t||jS)zEnters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method. )rRr)r"rMs r enterContextzTestCase.enterContexts b$/222rc@|j|||fdS)zpSame as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).N)rrUrOrVrWrXs raddClassCleanupzTestCase.addClassCleanups( ""HdF#;<<<<t|jd|jS)NrGrrrrs ridz TestCase.ids#"4>2222D4H4HIIrclt|t|urtS|j|jkSr0)rHNotImplementedrr"others r__eq__zTestCase.__eq__s0 ::T%[[ ( (! !#u'<<rrs r__repr__zTestCase.__repr__s.(((($*>*>*>@ @rc+K|j |jjsdVdS|j}|t|}n|j|}t ||||_ |j|jd5dVdddn #1swxYwY|jjs|jj }||j rtn|jj rt||_dS#||_wxYw)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. NT)r,) rrrrparams new_child_SubTestr/r rfailfastrr!)r"rr#parent params_maprs rr,zTestCase.subTestsI =  (N EEE F >)&11JJ0088J sJ77  #// t/LL                 =( "-%&/%%%. ""!"DMMMFDM " " " "s0&!C(B C(BC(B ?C(( C1c |j}|||dS#t$r.tjdt|j|YdSwxYw)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerKr7r8r9r:)r"rr*r*s r_addExpectedFailurezTestCase._addExpectedFailure&s~ /!'!:   tX . . . . .  $ $ $ M\( * * * F d # # # # # # $s4AAc |j}||dS#t$rXtjdt t d#t $r'|j|tjYYdSwxYwwxYw)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrKr7r8r9rr?r)r*)r"rr-s r_addUnexpectedSuccesszTestCase._addUnexpectedSuccess0s '#)#>  !  & & & & & 8 8 8 M_( * * * 8(d2% 8 8 8!!$ 7777777 8 8s&$A8A,A4/A83A44A8c.|dSr0)rrs r _callSetUpzTestCase._callSetUp?s rc^|"tjd|dtddSdS)NzFIt is deprecated to return a value that is not None from a test case (r) stacklevel)r7r8DeprecationWarning)r"methods r_callTestMethodzTestCase._callTestMethodBs\ 688  M2(.2223ERS U U U U U U rc.|dSr0)rrs r _callTearDownzTestCase._callTearDownGs rc||i|dSr0rrs r _callCleanupzTestCase._callCleanupJs$!&!!!!!rNc|C|}t|dd}t|dd}| |nd}|j| t||j}t|jddst|ddrWt|jddpt|dd}t |||||j|| |SSt|ddpt|dd}t|} ||_| |5| dddn #1swxYwY|j r||_ | |5| |dddn #1swxYwYd|_ | |5|dddn #1swxYwY||j rK|r9|jr|||jn&||n|j||d|_d}d|_|j|| |SS#d|_d}d|_wxYw#|j|| |wwxYw)N startTestRun stopTestRunrjFrkrnrz)rr6 startTestrrr'stopTestrrr/r0r rr6r8 doCleanupsr!r+r.r:)r"rr<r=rskip_whyroutcomes rrunz TestCase.runMs >++--F"6>4@@L!&->>K' K2  t';<FFM $DeLL v&&G % ' --d33&&OO%%%&&&&&&&&&&&&&&&?-0AG- 11$7799,,Z88899999999999999905G- 11$77--**,,,---------------!!!?0(0"2? 44VW=TUUUU 66v>>>>))$///+/'!%  FOD ! ! !& '+/'!% $$$$ FOD ! ! !& 'sA5J(,1J(J:E JEJ"E#&J F+ J+F//J2F/3JG3' J3G77J:G7;A*J%J(J%%J((Kc |jp t}|jrb|j\}}}||5|j|g|Ri|dddn #1swxYwY|jb|jS)zNExecute all cleanup functions. Normally called for you after tearDown.N)rrrr]r/r:r )r"rBrVrWrXs rr@zTestCase.doCleanupss--8::n =%)^%7%7%9%9 "HdF))$// = =!!(%> "HdF ?$)&)))) ? ? ?'..s|~~>>>>> ? ! ? ? ? ? ?s65A.-A.c|j|i|Sr0)rC)r"rWkwdss r__call__zTestCase.__call__stx&&&&rct||j}t|jddst|ddr6t|jddpt|dd}t||||||jr7|j\}}}|j |g|Ri||j5dSdS)z6Run the test without collecting errors in a TestResultrjFrkrnN) r6rrr r0r6r8rr]r:)r"rrArVrWrXs rdebugzTestCase.debugsT4#788 DN$7 ? ? % J 3U ; ; % 0GLLL":/FKK 8$$ $  Z((( n 9%)^%7%7%9%9 "HdF D h 8 8 8 8 8 8 8n 9 9 9 9 9rc t|)zSkip this test.re)r"r;s rskipTestzTestCase.skipTestsvrc,||)z)Fail immediately, with the given message.)r>)r"rs rfailz TestCase.fails##C(((rc|r;||dt|z}||dS)z#Check that the expression is false.z%s is not falseNrrr>r"exprrs r assertFalsezTestCase.assertFalsesI  -%%c+>.$??GGdGNNNNs+/cPt||}|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) assertWarnsrr)r"expected_warningrWrXr_s rrazTestCase.assertWarnss*8&&6==~~mT6:::rc,ddlm}||||dS)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_AssertLogsContextFno_logs_logrfr"loggerlevelrfs r assertLogszTestCase.assertLogs"s0* -,,,,,!!$uEEEErc,ddlm}||||dS)z Fail unless no log messages of level *level* or higher are emitted on *logger_name* or its children. This method must be used as a context manager. rreTrgrirks r assertNoLogszTestCase.assertNoLogs:s0 -,,,,,!!$tDDDDrct|t|urP|jt|}|'t|trt ||}|S|jS)aGet a detailed comparison function for the types of the two args. Returns: A callable accepting (first, second, msg=None) that will raise a failure exception if first != second with a useful human readable error message for those types. )rHrgetrgr(r6_baseAssertEqual)r"firstsecondasserters r_getAssertEqualityFunczTestCase._getAssertEqualityFuncCsl" ;;$v,, & &044T%[[AAH#h,,7&tX66H$$rc||ks>dt||z}|||}||dS)z:The default assertEqual implementation, not type specific.%s != %sN)r rr>)r"rtrurrs rrszTestCase._baseAssertEqual]sP$';E6'J'JJK%%c;77C'',, ,rcN|||}||||dS)z[Fail if the two objects are unequal as determined by the '==' operator. )rN)rw)r"rtrurassertion_funcs r assertEqualzTestCase.assertEqualds644UFCCuf#......rc||ksJ||t|dt|}||dS)zYFail if the two objects are equal as determined by the '!=' operator.  == NrR)r"rtrurs rassertNotEqualzTestCase.assertNotEqualkse%%c59I9I9I9I:CF:K:K:K,MNNC'',, ,rc ||krdS||tdt||z }|K||krdSt|dt|dt|dt|d}nO|d}t||dkrdSt|dt|d|d t|d}|||}||) a'Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). If the two objects compare equal then they will automatically compare almost equal. N specify delta or places not bothz !=  within  delta ( difference)rz places (rLabsrroundrr>r"rtruplacesrdeltadiffrs rassertAlmostEqualzTestCase.assertAlmostEqualts, F?? F  !3>?? ?56>""  u}}%    &!!!!%    $ !KK ~T6""a''%    &!!!!$ !K !!#{33##C(((rc ||tdt||z }|Q||ks||krdSt|dt|dt|dt|d}nE|d}||kst||dkrdSt|dt|d|d }|||}||) aFail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). Objects that are equal automatically fail. Nrr~rrrrrz placesrrs rassertNotAlmostEqualzTestCase.assertNotAlmostEquals  !3>?? ?56>""  VOO%    &!!!!%    $ !KK ~VOOtV)<)<)A)A9B59I9I9I9I9B69J9J9J9J9?AK!!#{33##C(((rc |x|j}t||s(|d|dt|t||s(|d|dt|nd}d} t |}n#t t f$rd|z}YnwxYw|- t |}n#t t f$rd|z}YnwxYw|||krdSd|ft||zz}tt||D]} || } n(#t tt f$r|d | |fzz }YnwxYw || } n(#t tt f$r|d | |fzz }YnQwxYw| | kr|d | ft| | zzz }n+||kr$|"t|t|krdS||krS|d |||z fzz } |d |t||fzz }n#t tt f$r |d||fzz }Yn]wxYw||krS|d|||z fzz } |d |t||fzz }n'#t tt f$r |d||fzz }YnwxYw|} dd tjt!j|t!j|z} || | } ||| }||dS)aAAn equality assertion for ordered sequences (like lists and tuples). For the purposes of this function, a valid ordered sequence type is one which can be indexed, has a length, and has an equality operator. Args: seq1: The first sequence to compare. seq2: The second sequence to compare. seq_type: The expected datatype of the sequences, or None if no datatype should be enforced. msg: Optional message to use on failure instead of a list of differences. NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r )r rgr>rlenrLNotImplementedError capitalizer rangemin IndexErrorrHjoindifflibndiffpprintpformat splitlines_truncateMessagerrP)r"seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualzTestCase.assertSequenceEquals  $-MdH-- L++++8==)D///-KLLLdH-- L++++8==)D///-KLLL L'M  #t99DD./ # # #B!#III #   '4yy23 ' ' 'G%'  '  t||0"--//1(t4456I3tT??++   GEE!:/BC"N"#]!3#45IEE  GEE!:/BC"O"#]!3#45IEE E>>"K#$$)=eU)K)K"K#MNIE" DLLX%5JJ$t**,,Fd{{+.;TD[-IJK K"A#'4:)>)>"?#@AII!:/BCKKK#259=4I#JKIIIK+.;TD[-IJK L"A#'4:)>)>"?#@AII!:/BCLLL#36:M5J#KLIIIL  M&...99;; ...99;; = =>>>++KAA !!#{33 #slBB)(B)/B??CC/D88!EE!E**!FF3H!H54H5 I**!J Jcx|j}|t||kr||zS|tt|zzSr0)maxDiffr DIFF_OMITTED)r"rrmax_diffs rrzTestCase._truncateMessage's?<  s4yyH44T> !,T233rcB||||tdS)aA list-specific equality assertion. Args: list1: The first list to compare. list2: The second list to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r"list1list2rs rrzTestCase.assertListEqual-s'   sT BBBBBrcB||||tdS)aA tuple-specific equality assertion. Args: tuple1: The first tuple to compare. tuple2: The second tuple to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r"tuple1tuple2rs rrzTestCase.assertTupleEqual9s'   u EEEEErcJ ||}nY#t$r"}|d|zYd}~n2d}~wt$r"}|d|zYd}~nd}~wwxYw ||}nY#t$r"}|d|zYd}~n2d}~wt$r"}|d|zYd}~nd}~wwxYw|s|sdSg}|r<|d|D]$}|t |%|r<|d|D]$}|t |%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 ) differencerLrPrKrUreprrr) r"set1set2r difference1r. difference2linesitemrs rrzTestCase.assertSetEqualDs& P//$//KK M M M IIG!K L L L L L L L L P P P IIJQN O O O O O O O O P Q//$//KK M M M IIG!K L L L L L L L L Q Q Q IIKaO P P P P P P P P Q {  F  ) LLE F F F# ) ) T$ZZ((((  ) LLE F F F# ) ) T$ZZ((((ii&&  $%%c;7788888sB A.? A. A))A.2B CB// C<CCc||vrLt|dt|}||||dSdS)zDJust like self.assertTrue(a in b), but with a nicer default message. not found in NrrPrr"member containerrrs rassertInzTestCase.assertInosd  " "2;F2C2C2C2C2;I2F2F2FHK IId))#{;; < < < < < # "rc||vrLt|dt|}||||dSdS)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nrrs r assertNotInzTestCase.assertNotInvsd Y  ;DV;L;L;L;L8A)8L8L8LNK IId))#{;; < < < < <  rc||urLt|dt|}||||dSdS)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nrr"expr1expr2rrs rassertIszTestCase.assertIs}sc   ,5e,<,<,<,<-6u-=-=-=?K IId))#{;; < < < < <  rc||ur=dt|}||||dSdS)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nrrs r assertIsNotzTestCase.assertIsNotsO E>>>:CE:J:J:JLK IId))#{;; < < < < < >rc ||td||td||krdt||z}ddt jt j|t j|z}| ||}| | ||dSdS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryryr ) assertIsInstancerr rrrrrrrrPr)r"d1d2rrrs rrzTestCase.assertDictEquals b$(LMMM b$(MNNN 88$';B'C'CCK499W]!>"--88::!>"--88::&<&<===D// TBBK IId))#{;; < < < < < 8rc Htjdtg}g}|D]u\}}||vr|||||krJ|t |dt |dt ||v|s|sdSd}|r"ddd|Dz}|r"|r|d z }|d d|zz }||||dS) z2Checks whether dictionary is a superset of subset.z&assertDictContainsSubset is deprecatedz , expected: z , actual: Nrnz Missing: %s,c34K|]}t|VdSr0)r)r~rs rrz4TestCase.assertDictContainsSubset..s83=3=A9Q<<3=3=3=3=3=3=rz; zMismatched values: %s) r7r8r4itemsrUrrrPr) r"subset dictionaryrmissing mismatchedkeyvaluers rassertDictContainsSubsetz!TestCase.assertDictContainsSubsetsz >( * * *  ,,.. @ @JC*$$s####*S/))!!#,S>>>>9U3C3C3C3C#,Z_#=#=#=#?@@@ :  F  ='#((3=3=4;3=3=3=+=+==K  J $t# 2SXXj5I5II IK $%%c;7788888rct|t|}} tj|}tj|}||krdSt||}n #t$rt ||}YnwxYw|rfd}d|D}d|} ||| }|||}| |dSdS)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: cg|]}d|zS)z First has %d, Second has %d: %rr)r~rs r z-TestCase.assertCountEqual..sWWW47$>WWWrr ) r collectionsCounterrrLrrrrrP) r"rtrur first_seq second_seq differencesrrrs rassertCountEqualzTestCase.assertCountEquals!%U T&\\:  F' 22E (44F .y*EEKK  I I I1)ZHHKKK I  =A>c||td||td||kr*t||jkst||jkr|||||d}|d}t|dkr%|d|kr |dzg}|dzg}dt||z}dd tj ||z}| ||}| | ||d Sd S) z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringT)keependsrz r ryrnN)rr(r_diffThresholdrsrr r rrrrrPr)r"rtrur firstlines secondlinesrrs rrzTestCase.assertMultiLineEqualsa eS*JKKK fc+LMMM F??E T000F d111%%eVS999))4)88J ++T+::K:!## F(;(;u(D(D#dl^ %}o $';E6'J'JJK"'''- K"H"HIIID// TBBK IId))#{;; < < < < < ?rc||ksLt|dt|}||||dSdS)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nrr"abrrs r assertLesszTestCase.assertLesssV1uu3 b), but with a nicer default message.z not greater than Nrrs r assertGreaterzTestCase.assertGreatersV1uu6?llllIaLLLQK IId))#{;; < < < < <urc||ksLt|dt|}||||dSdS)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to Nrrs rassertGreaterEqualzTestCase.assertGreaterEquals[AvvBKA,,,,PYZ[P\P\P\]K IId))#{;; < < < < <vrc|=t|d}||||dSdS)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Nonerr"rCrrs r assertIsNonezTestCase.assertIsNonesH ?.7nnnn>K IId))#{;; < < < < < ?rcd|-d}||||dSdS)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rPrrs rassertIsNotNonezTestCase.assertIsNotNones; ;-K IId))#{;; < < < < < ;rct||s?t|d|}||||dSdS)zTSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.z is not an instance of NrgrrPrr"rCrOrrs rrzTestCase.assertIsInstance s^#s## =;DS>>>>33OK IId))#{;; < < < < < = =rct||r?t|d|}||||dSdS)z,Included for symmetry with assertIsInstance.z is an instance of Nrrs rassertNotIsInstancezTestCase.assertNotIsInstances\ c3   =7@~~~~ssKK IId))#{;; < < < < < = =rcRt|||}|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])r"r^rrWrXr_s rrzTestCase.assertRaisesRegexs-''94PP~~14@@@rcRt|||}|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. assertWarnsRegexrb)r"rcrrWrXr_s rrzTestCase.assertWarnsRegex(s- &&6nMM~~0$???rct|ttfr |s Jdtj|}||s8d|jd|}|||}||dS)z=Fail the test unless the text matches the regular expression.z!expected_regex must not be empty.zRegex didn't match: rN) rgr(bytesrrrrrr>)r"textrrrs r assertRegexzTestCase.assertRegex;s nsEl 3 3 8! F F#F F F>Z77N$$T** - -&&&.K%%c;77C'',, ,  - -rcbt|ttfrtj|}||}|rgd|||d|jd|}| ||}| |dS)z9Fail the test if the text matches the regular expression.zRegex matched: z matches z in N) rgr(rrrrstartendrrr>)r"runexpected_regexrmatchrs rassertNotRegexzTestCase.assertNotRegexGs &e 5 5 <!z*:;;  ''--  - -U[[]]UYY[[0111 (((K %%c;77C'',, , - -rcfd}|S)Ncztjdjtd|i|S)NzPlease use {0} instead.r5)r7r8rr r4)rWrX original_funcs rdeprecated_funcz,TestCase._deprecate..deprecated_funcWsG M)001GHH"A ' ' '!=$1&11 1rr)rrs` r _deprecatezTestCase._deprecateVs$ 2 2 2 2 2 r)rr0)NNNNN)er rrrAssertionErrorr>rYrrrr#rrrrrrrrrrrrrrrrrr!r1r2_subtest_msg_sentinelr,r+r.r0r6r8r:rCr@rGrJrLrNrPrUrWrr\rarnrprwrsr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrfailUnlessEqual assertEquals failIfEqualassertNotEqualsfailUnlessAlmostEqualassertAlmostEqualsfailIfAlmostEqualassertNotAlmostEquals failUnlessassert_failUnlessRaisesfailIfassertRaisesRegexpassertRegexpMatchesassertNotRegexpMatches __classcell__rs@rrrXs@&KGN33333 >>>>@ 6 6 6888333==[= 77[7      VV[Vaa[a###CCCJJJ=== 888eee@@@/####</// ' ' 'UUU """====~    ? ?[ ?'''999"))))---- ---- III*B;;;>FFFF0EEEE%%%4----////----AE $+)+)+)+)ZDH#'!)!)!)!)FaaaaF444 C C C C F F F F)9)9)9)9V================ = = = =9999:@====(==== ==== ==== ==== ==== ==== ======== AAA @@@& - - - - - - - -&0Z %<%<$>>K/1;)r"r%rr#rs rr#z_SubTest.__init__s?  " ) :rc td)Nzsubtests cannot be run directly)rrs rrz_SubTest.runTests!"CDDDrctg}|jtur-|d|j|jr^dd|jD}|d|d|pdS)Nz[{}]z, c3HK|]\}}d||VdS)z{}={!r}N)r)r~rrs rrz+_SubTest._subDescription..sJ$3$3Q  A&&$3$3$3$3$3$3rz({}) z ())r<rrUrr#rr)r"parts params_descs r_subDescriptionz_SubTest._subDescriptions = 5 5 5 LLt}55 6 6 6 ; 5))$3$3"k//11$3$3$333K LL{33 4 4 4xx/-/rcd|j|SNz{} {})rr%rrCrs rrz _SubTest.ids0~~dn//1143G3G3I3IJJJrc4|jS)zlReturns a one-line description of the subtest, or None if no description has been provided. )r%rrs rrz_SubTest.shortDescriptions~..000rc\d|j|SrE)rr%rCrs rrz_SubTest.__str__s$~~dnd.B.B.D.DEEEr) r rrr#rrCrrrr&r's@rr%r%s;;;;;EEE 0 0 0KKK111 FFFFFFFrr%)2rr)rhrrrr7rr1rrornrutilrrrrr __unittestobjectrrr^r rrrr'r+rDrRrTrYr[rarqrvrxr!r}rrrrChainMaprrr)r%rrrrLs   ?????????????? 7 y)  &8&8&8&8&8v&8&8&8R%%%,,,   666 000    (III 33333333'''''3'''T$8$8$8$8$83$8$8$8N1D1D1D1D1D21D1D1Dh{+P8P8P8P8P8vP8P8P8h 7:7:7:7:7:x7:7:7:t!F!F!F!F!Fx!F!F!F!F!FrPK!ax55 __pycache__/main.cpython-311.pycnu[ 0i,dZddlZddlZddlZddlZddlmZmZddlm Z dZ dZ dZ d Z d Zd ZGd d eZeZdS)zUnittest main programN)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase cVtj|r|drtj|rstj|tj}tj|s|tj r|S|}tj |dd dd ddS|S)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths 4/opt/alt/python311/lib64/python3.11/unittest/main.py _convert_namers  w~~dP 5 5e < <P 7==   wtRY[[99Hw}}X&& (*=*=bi*H*H  Dw%%crc*224==EEc3OOO Kcd|DS)Nc,g|]}t|S)r).0rs r z"_convert_names../s 2 2 2DM$   2 2 2rr)namess r_convert_namesr#.s 2 2E 2 2 22rcd|vrd|z}|S)N*z*%s*r)patterns r_convert_select_patternr'2s '>>7" Nrc eZdZdZdZdZdxZxZxZxZ xZ Z dZ dddde jddddddf dddZdd Zd Zd Zdd Zd ZdZdZdZddZdZdS) TestProgramzA command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. Nr__main__TF) tb_localsc Vt|trOt||_|dddD]} t |j| |_n||_| t j}||_||_ | |_ ||_ | |_ | |_ | t jsd|_n| |_||_||_||_t&j|d|_|||dS)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr+ warnoptionswarnings defaultTest testRunner testLoaderr r basenameprogName parseArgsrunTests)selfr1r=r5r>r?r6r9r7r8r:r<r+parts r__init__zTestProgram.__init__Bs fc " " !$V,,DK S))!""- 9 9%dk488  9!DK <8D   $" "  CO &DMM%DM&$$((a11  t rctjdt|rt||j||tjddS)NzHTestProgram.usageExit() is deprecated and will be removed in Python 3.13) r<warnDeprecationWarningprint_discovery_parser_initArgParsers _print_helpr4r6)rDmsgs r usageExitzTestProgram.usageExithsr 01C E E E   #JJJ  ! )  " " "   rcZ|j_t|jttd|jiz|jdSt|jttd|jizdS)Nprog) r1rK _main_parser format_help MAIN_EXAMPLESrArL print_helpMODULE_EXAMPLES)rDargskwargss rrNzTestProgram._print_helprs ;  $#//11 2 2 2 -64="99 : : :  " - - / / / / / $#//11 2 2 2 /VT]$;; < < < < !>""48,,,   ( (abb4 8 8 8: ""2&&&     ( (abb4 8 8 8 : 4+DJ77DN:%%"   %!DNN (# . . 4".0DNN!$"233DN rc^|jr|j|j_|r;||jn |}|j|j|j|j|_dS|j&|j|j |_dS|j |j|j |_dSN) testNamePatternsr?r[startr&toptestr`loadTestsFromModuler1loadTestsFromNames)rDfrom_discoveryLoaderrs rrczTestProgram.createTestss   E/3/DDO ,  H(.T__FFHHF' DL$(KKDIII ^ #;;DKHHDIII::4>;?;HHDIIIrc|}|||_|||_dSre)_getParentArgParser_getMainArgParserrS_getDiscoveryArgParserrL)rD parent_parsers rrMzTestProgram._initArgParserssE0022  22=AA!%!rTextTestRunnerr.r|r9r7r:r<r+ TypeErrorrunriresultr6r4 wasSuccessful)rDr>s rrCzTestProgram.runTestssY ?      ? "$3DO dot , , ) / I!%4>:>-8< :>-;?> "1"K"KJJ !III!%4>:>-8< :>-"1"I"IJJJI  / / /!__..  / J nnTY// 9 6 H22444 5 5 5 5 5 6 6s0 3A>=B<>7B85B<7B88B<<CCre)FN)ra __module__ __qualname____doc__r1r9r7r8r:rAr<rfrLrdefaultTestLoaderrFrPrNrBrcrMrorprqr]rCrrrr)r)8s> FINRRHRzRFRXR;K(d#0HTd$$>C$$$$$L===: H H H HLLL !!!F   * = = = =66666rr))rr4r}r r<rrsignalsr __unittestrUrWrr#r'objectr)mainrrrrs  ######    333 \6\6\6\6\6&\6\6\6|rPK!a55)__pycache__/signals.cpython-311.opt-1.pycnu[ 0ic ~ddlZddlZddlmZdZGddeZejZdZ dZ da dZ d d Z dS) N)wrapsTceZdZdZdZdS)_InterruptHandlercd|_||_t|tr@|tjkr tj}n#|tjkrd}ntd||_ dS)NFcdSN) unused_signum unused_frames 7/opt/alt/python311/lib64/python3.11/unittest/signals.pydefault_handlerz3_InterruptHandler.__init__..default_handlersDzYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr )selfr s r __init__z_InterruptHandler.__init__ s / os + + 3&.00"("< FN22 !2333 /rctjtj}||ur||||jr|||d|_t D]}|dS)NT)r getsignalSIGINTr r_resultskeysstop)rsignumframeinstalled_handlerresults r __call__z_InterruptHandler.__call__s",V];; D ( (   / / / ; 0   / / / mmoo  F KKMMMM  rN)__name__ __module__ __qualname__rr$r rr rr s2///$     rrcdt|<dS)N)rr#s r registerResultr+*sHVrcRtt|dSr)boolrpopr*s r removeResultr/-s  VT** + ++rctStjtj}t |atjtjtdSdSr)_interrupt_handlerrrrr)r s r installHandlerr21sK! *6=99.?? fm%788888"!rctfd}|St+tjtjtjdSdS)Nctjtj}t |i|tjtj|S#tjtj|wxYwr)rrr removeHandler)argskwargsinitialmethods r innerzremoveHandler..inner;sf&v}55G OOO 6vt.v.. fmW5555 fmW5555s A!A7)rr1rrr)r9r:s` r r5r59sg  v 6 6 6 6  6 % fm%7%HIIIII&%rr)rweakref functoolsr __unittestobjectrWeakKeyDictionaryrr+r/r1r2r5r rr r@s   @ %7 $ & &,,,999JJJJJJrPK!3E++(__pycache__/result.cpython-311.opt-2.pycnu[ 0iF!f ddlZddlZddlZddlmZddlmZdZdZdZ dZ Gd d e Z dS) N)utilwrapsTc<tfd}|S)Ncft|ddr||g|Ri|S)NfailfastF)getattrstop)selfargskwmethods 6/opt/alt/python311/lib64/python3.11/unittest/result.pyinnerzfailfast..inner sD 4U + +  IIKKKvd(T(((R(((r)rrs` rr r s3 6]]))))]) Lrz Stdout: %sz Stderr: %sceZdZ dZdZdZddZdZdZdZ dZ dZ d Z d Z ed Zed Zd ZdZdZdZedZdZdZdZdZdZdZdZdS) TestResultNFcd|_g|_g|_d|_g|_g|_g|_d|_d|_d|_ d|_ d|_ tj |_tj|_d|_dS)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccesses shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__zTestResult.__init__&s|     "#%  "" #  # "rcdSNr s r printErrorszTestResult.printErrors7s--rc^ |xjdz c_d|_|dS)NrF)rr& _setupStdoutr tests r startTestzTestResult.startTest:s57  " rc|jr[|j0tj|_tj|_|jt _|jt _dSdSr,)rr ioStringIOrr!r"r$r.s rr1zTestResult._setupStdout@sS ; -"*&(kmm#&(kmm#,CJ,CJJJ  - -rcdSr,r-r.s r startTestRunzTestResult.startTestRunH   rc> |d|_dS)NF)_restoreStdoutr&r2s rstopTestzTestResult.stopTestNs%5 "rc|jrI|jrtj}tj}|r<|ds|dz }|jt|z|r<|ds|dz }|j t|z|jt_|j t_|j d|j |j d|jdSdS)N r)rr&r!r"getvaluer$endswithr#write STDOUT_LINEr% STDERR_LINErseektruncater )r outputerrors rr<zTestResult._restoreStdoutSs> ; +! E,,.. ++--F!??400'$)// f0DEEEE >>$//& )// e0CDDD.CJ.CJ   $ $Q ' ' '   ( ( * * *   $ $Q ' ' '   ( ( * * * * *% + +rcdSr,r-r.s r stopTestRunzTestResult.stopTestRunhr:rcv |j||||fd|_dSNT)rappend_exc_info_to_stringr&r r3errs raddErrorzTestResult.addErrornsB  D$":":3"E"EFGGG!rcv |j||||fd|_dSrL)rrMrNr&rOs r addFailurezTestResult.addFailurevs@ ' dD$<$4999 && ; 5Z((**FJ''))E 6t,,#dNF f 4555 5~~d++"TME e 3444wwx   rcd}d}|||fg}t|h}|r|\}}}|r3||r|j}|r||||jur|||r|}d}n||_|p|j|jfD]a} | ]t| |vrL| t| | | jf| t| b||S)NTF) idpop_is_relevant_tb_leveltb_nextrV_remove_unittest_tb_frames __traceback__ __cause__ __context__rMtypeadd) r rqrrrsr3retfirstexcsseencs rrkzTestResult._clean_tracebackssC%$%5 { (#'88:: WeR 33B77 Z 33B77 $/////333 )&(# /5+<=((A}Ad):): T!WWa$ABBBA) (* rcd|jjvS)N __unittest)tb_frame f_globals)r rss rryz TestResult._is_relevant_tb_levelsr{444rc d}|r5||s |}|j}|r|| | d|_dSdSr,)ryrz)r rsprevs rr{z%TestResult._remove_unittest_tb_framessq  33B77 DB 33B77   DLLL  rcdtj|j|jt |jt |jfzS)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rrcrrr.s r__repr__zTestResult.__repr__s@3 dn--t}c$+>N>NDM""$$ %r)NNN)__name__ __module__ __qualname___previousTestClass_testRunEntered_moduleSetUpFailedr*r/r4r1r9r=r<rJr rQrSrXrZr]r_rarer rNrkryr{rr-rrrrs O####"... ---   ### +++*   ""X"""X" &&&"   ,,,999 ..X.666!!!,8555    %%%%%rr) r6r!rlrjr functoolsrrr rCrDobjectrr-rrrs     \%\%\%\%\%\%\%\%\%\%rPK!HҖ$__pycache__/__init__.cpython-311.pycnu[ 0i^dZgdZegddZddlmZddlmZmZm Z m Z m Z m Z m Z mZmZmZddlmZmZddlmZmZdd lmZmZdd lmZmZdd lmZmZmZm Z dd lm!Z!m"Z"m#Z#eZ$d Z%dZ&dZ'dS)a Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework (used with permission). This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Simple usage: import unittest class IntegerArithmeticTestCase(unittest.TestCase): def testAdd(self): # test method names begin with 'test' self.assertEqual((1 + 2), 3) self.assertEqual(0 + 1, 1) def testMultiply(self): self.assertEqual((0 * 10), 0) self.assertEqual((5 * 8), 40) if __name__ == '__main__': unittest.main() Further information is available in the bundled documentation, and from http://docs.python.org/library/unittest.html Copyright (c) 1999-2003 Steve Purcell Copyright (c) 2003-2010 Python Software Foundation This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContext)getTestCaseNames makeSuite findTestCasesT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrr)rrrcvddl}|jt}|||S)N) start_dirpattern)os.pathpathdirname__file__discover)loadertestsr!osthis_dirs 8/opt/alt/python311/lib64/python3.11/unittest/__init__.py load_testsr,Os4NNNwx((H ??Xw? ? ??cJtdhzS)Nr)globalskeysr-r+__dir__r2Zs 99>>  89 99r-c\|dkr ddlmatStdtd|)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r+ __getattr__r8]sE (((777777&& I8IIII J JJr-N)(__doc____all__extend __unittestresultrcaserrrr r r rrrrsuiterrr'rr r rrunnerrrsignalsrrrrrrr_TextTestResultr,r2r8r1r-r+rCs,,\ I I IAAABBB  '''''''''''''''''''''''',+++++++11111111########22222222PPPPPPPPPPPP>>>>>>>>>>! @@@:::KKKKKr-PK!EWW&__pycache__/async_case.cpython-311.pycnu[ 0iYNddlZddlZddlZddlZddlmZGddeZdS)N)TestCaseceZdZdfd ZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdfd ZfdZdZxZS)IsolatedAsyncioTestCaserunTestct|d|_tj|_dSN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s :/opt/alt/python311/lib64/python3.11/unittest/async_case.pyr z IsolatedAsyncioTestCase.__init__#s: $$$"#.#;#=#=   c KdSr rs r asyncSetUpz"IsolatedAsyncioTestCase.asyncSetUp(  rc KdSr rrs r asyncTearDownz%IsolatedAsyncioTestCase.asyncTearDown+rrc(|j|g|Ri|dSr ) addCleanuprfuncargskwargss raddAsyncCleanupz'IsolatedAsyncioTestCase.addAsyncCleanup.s) $1&11111rcKt|} |j}|j}n/#t$r"t d|jd|jddwxYw||d{V}|||ddd|S)zEnters the supplied asynchronous context manager. If successful, also adds its __aexit__ method as a cleanup function and returns the result of the __aenter__ method. '.zC' object does not support the asynchronous context manager protocolN)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r")rcmclsenterexitresults renterAsyncContextz)IsolatedAsyncioTestCase.enterAsyncContext=s2hh 'NE=DD ' ' 'UUU1AUUU"& ' 'uRyy T2tT4888 s ",Ac|j|j|j||jdSr )r get_looprrunsetUp _callAsyncrrs r _callSetUpz"IsolatedAsyncioTestCase._callSetUpQsL $$&&&  $$TZ000 (((((rct||"tjd|dtddSdS)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethodz'IsolatedAsyncioTestCase._callTestMethodYsd    ' ' 3 M2(.2223ERS U U U U U U 4 3rcx||j|j|jdSr )r7rrr5tearDownrs r _callTearDownz%IsolatedAsyncioTestCase._callTearDown^s6 *+++  $$T]33333rc(|j|g|Ri|dSr )r=)rfunctionr r!s r _callCleanupz$IsolatedAsyncioTestCase._callCleanupbs+X777777777rc|j Jdtj|s J|d|j||i||jS)N!asyncio runner is not initializedz is not an async functioncontextr inspectiscoroutinefunctionr5rrs rr7z"IsolatedAsyncioTestCase._callAsyncesz"..0S...*400VVT2V2V2VVV0"&& D$ !& ! !,'   rc|j Jdtj|r'|j||i||jS|jj|g|Ri|S)NrJrKrMrs rr=z'IsolatedAsyncioTestCase._callMaybeAsyncms"..0S...  &t , , G&**d%f%%0+  04+/FtFFFvFF Frc`|j Jdtjd}||_dS)Nz%asyncio runner is already initializedT)debug)r asyncioRunnerrrunners r_setupAsyncioRunnerz+IsolatedAsyncioTestCase._setupAsyncioRunnerws:"**,S***d+++$rc<|j}|dSr )r closerUs r_tearDownAsyncioRunnerz.IsolatedAsyncioTestCase._tearDownAsyncioRunner|s$ rNc| t||S#|wxYwr )rWr r5rZ)rr1rs rr5zIsolatedAsyncioTestCase.runsZ   """ *77;;v&&  ' ' ) ) ) )D ' ' ) ) ) )s A A"c|t|dSr )rWr rRrZ)rrs rrRzIsolatedAsyncioTestCase.debugs>   """   ##%%%%%rc@|j|dSdSr )r rZrs r__del__zIsolatedAsyncioTestCase.__del__s+   *  ' ' ) ) ) ) ) + *r)rr )__name__r+r,r rrr"r2r8rBrErHr7r=rWrZr5rRr^ __classcell__)rs@rrr s=4>>>>>>        2 2 2()))UUU 444888   GGG%%% ******&&&&& *******rr)rSr rNr>caserrrrrrbs|E*E*E*E*E*hE*E*E*E*E*rPK!Fpz&__pycache__/_log.cpython-311.opt-1.pycnu[ 0i ddlZddlZddlmZejdddgZGddejZGd d eZdS) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc$eZdZdZdZdZdZdS)_CapturingHandlerzM A logging handler capturing all (raw and formatted) logging output. cntj|tgg|_dSN)loggingHandler__init__rwatcherselfs 4/opt/alt/python311/lib64/python3.11/unittest/_log.pyrz_CapturingHandler.__init__s-  &&&&r2.. cdSr rs rflushz_CapturingHandler.flushs rc|jj|||}|jj|dSr )rrappendformatr)rrecordmsgs remitz_CapturingHandler.emitsK ##F+++kk&!! ""3'''''rN)__name__ __module__ __qualname____doc__rrrrrrr r sK///   (((((rr c(eZdZdZdZdZdZdZdS)_AssertLogsContextz6A context manager for assertLogs() and assertNoLogs() z"%(levelname)s:%(name)s:%(message)sctj||||_|r&tj|||_ntj|_d|_||_ dSr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser$r'r)s rrz_AssertLogsContext.__init__!s\%dI666&  & -11%??DJJ DJ rc,t|jtjr|jx}|_n tj|jx}|_tj|j}t}| |j | ||j |_ |j dd|_|j |_|j|_|g|_ | |j d|_|jrdS|j S)NF) isinstancer$r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr' setFormatterrhandlers old_handlers old_level propagate old_propagater))rr. formatterhandlers r __enter__z_AssertLogsContext.__enter__+s d& 7 7 G#'#3 3FT[[#*#4T5E#F#F FFT[%d&9:: #%%$$$Y''' "OAAA.#-") ###  <  Frc|j|j_|j|j_|j|j|dS|jrSt|j j dkr4| d |j j dSdSt|j j dkrL| d tj|j|jjdSdS)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r5r.r4r8r7r2r6r)lenrr _raiseFailurerrr getLevelNamer'name)rexc_type exc_valuetbs r__exit__z_AssertLogsContext.__exit__?s#0  $ 2  T^,,,  5 < Q4<'((1,,""188 +-,4<'((A--""CVG0<NOOQQQQQ.-rN)rrrr r1rr;rDrrrr"r"sQ@@9N(QQQQQrr") r collectionscaser namedtuplerr r r"rrrrHs&&&&&&)+():*3X)>@@(((((((($:Q:Q:Q:Q:Q-:Q:Q:Q:Q:QrPK!j+%%,__pycache__/async_case.cpython-311.opt-2.pycnu[ 0iYNddlZddlZddlZddlZddlmZGddeZdS)N)TestCaseceZdZdfd ZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdfd ZfdZdZxZS)IsolatedAsyncioTestCaserunTestct|d|_tj|_dSN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s :/opt/alt/python311/lib64/python3.11/unittest/async_case.pyr z IsolatedAsyncioTestCase.__init__#s: $$$"#.#;#=#=   c KdSr rs r asyncSetUpz"IsolatedAsyncioTestCase.asyncSetUp(  rc KdSr rrs r asyncTearDownz%IsolatedAsyncioTestCase.asyncTearDown+rrc(|j|g|Ri|dSr ) addCleanuprfuncargskwargss raddAsyncCleanupz'IsolatedAsyncioTestCase.addAsyncCleanup.s) $1&11111rcK t|} |j}|j}n/#t$r"t d|jd|jddwxYw||d{V}|||ddd|S)N'.zC' object does not support the asynchronous context manager protocol)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r")rcmclsenterexitresults renterAsyncContextz)IsolatedAsyncioTestCase.enterAsyncContext=s 2hh 'NE=DD ' ' 'UUU1AUUU"& ' 'uRyy T2tT4888 s #,Ac|j|j|j||jdSr )r get_looprrunsetUp _callAsyncrrs r _callSetUpz"IsolatedAsyncioTestCase._callSetUpQsL $$&&&  $$TZ000 (((((rct||"tjd|dtddSdS)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethodz'IsolatedAsyncioTestCase._callTestMethodYsd    ' ' 3 M2(.2223ERS U U U U U U 4 3rcx||j|j|jdSr )r7rrr5tearDownrs r _callTearDownz%IsolatedAsyncioTestCase._callTearDown^s6 *+++  $$T]33333rc(|j|g|Ri|dSr )r=)rfunctionr r!s r _callCleanupz$IsolatedAsyncioTestCase._callCleanupbs+X777777777rcP|j||i||jSN)context)r r5rrs rr7z"IsolatedAsyncioTestCase._callAsynces<"&& D$ !& ! !,'   rctj|r'|j||i||jS|jj|g|Ri|SrJ)inspectiscoroutinefunctionr r5rrs rr=z'IsolatedAsyncioTestCase._callMaybeAsyncmsv  &t , , G&**d%f%%0+  04+/FtFFFvFF Frc>tjd}||_dS)NT)debug)asyncioRunnerr rrunners r_setupAsyncioRunnerz+IsolatedAsyncioTestCase._setupAsyncioRunnerws"d+++$rc<|j}|dSr )r closerSs r_tearDownAsyncioRunnerz.IsolatedAsyncioTestCase._tearDownAsyncioRunner|s$ rNc| t||S#|wxYwr )rUr r5rX)rr1rs rr5zIsolatedAsyncioTestCase.runsZ   """ *77;;v&&  ' ' ) ) ) )D ' ' ) ) ) )s A A"c|t|dSr )rUr rPrX)rrs rrPzIsolatedAsyncioTestCase.debugs>   """   ##%%%%%rc@|j|dSdSr )r rXrs r__del__zIsolatedAsyncioTestCase.__del__s+   *  ' ' ) ) ) ) ) + *r)rr )__name__r+r,r rrr"r2r8rBrErHr7r=rUrXr5rPr\ __classcell__)rs@rrr s=4>>>>>>        2 2 2()))UUU 444888   GGG%%% ******&&&&& *******rr)rQr rMr>caserrrrrr`s|E*E*E*E*E*hE*E*E*E*E*rPK!}3׶22(__pycache__/result.cpython-311.opt-1.pycnu[ 0iF!hdZddlZddlZddlZddlmZddlmZdZdZ dZ d Z Gd d e Z dS) zTest result objectN)utilwrapsTc<tfd}|S)Ncft|ddr||g|Ri|S)NfailfastF)getattrstop)selfargskwmethods 6/opt/alt/python311/lib64/python3.11/unittest/result.pyinnerzfailfast..inner sD 4U + +  IIKKKvd(T(((R(((r)rrs` rr r s3 6]]))))]) Lrz Stdout: %sz Stderr: %sceZdZdZdZdZdZddZdZdZ dZ dZ d Z d Z d Zed Zed ZdZdZdZdZedZdZdZdZdZdZdZdZdS) TestResultaHolder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. NFcd|_g|_g|_d|_g|_g|_g|_d|_d|_d|_ d|_ d|_ tj |_tj|_d|_dS)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccesses shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__zTestResult.__init__&s|     "#%  "" #  # "rcdS)z#Called by TestRunner after test runNr s r printErrorszTestResult.printErrors7rc\|xjdz c_d|_|dS)z-Called when the given test is about to be runrFN)rr& _setupStdoutr tests r startTestzTestResult.startTest:s2  " rc|jr[|j0tj|_tj|_|jt _|jt _dSdS)N)rr ioStringIOrr!r"r$r-s rr1zTestResult._setupStdout@sS ; -"*&(kmm#&(kmm#,CJ,CJJJ  - -rcdS)zpCalled once before any tests are executed. See startTest for a method called before each test. Nr,r-s r startTestRunzTestResult.startTestRunHr/rc<|d|_dS)z'Called when the given test has been runFN)_restoreStdoutr&r2s rstopTestzTestResult.stopTestNs" "rc|jrI|jrtj}tj}|r<|ds|dz }|jt|z|r<|ds|dz }|j t|z|jt_|j t_|j d|j |j d|jdSdS)N r)rr&r!r"getvaluer$endswithr#write STDOUT_LINEr% STDERR_LINErseektruncater )r outputerrors rr;zTestResult._restoreStdoutSs> ; +! E,,.. ++--F!??400'$)// f0DEEEE >>$//& )// e0CDDD.CJ.CJ   $ $Q ' ' '   ( ( * * *   $ $Q ' ' '   ( ( * * * * *% + +rcdS)zmCalled once after all tests are executed. See stopTest for a method called after each test. Nr,r-s r stopTestRunzTestResult.stopTestRunhr/rct|j||||fd|_dS)zmCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). TN)rappend_exc_info_to_stringr&r r3errs raddErrorzTestResult.addErrorns= D$":":3"E"EFGGG!rct|j||||fd|_dS)zdCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)rrKrLr&rMs r addFailurezTestResult.addFailurevs= dD$<$|j||fdS)zCalled when a test is skipped.N)rrK)r r3reasons raddSkipzTestResult.addSkips" T6N+++++rcf|j||||fdS)z/Called when an expected failure/error occurred.N)rrKrLrMs raddExpectedFailurezTestResult.addExpectedFailures? $$ 4++C66 7 9 9 9 9 9rc:|j|dS)z5Called when a test was expected to fail, but succeed.N)rrKr2s raddUnexpectedSuccesszTestResult.addUnexpectedSuccesss!  ''-----rct|jt|jcxkodknco(t|d pt|jdkS)z/Tells whether or not this result was a success.rr)lenrrhasattrrr-s r wasSuccessfulzTestResult.wasSuccessfulsj T]##s4;'7'7<<<<1<<<<5T#89994T-..!3 6rcd|_dS)z+Indicates that the tests should be aborted.TN)rr-s rr zTestResult.stops rcP|\}}}|||||}tj||||jd}t |}|jrtj }tj } |r7| ds|dz }| t|z| r7| ds| dz } | t| zd|S)z>Converts a sys.exc_info()-style tuple of values into a string.T)capture_localscompactr>)_clean_tracebacks tracebackTracebackExceptionrlistformatrr!r"r?r$r@rKrBrCjoin) r rNr3exctypevaluetbtb_emsgLinesrFrGs rrLzTestResult._exc_info_to_strings   # #GUB = =+ UB>4999 && ; 5Z((**FJ''))E 6t,,#dNF f 4555 5~~d++"TME e 3444wwx   rcd}d}|||fg}t|h}|r|\}}}|r3||r|j}|r||||jur|||r|}d}n||_|p|j|jfD]a} | ]t| |vrL| t| | | jf| t| b||S)NTF) idpop_is_relevant_tb_leveltb_nextrT_remove_unittest_tb_frames __traceback__ __cause__ __context__rKtypeadd) r rorprqr3retfirstexcsseencs rrizTestResult._clean_tracebackssC%$%5 { (#'88:: WeR 33B77 Z 33B77 $/////333 )&(# /5+<=((A}Ad):): T!WWa$ABBBA) (* rcd|jjvS)N __unittest)tb_frame f_globals)r rqs rrwz TestResult._is_relevant_tb_levelsr{444rcd}|r5||s |}|j}|r|| | d|_dSdS)aTruncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified. N)rwrx)r rqprevs rryz%TestResult._remove_unittest_tb_framessl 33B77 DB 33B77   DLLL  rcdtj|j|jt |jt |jfzS)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rrarrr-s r__repr__zTestResult.__repr__s@3 dn--t}c$+>N>NDM""$$ %r)NNN)__name__ __module__ __qualname____doc___previousTestClass_testRunEntered_moduleSetUpFailedr*r.r4r1r9r<r;rIr rOrQrVrXr[r]r_rcr rLrirwryrr,rrrrs  O####"... ---   ### +++*   ""X"""X" &&&"   ,,,999 ..X.666!!!,8555    %%%%%rr)rr6r!rjrhr functoolsrrr rBrCobjectrr,rrrs     \%\%\%\%\%\%\%\%\%\%rPK!xjǪǪ&__pycache__/mock.cpython-311.opt-2.pycnu[ 0iH`dZddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZGdd eZd eeDZd ZeZd Zd ZdZdZdZ dZ!dydZ"dZ#dZ$dZ%dZ&dydZ'dZ(dZ)dZ*Gdde+Z,Gdde+Z-e-Z.e.j/Z/e.j0Z1e.j2Z3hd Z4d!Z5Gd"d#e6Z7d$Z8Gd%d&e+Z9Gd'd(e+Z:Gd)d*e:Z;ej<e;j=Z>Gd+d,e6Z?d-Z@Gd.d/e:ZAGd0d1eAe;ZBd2ZCGd3d4e+ZDd5ZEe/dddddfdd6d7ZF dzd8ZGe/dddddfdd6d9ZHGd:d;e+ZId<ZJd=ZKeFeH_+eIeH_LeGeH_MeKeH_Nd>eH_Od?ZPd@ZQdARdBeQSDZTdARdCeQSDZUhdDZVdEZWdFdARePeQeTeUgSDZXhdGZYdHhZZeYeZzZ[eXeVzZ\e\e[zZ]hdIZ^dJdKdLdMdNZ_e`e`e`e`dOddddPdQd dOddR ZadSZbdTZcdUZddVZeebecedeedWZfdXZgGdYdZe:ZhGd[d\ehe;ZiGd]d^ehZjGd_d`eheBZkGdadbe:ZlGdcdde:ZmGdedfemejeBZnGdgdhe+ZoeoZpdiZqGdjdkerZsesdlZt d{dd6dmZudnZvGdodpe+ZwexeuexepjyfZzda{da|dqZ}d|dsZ~GdtdueBZdvZGdwdxZdS)})Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockceZdZdS)InvalidSpecErrorN__name__ __module__ __qualname__4/opt/alt/python311/lib64/python3.11/unittest/mock.pyrr)sBBr!rc<h|]}|d|S_ startswith).0names r" r*-s) H H Hd4??33G3G HT H H Hr!Tct|rt|tsdSt|drt |d}t |pt j|S)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r" _is_async_objr55sgji&@&@usJ'c:&& s # # ?w':3'?'??r!cFt|ddrt|SdS)N__code__F)r0r)funcs r"_is_async_funcr9=s)tZ&&"4(((ur!cFtt|tSN) issubclasstyper r3s r"r-r-Ds d3ii 1 11r!ct|tp)t|tot|tSr;)r. BaseExceptionr=r<r3s r" _is_exceptionr@Js63 && A3@*S-"@"@r!c^t|trt|dr|jS|SNmock)r. FunctionTypesr/rCr3s r" _extract_mockrEQs3#}%%'#v*>*>x r!c t|tr |s |j}d}njt|ttfrt|trd}|j}n/t|t s |j}n#t$rYdSwxYw|rt|d}n|} |tj |fS#t$rYdSwxYwNT) r.r=__init__ classmethod staticmethodr,rD__call__AttributeErrorrr1 signature ValueError)r8 as_instanceeat_selfsig_funcs r"_get_signature_objectrRZs $k} D; 5 6 6  dK ( ( H} m , , =DD   44 4&&W&x0000 tts$4A<< B  B #B99 CCFct|||dS\}fd}t|||t|_t|_dS)Nc"j|i|dSr;bind)selfargskwargssigs r"checksigz"_check_signature..checksig $!&!!!!!r!)rR_copy_func_detailsr=_mock_check_sig __signature__)r8rC skipfirstinstancer[rZs @r"_check_signaturerb}sr h : :C {ID#"""""tX&&&!)DJJ"DJJr!c pdD]2} t||t||##t$rY/wxYwdS)N)r__doc____text_signature__r __defaults____kwdefaults__)setattrr0rL)r8funcopy attributes r"r]r]sa   GYi(@(@ A A A A    D  s & 33ct|trdSt|tttfrt |jSt|dddSdS)NTrKF)r.r=rJrIr _callabler,r0r3s r"rlrls^#tt# k:>??'&&&sJ%%1t 5r!c<t|ttfvSr;)r=listtupler3s r"_is_listrps 99u %%r!c t|tst|ddduS|f|jzD]}|jddS dS)NrKTF)r.r=r0__mro____dict__get)r4bases r"_instance_callablervsr@ c4 :sJ--T99$ =  Z ( ( 444 5 5r!c0 t|t}t|||}||S|\} fd}t|||j}|sd}||d}d|z} t | |||} t| | | S)Nc"j|i|dSr;rU)rXrYrZs r"r[z _set_signature..checksigr\r!ri) _checksig_rCzYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r.r=rRr]r isidentifierexec _setup_func) rCoriginalrar`resultr8r[r)contextsrcrirZs @r"_set_signaturers 8T**I "8Xy A AF ~ ID#"""""tX&&&  D     %t44G $&* +C #wdmGs### Nr!c_fd}fd}fd}fd}fd}fd}fd} fd} d _d _d_t _t _t _j_j _ j _ |_ |_ |_ | _| _|_|_|_|__dS) Ncj|i|Sr;)assert_called_withrXrYrCs r"rz'_setup_func..assert_called_with&t&7777r!cj|i|Sr;) assert_calledrs r"rz"_setup_func..assert_calleds!t!426222r!cj|i|Sr;)assert_not_calledrs r"rz&_setup_func..assert_not_calleds%t%t6v666r!cj|i|Sr;)assert_called_oncers r"rz'_setup_func..assert_called_oncerr!cj|i|Sr;)assert_called_once_withrs r"rz,_setup_func..assert_called_once_withs+t+T.assert_has_callss$t$d5f555r!cj|i|Sr;)assert_any_callrs r"rz$_setup_func..assert_any_calls#t#T4V444r!ct_t_j}t |r|ur|dSdSdSr;) _CallList method_calls mock_calls reset_mock return_valuer-)retrirCs r"rz_setup_func..reset_mockso({{&[[ " S ! ! #++ NN       ++r!Fr)rCcalled call_count call_argsrcall_args_listrrr side_effect_mock_childrenrrrrrrrrr__mock_delegate) rirCrZrrrrrrrrs `` r"r|r|sGL88888333337777788888=====6666655555GNGG&[[G$;;G"G,G*G!0G!3G&=G#/G-G#G)G 1G!3GG!Dr!c tjj_d_d_t _fd}dD]!}t|t||"dS)Nrc:tj||i|Sr;)r0rC)attrrXrYrCs r"wrapperz"_setup_async_mock..wrapper s$'wty$''8888r!)assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listrhr)rCrrjs` r"_setup_async_mockrs +9DDDO$;;D 99999, > >  i)! >r!c$d|ddz|kS)N__%s__r r)s r" _is_magicrs d1R4j D ((r!c"eZdZ dZdZdZdS)_SentinelObjectc||_dSr;rrWr)s r"rHz_SentinelObject.__init__"s  r!cd|jzSNz sentinel.%srrWs r"__repr__z_SentinelObject.__repr__%ty((r!cd|jzSrrrs r" __reduce__z_SentinelObject.__reduce__(rr!N)rrrrHrrr r!r"rr sD'))))))))r!rc"eZdZ dZdZdZdS) _Sentinelci|_dSr;) _sentinelsrs r"rHz_Sentinel.__init__.s r!cl|dkrt|j|t|S)N __bases__)rLr setdefaultrrs r" __getattr__z_Sentinel.__getattr__1s3 ;   ))$0E0EFFFr!cdS)Nrr rs r"rz_Sentinel.__reduce__7szr!N)rrrrHrrr r!r"rr,sGKGGG r!r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecxt|d|z}||fd}||fd}t||S)N_mock_cT|j}|t||St||Sr;)rr0)rWr) _the_namerZs r"_getz"_delegating_property.._getLs/! ;4++ +sD!!!r!cR|j}| ||j|<dSt|||dSr;)rrsrh)rWvaluer)rrZs r"_setz"_delegating_property.._setQs9! ;',DM) $ $ $ Cu % % % % %r!)_allowed_namesaddproperty)r)rrrs r"_delegating_propertyrIset4I """" $y&&&& D$  r!ceZdZdZdZdS)rct|tst||St|}t|}||krdSt d||z dzD]}||||z}||krdSdS)NFrT)r.rn __contains__lenrange)rWr len_valuelen_selfisub_lists r"rz_CallList.__contains__^s%&& 2$$T511 1JJ t99 x  5q(Y.233  AAa kM*H5  tt!ur!cDtjt|Sr;)pprintpformatrnrs r"rz_CallList.__repr__ls~d4jj)))r!N)rrrrrr r!r"rr\s2   *****r!rct|}t|sdS|js|js|j|jdS|}|||urdS|j}||r||_||_|r||_||_dS)NFT)rEr-rrrr)parentrr)new_name_parents r"_check_and_set_parentrps % E U # #u  U1   '   +uG   e  5*  (!''  # 4r!ceZdZdZdZdS) _MockIterc.t||_dSr;)iterr4)rWr4s r"rHz_MockIter.__init__s99r!c*t|jSr;)nextr4rs r"__next__z_MockIter.__next__sDH~~r!N)rrrrHrr r!r"rrs2r!rceZdZeZdZdZdS)BaseNcdSr;r rWrXrYs r"rHz Base.__init__s r!)rrrrrrrHr r!r"rrs/      r!rceZdZ eZdZ d,dZdZd-dZ d.dZ d Z d Z d Z e e e e Ze d Zed ZedZedZedZedZdZdZe eeZd/ddddZdZdZdZdZdZdZdZ dZ!d0dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d-d'Z*d(Z+d)Z,d1d+Z-dS)2r cz|f}t|ts]tj|g|Ri|j}|d|d}|t |r t|f}t|j|d|j i}tt| |}|S)Nspec_setspecrd) r<AsyncMockMixin _MOCK_SIG bind_partial argumentsrtr5r=rrd _safe_superr __new__)clsrXkwbases bound_argsspec_argnewras r"rzNonCallableMock.__new__s#~.. ."/AdAAAbAAKJ!~~j*..2H2HIIH# h(?(?#'-3<CK(@AA44<>d.6&& D'C!$D  r!cb|j||j_dS||_t||dddS)Nr0)rrrr)rWrs r"__set_return_valuez"NonCallableMock.__set_return_value%s>   */4D  , , ,&+D # !$tT : : : : :r!z1The value to be returned when the mock is called.c<|jt|S|jSr;)r'r=rs r" __class__zNonCallableMock.__class__1s   #:: r!rrrrrc|j}||jS|j}|It|s:t |t s%t |st |}||_|Sr;)rrrcallabler.rr@)rW delegatedsfs r"__get_side_effectz!NonCallableMock.__get_side_effect>sj'  ) )  " N8B<z0NonCallableMock.configure_mock..sq1D1Dr!)keyrJ)sorteditemssplitpopr0rh)rWrYargvalrXfinalr4rLs r"rzNonCallableMock.configure_mockrs ,v||~~$E#D FFF % %HC 99S>>DHHJJEC * *c5)) C $ $ $ $ % %r!c |dvrt||j%||jvs |tvrtd|znt|rt||js:|jr ||jvr*|drt|d|dt j5|j |}|turt||Cd}|j t|j |}| |||||}||j|<nt|trv t!|j|j|j|j|j}n>#t,$r1|jdp|}t-d|d |d |d |jd wxYw||j|<dddn #1swxYwY|S) N>rr*zMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)rr)rrrrCannot autospec attr from target , as it has already been mocked out. [target=, attr=r&)rLr* _all_magicsrrr'r _lockrrtrErr0r2r.rDr rrrarr)rrs)rWr)r~r target_names r"rzNonCallableMock.__getattr__s 4 4 4 && &   +4---1D1D$%F%MNNN2E t__ ' && &  N$*< NDL^@^@^OPP N$MM'+MMMNNN " 4 4(,,T22F!!$T***#/$D$4d;;E--d%4 $..4#D))FJ// 4 D, V_fo v{FF(DDD"&- "="EK*CCC&CC#'CC28+CCCDDDD .4#D); 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4> s++B F:9,E&%F:&;F!! F::F>F>cn|jg}|j}|}d}|dgkrd}|7|}||j|zd}|jdkrd}|j}|7tt |}|jpd}t |dkr|ddvr|dz }||d<d|S)NrJr0r rCr)r0z().r)rrr-rnreversedrrjoin)rW _name_listrlastdot_firsts r"_extract_mock_namez"NonCallableMock._extract_mock_names)* ' $  C!D   g4s: ; ; ;C%--.G!(:..// *F z??Q  !}M11#  1 wwz"""r!c|}d}|dvrd|z}d}|jd}|jrd}||jjz}dt |j||dt |dS) Nr )rCzmock.z name=%rz spec=%rz spec_set=%r)rjr'r(rr=rB)rWr) name_string spec_strings r"rzNonCallableMock.__repr__s&&(( ( ( ($t+K   '$K~ -, %(8(AAK JJ   K KK tHHHH   r!cx tst|S|jpg}t t |}t |j}d|j D}d|D}d|D}tt||z|z|zS)Nc*g|]\}}|tu|Sr )rE)r(m_namem_values r" z+NonCallableMock.__dir__..s1(((&vwh&& &&&r!c<g|]}|d|Sr$r&r(es r"rsz+NonCallableMock.__dir__..s)CCC1c1B1BCQCCCr!cZg|](}|drt|&|)Sr$)r'rrus r"rsz+NonCallableMock.__dir__..sE###1c1B1B#q\\#Q###r!) r object__dir__r*r,r=rnrsrrPrOset)rWextras from_type from_dictfrom_child_mockss r"ryzNonCallableMock.__dir__sF (>>$'' '#)rT OO '' ((*.*=*C*C*E*E(((DC CCC ## ### c&9,y8;KKLLMMMr!cT|tvrt||Sjr+j$|jvr|jvrt d|z|tvrd|z}t ||tvrj|jvrt d|zt|s5tt|t|||fd}nft|d|tt|||j|<n+|dkr |_dSt|||r |j|<jr;t#|s+d|}t d|t||S)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.cg|Ri|Sr;r )rXrr}rWs r"rMz-NonCallableMock.__setattr__.. s!HHT,GD,G,G,GB,G,Gr!r7rJz Cannot set )rrx __setattr__r(r*rsrL_unsupported_magicsr`r-rhr= _get_methodrrr'rr/rj)rWr)rmsg mock_namer}s` @r"rzNonCallableMock.__setattr__s > ! !%%dD%88 8n 2!3!? * * *  % % !Dt!KLL L ( ( (BTIC %% % [ !-$d>P2P2P$%H4%OPPP$U++ 2T D+dE*B*BCCC GGGGG&dE4>>>T D%000,1#D)) [ $D  F$T5$== 2,1#D)   |t|jvr(tt||||jvrdS|j|t }||jvr)tt| |n|turt||t ur|j|=t|j|<dSr;) r`r=rsdelattrrrt_missingrr __delattr__rErL)rWr)r4s r"rzNonCallableMock.__delattr__!s ;  44::+>#>#> DJJ % % %4=((!%%dH55 4=  . . : :4 @ @ @ @ H__ && & h  #D)$,D!!!r!c6|jpd}t|||SrB)r_format_call_signaturerWrXrYr)s r"_format_mock_call_signaturez+NonCallableMock._format_mock_call_signature3s (&%dD&999r!rcdd}|||}|j}|j|}||||fzS)Nz0expected %s not found. Expected: %s Actual: %s)rr)rWrXrYactionmessageexpected_stringr actual_strings r"_format_mock_failure_messagez,NonCallableMock._format_mock_failure_message8sDF::4HHN 88)D &/=AAAr!c |s|jSd}|ddd}|j}|D]M}||}|t |t rnt|}|j}|j}N|S)Nr0r rJ)r)replacerQrrtr.rDrE)rWr)rZnameschildrenrGs r"_get_call_signature_from_namez-NonCallableMock._get_call_signature_from_name@s  (' ' T2&&,,S11& , ,DLL&&E} 5* = =} &e,, /+ r!c t|tr/t|dkr||d}n|j}|vt|dkrd}|\}}n|\}}} |j|i|}t ||j|jS#t$r}| dcYd}~Sd}~wwxYw|S)Nrrr ) r.rorrr)rVrrXrY TypeErrorwith_traceback)rW_callrZr)rXrY bound_callrvs r" _call_matcherzNonCallableMock._call_matcheras  eU # # 'E Q44U1X>>CC&C ?5zzQ$ ff%*"dF .%SXt6v66 D*/:3DEEE . . .''-------- .Ls1'B C#B=7C=Cc |jdkr8d|jpdd|jd|}t|dS)Nr Expected 'rCz"' to not have been called. Called  times.rr _calls_reprAssertionErrorrWrs r"rz!NonCallableMock.assert_not_called|sa ?a   o///ooo&&(((*C!%% % r!cT |jdkrd|jpdz}t|dS)Nrz"Expected '%s' to have been called.rC)rrrrs r"rzNonCallableMock.assert_calleds> ?a  7O-v/C %% % r!c |jdks8d|jpdd|jd|}t|dS)NrrrCz#' to have been called once. Called rrrs r"rz"NonCallableMock.assert_called_oncesa !###o///ooo&&(((*C!%% % $#r!cv j/}d}d|d|}t|fd}t fd}j}||kr1t |t r|nd}t||dS)Nz not called.z#expected call not found. Expected: z Actual: c4}|Sr;rrrXrYrWs r"_error_messagez:NonCallableMock.assert_called_with.._error_messages33D&AACJr!Ttwo)rrrr_Callr. Exception)rWrXrYexpectedactual error_messagercauses``` r"rz"NonCallableMock.assert_called_withs 3 > !77fEEH"FFxx)M // /       %%eT6N&E&E&EFF##DN33 X   *8Y ? ?IHHTE !1!122 =  r!c |jdks8d|jpdd|jd|}t||j|i|S)NrrrCz' to be called once. Called r)rrrrrrWrXrYrs r"rz'NonCallableMock.assert_called_once_withsq )!###o///ooo&&(((*C!%% %&t&7777r!c fd|D}td|Dd}tfdjD}|su||vro|d}ndd|D}t |dt|d d |dSt|}g}|D]=} ||#t$r| |Y:wxYw|r-t j pd d t|d |d|dS)Nc:g|]}|Sr rr(crWs r"rsz4NonCallableMock.assert_has_calls..'999aD&&q))999r!c3DK|]}t|t|VdSr;r.rrus r" z3NonCallableMock.assert_has_calls..1FFAZ9-E-EFaFFFFFFr!c3BK|]}|VdSr;rrs r"rz3NonCallableMock.assert_has_calls..s1MMd0033MMMMMMr!zCalls not found.z+Error processing expected calls. Errors: {}c@g|]}t|tr|ndSr;rrus r"rsz4NonCallableMock.assert_has_calls..;$7$7$7()*4Ay)A)A$KAAt$7$7$7r! Expected: z Actual)prefixrJrCz does not contain all of z in its call list, found z instead) rrrformatrrrstriprnremoverNr-rro) rWcalls any_orderrr all_callsproblem not_foundkalls ` r"rz NonCallableMock.assert_has_callss 1:9995999FFFFFMMMMMMT_MMMMM  y((=0GG ,-3V$7$7-5$7$7$7.8.8%II!*5!1!1I''z'::AA#FFII  FOO   ' 'D '  &&&& ' ' '  &&&&& '   &*o&?&?&?&+I&6&6&6&6 C    sC..DDc& t||fd}t|tr|nd}fdjD}|s|t |vr)||}td|z|dS)NTrc:g|]}|Sr rrs r"rsz3NonCallableMock.assert_any_call..s'EEEA$$$Q''EEEr!z%s call not found)rrr.rr _AnyComparerrrrWrXrYrrrrs` r"rzNonCallableMock.assert_any_calls , %%eT6N&E&E&EFF&x;;EEEEE1DEEE  HL$8$888">>tVLLO #o5 98r!c  |jr7d|vr d|dnd}||z}t||d}||jdvr t di|St |}t|tr|tvrt }nt|tr)|tvs|j r||j vrt}ndt }n\t|ts:t|trt}n*t|trt }n |jd}|di|S)Nr)rJr0rr+rr )rrjrLrtrsr r=r<r_async_method_magicsr_all_sync_magicsr* CallableMixinr r rrr)rWrrjrr_typeklasss r"r2zNonCallableMock._get_child_mocks` !   ,,2bLL(BvJ(((dI//11I=I ++ +FF;''  n5 5 5??r?? "T  eY ' ' %I9M,M,MEE ~ . . %---&.+48J+J+J!!E=11 %%!566 !E?33 M!$Eu{{r{{r!CallscL |jsdSd|dt|jdS)Nr  z: rJ)rr)rWrs r"rzNonCallableMock._calls_reprs;  2;F;;i88;;;;r!) NNNNNNr NFNFF)FFr;)r)r).rrrrrarrHr!r$r"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr7rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrrrrrjrryrrrrrrrrrrrrrr2rr r!r"r r s* EGGE   ">BEI   ;;;M8.0B.00L  X " !( + +F%%l33J$$[11I))*:;;N%%l33J   ***(,.?@@K$u%$$$$$<%%%,---`###6   *NNN$$5$5$5N---$::: BBBBB6&&&&&&&&&>>>, 8 8 8****Z    ###L < < < < < .5s1$HfF"r!TF)allzip)rWitemrs r"rz_AnyComparer.__contains__2s^  E(+D%(8(8 tt   ur!N)rrrrr r!r"rr-s(r!rc||St|r|St|r|S t|S#t$r|cYSwxYwr;)r@rlrrr3s r"r>r>=sk { S ~~ Cyy  s7 AAc HeZdZddedddddddf dZdZdZdZdZdZ dS) rNr c x||jd<tt|j||||||| | fi| ||_dS)Nr)rsrrrHr) rWrrrrr)rrrrrrYs r"rHzCallableMixin.__init__Nsa/; *+1 M4((1 %x K  39   'r!cdSr;r rs r"r^zCallableMixin._mock_check_sigZs r!cP|j|i||j|i||j|i|Sr;)r^_increment_mock_call _mock_callrs r"rKzCallableMixin.__call___sK d-f---!!426222t////r!c|j|i|Sr;)_execute_mock_callrs r"rzCallableMixin._mock_callgs&t&7777r!c~d|_|xjdz c_t||fd}||_|j||jdu}|j}|j}|dk}|j td||f|j }||rB|j t|||f|jdu}|r |jdz|z}t|||f} |j | |jr|rd} nd} |jdk}|j| z|z}|j }|dSdS)NTrrr0r rJ) rrrrrr-rrrrrr) rWrXrYrdo_method_callsmethod_call_namemock_call_name is_a_callrthis_mock_callrhs r"rz"CallableMixin._increment_mock_calljs  1 tVn$/// ""5)))+47?,"d*  ub$%788999+ % W(//7Gv6V0W0WXXX"-":$"F"W'2'='CFV'V$#ND&#ABBN  " ) ). 9 9 9) SCCC'6$> !,!;c!AN!R&6K-%%%%%r!c^|j}|Tt|r|t|s!t|}t|r|n||i|}|tur|S|jtur|jS|jr|jjtur|jS|j |j|i|S|jSr;) rr@rlrrrrrr)rWrXrYeffectr~s r"rz CallableMixin._execute_mock_calls!  V$$ 1 v&& 1f ((! L! 000W$$  "' 1 1$ $   %4#6#C7#R#R$ $   '#4#T4V44 4  r!) rrrrrHr^rKrrrr r!r"rrLs d$d!RT ' ' ' '   000888,7,7,7\!!!!!r!rceZdZdS)rNrr r!r"rrs55r!rc@d}|D]}||vrt|ddS)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r"_check_spec_arg_typosrsN 2E ? " "PPP  #r!c~eZdZdZgZdddZdZdZdZe j dZ d Z d Z d Zd Zd ZdZdZdS)_patchNFrc |)|turtd|td| st| t|rt d|d|dt|rt d|d|d||_||_||_||_||_ ||_ d|_ ||_ ||_ | |_g|_dS)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=r&z? as the spec_set target has already been mocked out. [spec_set=F)rrNrr-rgetterrjr  new_callablercreate has_localrautospecrYadditional_patchers) rWrrjr rr rr rrYrs r"rHz_patch.__init__sV  #'!! B# G * !& ) ) ) T " " A"@I@@6:@@@AA A X & & P"OIOOAIOOOPP P "(       #%   r!c t|j|j|j|j|j|j|j|j|j }|j |_ d|j D|_ |S)Nc6g|]}|Sr )copy)r(ps r"rsz_patch.copy..,s-' ' ' AFFHH' ' ' r!) rrrjr rr rr rrYattribute_namer )rWpatchers r"rz _patch.copy%sq K49 K M4,dk   "&!4' ' "6' ' ' #r!ct|tr||Stj|r||S||Sr;r.r=decorate_classr1rdecorate_async_callabledecorate_callable)rWr8s r"rKz_patch.__call__2sc dD ! ! -&&t,, ,  &t , , 6//55 5%%d+++r!ct|D]q}|tjs"t ||}t |dsC|}t||||r|SNrK)r,r'r TEST_PREFIXr0r/rrh)rWrr attr_valuers r"rz_patch.decorate_class:sJJ 6 6D??5#455  --J:z22 iikkG E4!4!4 5 5 5 5 r!c#TKg}tj5}|jD]W}||}|j||4|jtur||X|t|z }||fVddddS#1swxYwYdSr;) contextlib ExitStack patchings enter_contextrupdater rr-ro)rWpatchedrXkeywargs extra_args exit_stackpatchingrSs r"decoration_helperz_patch.decoration_helperHs  ! # # #z#- + + ..x88*6OOC((((\W,,%%c*** E*%% %D" " " " # # # # # # # # # # # # # # # # # #sA8BB!$B!ctdrjStfdg_S)Nrc|||5\}}|i|cdddS#1swxYwYdSr;r'rXr#newargs newkeywargsr8r"rWs r"r"z)_patch.decorate_callable..patched]s''(,(022 55Kg{tW4 44 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s 155r/rr-rrWr8r"s``@r"rz_patch.decorate_callableWsv 4 % %  N ! !$ ' ' 'K t 5 5 5 5 5 5  5 "Fr!ctdrjStfdg_S)NrcK||5\}}|i|d{VcdddS#1swxYwYdSr;r*r+s r"r"z/_patch.decorate_async_callable..patchedns''(,(022 ;5Kg{!T7:k:::::::: ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;s 9==r.r/s``@r"rz_patch.decorate_async_callablehsv 4 % %  N ! !$ ' ' 'K t ; ; ; ; ; ;  ; "Fr!c`|}|j}t}d} |j|}d}n-#tt f$rt ||t}YnwxYw|tvrt|trd|_ |j s|turt |d|||fS)NFTz does not have the attribute ) rrjrrsrLKeyErrorr0 _builtinsr.rr )rWtargetr)r}locals r" get_originalz_patch.get_originalys~ t,HEE) 6 6 6vtW55HHH 6 9  FJ!?!? DK{ x722 7=vvttD s 6'A A c  |j|j|j}}}|j|j}}|j}||_|durd}|durd}|durd}||td|||dvrtd| \}}|tur|d} |dur |}|dur|}d}n| |dur|}d}n|dur|}||/|turtdt|trd} |t|rt} nt} i} ||} nN||J|} ||} t!| rd| v} nt#|  } t| rt} n | rt$} ||| d<||| d <t| tr&t'| t(r|jr |j| d <| || di| }| r_t/|rP|} ||} t!| st1| st$} | d | d|d d | |_n||turtd |turtdt7|}|dur|}t/|jr#t9d|jd|jd|dt/|rAt;|jd|j}t9d|jd|d|jd|d t=|f||jd|}n|rtd|}||_||_ tCj"|_# tI|j|j||j%ci}|jtur |||j%<|j&D]?}|j#'|}|jtur||@|S|S#|j(tSj*sYdSxYw)NFzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerKrrr)r0r1zBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=Truer\z: as the patch target has already been mocked out. [target=r_r&rr]r^)r_namez.Can't pass kwargs to a mock we aren't creatingr )+r rrr rYrrr5rr7rr.r=r5r rrpr9r r<r rjr!r-rvrRrboolrr0r temp_originalis_localrr _exit_stackrhrr r __exit__sysexc_info)rWr rrr rYrr}r6inheritKlass_kwargs this_spec not_callablerbnew_attrr$r&rSs r" __enter__z_patch.__enter__s "h 4=8T=$+&( kkmm  5==D u  H u  H   4=>> >  !5 L ( (TUU U++--% '>>h.Gt||t##'HD!t###HDT!!#8#7w&&#$GHHHh--#"G| h 7 7|!!G'$!X%9 ' (II&&;#-Y#>LL'/ ':':#:L ++1%EE!10E"&#&. #5$'' 15/22 17;~ 1"&. NN6 " " "%""'""C 4,S11 4! ' (I ++1&y1110E F####(5$4SD$4$4+2$4$4  !'!!(7"" GHHHH~~H4# -- D&CDNCC#{CC5=CCCDDD!** D%dk:t{KK &CDNCC"CC#{CC5=CCCDDD "(BX(,BB:@BBCC  NLMM M% %/11  DK : : :". 8w&&7:Jt23 $ 8//H*88BBC|w.."))#...!!J  4=#,..1    sBOOO=cj |jr/|jtur!t|j|j|jndt |j|j|jsCt|j|jr |jdvr t|j|j|j|`|`|`|j }|` |j |S)N)rdrrf__annotations__rg) r<r;rrhr5rjrr r/r=r>)rWr@r%s r"r>z_patch.__exit__#s = IT/w>> DK1C D D D D DK 0 0 0; I T^(L(L I+=== T^T5GHHH   M K%  "z"H--r!cd |}|j||Sr;)rG_active_patchesr-rWr~s r"startz _patch.start8s0;!! ##D))) r!c |j|n#t$rYdSwxYw|dddSr;)rKrrNr>rs r"stopz _patch.stop?s^#   ' ' - - - -   44 }}T4...s  ,,)rrrrrKrHrrKrrcontextmanagerr'rrr7rGr>rMrOr r!r"rrsNOAF"&"&"&"&"&J   ,,,    # # #""0PPPd...*/////r!rc |dd\}}n-#tttf$rtd|wxYwt t j||fS)NrJrz,Need a valid target to patch. You supplied: )rsplitrrNrLrpkgutil resolve_name)r5rjs r" _get_targetrUKsG"MM#q11 z> 2GGG E6 E EGG GG 7' 0 0) ;;s *Arc tturtdfd} t| |||||||| | S)Nz3 must be the actual object to be patched, not a strcSr;r r5sr"rMz_patch_object..jsVr!r)r=strrr) r5rjr rr rr rrrYrs ` r" _patch_objectrZTss  F||s L L L   ^^^F  3f(L&   r!c  tturttj}nfd}|st dt |}|d\} } t|| | |||||i } | | _ |ddD]=\} } t|| | |||||i } | | _ | j | >| S)NcSr;r rXsr"rMz!_patch_multiple..sr!z=Must supply at least one keyword argument with patch.multiplerr) r=rYrrSrTrNrnrPrrr r-) r5rr rr rrYrrPrjr r this_patchers ` r"_patch_multipler^qs( F||s-v66   K     E1XNIs 3fh,G'G)99 3 IsD&( lB  '0 ##**<8888 Nr!c Z t|\} } t| | |||||||| S)Nr)rUr) r5r rr rr rrrYrrjs r"rrsJFN$F++FI  3f(L&   r!cTeZdZ ddZdZdZdZdZdZd Z d Z d Z d Z d Z dS) _patch_dictr Fc ||_t||_|j|||_d|_dSr;)in_dictdictrCr!clear _original)rWrcrCrerYs r"rHz_patch_dict.__init__s> 6ll  6""" r!ct|tr||Stj|r||S||Sr;r)rWfs r"rKz_patch_dict.__call__sc a   *&&q)) )  &q ) ) 3//22 2%%a(((r!c@tfd}|S)Nc |i|S#wxYwr;ra _unpatch_dictrXrrhrWs r"_innerz-_patch_dict.decorate_callable.._inner#sV       %q$~"~~""$$$$""$$$$s 3A rrWrhrns`` r"rz_patch_dict.decorate_callable"9 q % % % % %  % r!c@tfd}|S)NcK |i|d{V S#wxYwr;rkrms r"rnz3_patch_dict.decorate_async_callable.._inner/so       %Q^^^+++++++""$$$$""$$$$s <Arorps`` r"rz#_patch_dict.decorate_async_callable.rqr!c t|D]}}t||}|tjrLt |dr"/ ==DL,  -||~~HH - - -H - - '   - -  - "  !   + NN6 " " " " " + + + + +%c{  + + + +s$A$$BBB66CCc|j}|j}t| ||dS#t$r|D] }||||<YdSwxYwr;)rcrfryr!rL)rWrcr}rNs r"rlz_patch_dict._unpatch_dictgs,>G - NN8 $ $ $ $ $ - - - - -'}  - - - -s6AAc> |j|dSNF)rfrl)rWrXs r"r>z_patch_dict.__exit__ts$ > %    ur!cn |}tj||Sr;)rGrrKr-rLs r"rMz_patch_dict.start{s0;!!%%d+++ r!c tj|n#t$rYdSwxYw|dddSr;)rrKrrNr>rs r"rOz_patch_dict.stops^#   " ) )$ / / / /   44 }}T4...s # 11N)r F)rrrrHrKrrrrGrarlr>rMrOr r!r"raras8)))       +++8 - - -/////r!rac |dS#t$rt|}|D]}||=YdSwxYwr;)rerLrn)rckeysrNs r"ryryse  G}}  C    s !==ch ttjD]}|dSr;)rdrrKrO)rs r"_patch_stopallrs8A&011 r!testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c# K|] }d|zV dS)zi%sNr r(ns r"rrs&77519777777r!c# K|] }d|zV dS)zr%sNr rs r"rrs&55q555555r!>ry__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c" fd}||_|S)Nc|g|Ri|Sr;r )rWrXrr8s r"methodz_get_method..methods#tD&4&&&2&&&r!)r)r)r8rs ` r"rrs+@'''''FO Mr!ch|]}d|zS)rr )r(rs r"r*r*s*    Hv   r!> __aexit__ __anext__ __aenter__ __aiter__>__del__rrHr __prepare__r__instancecheck____subclasscheck__c6t|Sr;)rx__hash__rs r"rMrMsV__T22r!c6t|Sr;)rx__str__rs r"rMrMsFNN400r!c6t|Sr;)rx __sizeof__rs r"rMrMsv0066r!cxt|jd|dt|S)N/)r=rrjrBrs r"rMrMs;$t**"5^^8O8O8Q8Q^^TVW[T\T\^^r!)rrr __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r> __complex__ __float____bool__ __index__rcfd}|S)NcLjj}|tur|S|urdStSrG)__eq__rrNotImplemented)otherret_valrWs r"rz_get_eq..__eq__s1+0 ' ! !N 5==4r!r )rWrs` r"_get_eqrs# Mr!cfd}|S)NcRjjturtS|urdStSr|)__ne__rrr)rrWs r"rz_get_ne..__ne__s, ; ) 8 8N 5==5r!r )rWrs` r"_get_ners# Mr!cfd}|S)Ncjjj}|turtgSt|Sr;)__iter__rrrrrWs r"rz_get_iter..__iter__s1-2 g  88OG}}r!r )rWrs` r" _get_iterr s# Or!cfd}|S)Ncjj}|turtt gStt |Sr;)rrr_AsyncIteratorrrs r"rz"_get_async_iter..__aiter__s@.3 g  !$r((++ +d7mm,,,r!r )rWrs` r"_get_async_iterrs$----- r!)rrrrc&t|t}|tur ||_dSt|}|||}||_dSt |}||||_dSdSr;)_return_valuesrtrr_calculate_return_value_side_effect_methodsr)rCrr)fixedreturn_calculatorr side_effectors r"_set_return_valuer(s   tW - -E G#/33D99$((.. *(,,T22M *]400! r!ceZdZdZdZdS) MagicMixinc|tt|j|i||dSr;)_mock_set_magicsrrrHrWrXrs r"rHzMagicMixin.__init__;sN . J%%.;;;; r!c ttz}|}t|ddX||j}t }||z }|D](}|t |jvrt||)|t t |jz }t |}|D]!}t||t||"dS)Nr*) _magicsrr0 intersectionr*rzr=rsrrh MagicProxy)rW orig_magics these_magics remove_magicsrLrs r"rzMagicMixin._mock_set_magicsAs 44 " 4$ / / ;&33D4FGGLEEM',6M& ) )DJJ///D%((($c$t***=&>&>> T ! ; ;E E5*UD"9"9 : : : : ; ;r!N)rrrrHrr r!r"rr:s2   ;;;;;r!rceZdZ ddZdS)r Fc\ ||||dSr;rrr#s r"r$z"NonCallableMagicMock.mock_add_spec[8 N D(+++ r!Nrrrrr$r r!r"r r Ys+7      r!r ceZdZdZdS)AsyncMagicMixinc|tt|j|i||dSr;)rrrrHrs r"rHzAsyncMagicMixin.__init__fsN 3 OT**3T@R@@@ r!NrrrrHr r!r"rres#     r!rceZdZ ddZdS)rFc\ ||||dSr;rr#s r"r$zMagicMock.mock_add_specvrr!Nrrr r!r"rrks-       r!rc"eZdZdZdZddZdS)rc"||_||_dSr;r)r)rWr)rs r"rHzMagicProxy.__init__s  r!c|j}|j}||||}t|||t ||||S)N)r)rr)r)rr2rhr)rWrLrms r" create_mockzMagicProxy.create_mocksZ   " "/5 # 7 7q!!!&!U+++r!Nc*|Sr;)r)rWr4rs r"rzMagicProxy.__get__s!!!r!r;)rrrrHrrr r!r"rrsF""""""r!rceZdZedZedZedZfdZdZdZ dZ dZ d Z d Z dd Zd ZfdZxZS)rrrrctj|i|tjj|jd<d|jd<d|jd<t |jd<tt}tj tj ztj z|_ d|_d|_d|_d|_||jd<d |jd <t%|jd <i|jd <d|jd <dS)Nrr_mock_await_count_mock_await_args_mock_await_args_listr)rXrYr7r rrfrgrI)superrHrrrrsrr rr1 CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountro)rWrXrY code_mockr7s r"rHzAsyncMockMixin.__init__s$)&)))*1);)I o&-. )*,0 ()1: -.#X666    !$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(((r!c`Kt||fd}|xjdz c_||_|j||j}|t |r|t|s8 t|}n#t$rtwxYwt |r|n&t|r||i|d{V}n||i|}|tur|S|j tur|jS|j4t|jr|j|i|d{VS|j|i|S|jS)NTrr)rrrrr-rr@rlr StopIterationStopAsyncIterationrrrrr)rWrXrYrrr~s r"rz!AsyncMockMixin._execute_mock_callstVn$/// A ##E***!  V$$ 1 v&& 1-!&\\FF$----,-!((! L!$V,, 1%vt6v66666666000W$$  "' 1 1$ $   '"4#344 ?-T-t>v>>>>>>>>>#4#T4V44 4  s 1BBcV |jdkrd|jpdd}t|dS)Nr Expected rCz to have been awaited.rrrrs r"rzAsyncMockMixin.assert_awaitedsD   q Odo7OOOC %% % ! r!cf |jdks$d|jpdd|jd}t|dSNrrrCz$ to have been awaited once. Awaited rrrs r"rz"AsyncMockMixin.assert_awaited_onces\ 1$$9t8&99#/999C %% %%$r!cj j)}td|dfd}t fd}j}||kr1t |t r|nd}t||dS)NzExpected await: z Not awaitedc8d}|S)Nawait)rrrs r"rz:AsyncMockMixin.assert_awaited_with.._error_messages"33D&3QQCJr!Tr)rrrrrr.r)rWrXrYrrrrs``` r"rz"AsyncMockMixin.assert_awaited_withs  ? "77fEEH !KH!K!K!KLL L       %%eT6N&E&E&EFF##DO44 X   *8Y ? ?IHHTE !1!122 =  r!c| |jdks$d|jpdd|jd}t||j|i|Sr)rrrrrs r"rz'AsyncMockMixin.assert_awaited_once_withsl 1$$9t8&99#/999C %% %'t'8888r!c& t||fd}t|tr|nd}fdjD}|s|t |vr)||}td|z|dS)NTrc:g|]}|Sr rrs r"rsz3AsyncMockMixin.assert_any_await.. s'FFFA$$$Q''FFFr!z%s await not found)rrr.rrrrrrs` r"rzAsyncMockMixin.assert_any_await s %%eT6N&E&E&EFF&x;;EFFFF1EFFF  HL$8$888">>tVLLO $6 98r!Fc, fd|D}td|Dd}tfdjD}|sT||vrN|d}ndd|D}t |dt|dj|dSt |}g}|D]=} ||#t$r||Y:wxYw|r t t|d |dS) Nc:g|]}|Sr rrs r"rsz4AsyncMockMixin.assert_has_awaits..# rr!c3DK|]}t|t|VdSr;rrus r"rz3AsyncMockMixin.assert_has_awaits..$ rr!c3BK|]}|VdSr;rrs r"rz3AsyncMockMixin.assert_has_awaits..% s1SSt11!44SSSSSSr!zAwaits not found.z,Error processing expected awaits. Errors: {}c@g|]}t|tr|ndSr;rrus r"rsz4AsyncMockMixin.assert_has_awaits..- rr!rz Actual: z not all found in await list) rrrrrrnrrNr-ro) rWrrrr all_awaitsrrrs ` r"rz AsyncMockMixin.assert_has_awaits s :9995999FFFFFMMSSSSd>RSSSSS  z))=1GG ,-3V$7$7-5$7$7$7.8.8%66!*5!1!166#366  F*%%   ' 'D '!!$'''' ' ' '  &&&&& '   49)4D4D4D4DF   s7C  C/.C/cf |jdkr$d|jpdd|jd}t|dS)NrrrCz# to not have been awaited. Awaited rrrs r"rz!AsyncMockMixin.assert_not_awaitedC s\   q 9t8&99#/999C %% % ! r!c~ tj|i|d|_d|_t |_dSNr)rrrrrr)rWrXrYr7s r"rzAsyncMockMixin.reset_mockL sG  D+F+++({{r!r)rrrrrrrrHrrrrrrrrr __classcell__)r7s@r"rrs&&}55K%%l33J**+<==O000008&!&!&!P&&&&&&>>>$ 9 9 9   ****X&&&+++++++++r!rceZdZdS)r Nrr r!r"r r V s''r!r c"eZdZ dZdZdZdS)_ANYcdSrGr rWrs r"rz _ANY.__eq__ str!cdSr|r rs r"rz _ANY.__ne__ sur!cdS)Nzr rs r"rz _ANY.__repr__ swr!N)rrrrrrr r!r"rr sD8r!rcd|z}d}dd|D}dd|D}|r|}|r |r|dz }||z }||zS)Nz%s(%%s)r z, c,g|]}t|Sr )repr)r(rSs r"rsz*_format_call_signature.. s7773T#YY777r!c"g|] \}}|d| S)=r )r(rNrs r"rsz*_format_call_signature.. s4#-3333r!)rerP)r)rXrYrformatted_args args_string kwargs_strings r"rr s$GN))77$77788KII17M%$(  # d "N-' ^ ##r!ceZdZ ddZ ddZdZejZd Zd Z d Z d Z e d Z e dZdZdZdS)rr r NFTcd}i}t|}|dkr|\}}}n~|dkr<|\} } t| tr| }t| tr| }nD| }nA| | }}n<|dkr6|\}t|tr|}nt|tr|}n|}|rt|||fSt||||fS)Nr rr)rr.rYror) rrr)rr from_kallrXrY_lenfirstseconds r"rz _Call.__new__ s5zz 199!& D$ QYY!ME6%%% -fe,,$!DD#FF$ff QYYFE%%% E5))   6==tVn55 5}}S4v"6777r!c0||_||_||_dSr;)rr_mock_from_kall)rWrr)rrr*s r"rHz_Call.__init__ s"(r!cr t|}n#t$r tcYSwxYwd}t|dkr|\}}n|\}}}t|ddr#t|ddr|j|jkrdSd}|dkrdi}}n|dkr|\}}}n|dkr?|\} t | t r| }i}nit | tr| }di}}nMd}| }nH|dkr@|\} } t | tr!| }t | t r| i}}n d| }}n| | }}ndS|r||krdS||f||fkS) Nr rrFrr r)r)rrrr0rr.rorY) rWr len_other self_name self_args self_kwargs other_name other_args other_kwargsrr,r-s r"rz _Call.__eq__ s "E II " " "! ! ! ! " t99>>%) "I{{04 -Iy+ D.$ / / GE>SW4X4X %);;;5 >>')2 JJ !^^38 0J LL !^^FE%'' %" ! E3'' %" +-rL  $ !^^!ME6%%% 9" fe,,:/5r JJ/16 JJ+0&L 5  y005L)i-EEEs &&c|jtd||fdS|jdz}t|j||f||S)Nr r0rrrrrs r"rKz_Call.__call__ sN ? ""dF+$777 7%dotV44MMMMr!cn|jt|dS|jd|}t||dS)NF)r)r*rJ)r)rr*r9)rWrr)s r"rz_Call.__getattr__ sD ? "de444 4///440$tu====r!cb|tjvrtt||Sr;)rorsrL__getattribute__)rWrs r"r<z_Call.__getattribute__$ s+ 5> ! ! %%dD111r!cHt|dkr|\}}n|\}}}||fS)Nr)rrs r"_get_call_argumentsz_Call._get_call_arguments* s2 t99>>LD&&!% D$V|r!c6|dSrr>rs r"rXz _Call.args2 ''))!,,r!c6|dS)Nrr@rs r"rYz _Call.kwargs6 rAr!c|js%|jpd}|drd|z}|St|dkrd}|\}}n+|\}}}|sd}n |dsd|z}nd|z}t |||S)Nrr0zcall%srzcall.%s)r/rr'rr)rWr)rXrYs r"rz_Call.__repr__: s# ?,fDt$$ '$K t99>>DLD&&!% D$ '__T** ' 4'$%dD&999r!c g}|}|%|jr|||j}|%tt |Sr;)r/r-rrrd)rWvalsthings r" call_listz_Call.call_listO s\ $ # E"""&E$(((r!)r r NFT)r NNFT)rrrrrHrrxrrKrr<r>rrXrYrrGr r!r"rr s$:?8888@>C))))2F2F2Fj]FNNN>>>222 --X---X-:::* ) ) ) ) )r!r)r*c & t|rt|}t|t}t|rt d|dt |}d|i} |rd|i} n|i} | r|rd| d<|st || |t} tj |ri} nL|r|rtdt} n1t|st} n|r|rt|st} | d|}|} |d } | d||| |d | } t|t"r"t%| |} |rt'| nt)|| ||| |s | |j|<|d } |r |sd |vrt/||dd | | | _t3|D];}t5|r t7||}n#t8$rY1wxYwd|i}| r&t;| |r|||rd|i}t|t"st=||| ||}|| j|<n{| }t|t"r| j}tA|||}||d<tC|rt}nt}|d||||d|}|| j|<t)|||t|t"rtE| ||=| S)Nz'Cannot autospec a Mock object. [object=r&rrTrzJInstance can not be True when create_autospec is mocking an async functionr)r )rrrr)rrr0)rar9rrror)rr)rr)r`r )#rpr=r.r-rr9rr!rr1isdatadescriptorrr rlr rvrRrDrrrbrrtr rr,rr0rLr/rDrC _must_skiprrh)rrrarr9rrYis_type is_async_funcrCrBrrCwrappedrLr}r rr` child_klasss r"r r _ s#,*~~Dzzt$$G5 4*. 4 4 455 5"4((MtnGt$ ,8,'+#$ &f%%% NN6 E%% % %  ? >?? ? t__%$ %X%&8&>&>%$ KK & &EI 5 (W  ( (& ( (D$ &&8dD))  $ d # # #tWh7778(,u%jj!!G;x;N&$@$@+D(T2629;;;T3&3& U     tU++HH    H (#  *ww.. * MMM ) ) )  , (+F(M22 AXxuhGGC),D  & &F$ .. #"488I"+F; "8,, (' ' +(V%5*0(( &((C*-D  & Xsi @ @ @ @ c= ) ) & D% % % % Ks(G99 HHcF t|ts|t|divrdS|j}|jD]f}|j|t}|tur,t|ttfrdSt|tr|cSdS|S)NrsF) r.r=r0r7rrrsrtrrJrIrD)rrLrKrr~s r"rJrJ s dD ! ! GD*b11 1 15~  ##E733 W    f|[9 : : 55  . . NNN55 Nr!ceZdZ ddZdS)rDFNcZ||_||_||_||_||_||_dSr;)ridsrrrar))rWrrrr)rRras r"rHz_SpecState.__init__ s0       r!)FNNNFrr r!r"rDrD s.48/4r!rDc|t|trtj|Stj|Sr;)r.bytesioBytesIOStringIO) read_datas r" _to_streamrY% s4)U##&z)$$${9%%%r!r c X t}|dg fd} fd} fd fd fd}tdddl}tt t |jt t |jat2ddl}tt t |j a |tdt}tt  j _ d j_ d j_ d j_ d j_ | j_ d < d  j_| j_ j_| j_ fd }||_ |_ |S) NcZjj jjSdj|i|Sr) readlinesrrXrY_statehandles r"_readlines_side_effectz)mock_open.._readlines_side_effect; s7   ( 4#0 0"vay"D3F333r!cZjj jjSdj|i|Sr)readrr]s r"_read_side_effectz$mock_open.._read_side_effect@ s4 ; # /;+ +vay~t.v...r!c?VKEd{V dj|i|VNTr)readline)rXrY_iter_side_effectr^s r"_readline_side_effectz(mock_open.._readline_side_effectE sT$$&&&&&&&&& 6$&)$d5f55 5 5 5 6r!c3bKjj jjVdD]}|VdSre)rfr)liner^r_s r"rgz$mock_open.._iter_side_effectJ sU ? ' 3 3o2222 31I  DJJJJ  r!c^jj jjStdSr)rfrr)r^r_sr"_next_side_effectz$mock_open.._next_side_effectQ s) ? ' 3?/ /F1Ir!ropen)r)r)rrctd<jjdkrd<dj_tS)Nrr)rYrfrr)rXrYrhr^r_rXs r" reset_datazmock_open..reset_dataq sMy))q ? &&) 3 3--//F1I*0)FO 'r!)rY file_spec_iornrzr, TextIOWrapperunionrV open_specrmrrGrwriterbrfr\rrr) rCrX _read_datar`rcrlrqrorgrhr^r_s ` @@@@r"rr, s I&&J$ F444444 ////// 666666   S!23344::3s3;?O?O;P;PQQRR  S]]++,,  |f9555 I & & &F$*F! $FL#FK#'FO $(F!/FK%%''F1I"()FO#9F "3FO"3FO"DD Kr!c$eZdZ dZddZdZdS)rc tdi|S)Nr )r)rWrYs r"r2zPropertyMock._get_child_mock s""6"""r!Nc|Sr;r )rWr4obj_types r"rzPropertyMock.__get__ s tvv r!c||dSr;r )rWr4rTs r"rzPropertyMock.__set__ s S r!r;)rrrr2rrr r!r"rr~ sK###r!rc6 d|_t|D]} t||}n#t$rY wxYwt |t s:t |j|trh|j |urt|dSrG) rr,r0rLr.r rrtrDrr)rCrrs r"rr sDD   d##AA    H !_--   a&**400* = =    % % GGG  s , 99ceZdZ dZdZdS)rct||_tt}tj|_||jd<dS)Nrr7)iteratorr rr1CO_ITERABLE_COROUTINErrs)rWrrs r"rHz_AsyncIterator.__init__ s6  #X666 $: $- j!!!r!c^K t|jS#t$rYnwxYwtr;)rrrrrs r"rz_AsyncIterator.__anext__ sA  && &    D   s  %%N)rrrrHrr r!r"rr s7... !!!!!r!rr)NFNNN)FFNNr)__all__rrrUr1rr?builtinsrSrtypesrrr unittest.utilr functoolsrr threadingrrrr,r4r rrr5r9r-r@rErRrbr]rlrprvrr|rrrxrrrrMISSINGrDELETEDrErrrnrrrrr rMrHrrr>rrrrrUrZr^rraryrrdmultiplestopallr magic_methodsnumericsrerQinplaceright _non_defaultsrrr_sync_async_magics _async_magicsrr`rrrrrrrrrrrr rrrrr rrrrorrr rJrDr=rrDrprtrYrrrrr r!r"rs5  &  ''''''2222222222######$$$$$$$$CCCCCyCCC I Hcc(mm H H H   @@@222    F # # # #   &&&   6."."."b>>>6))) ) ) ) ) )f ) ) )         9;;         &********(6      6   N <N <N <N <N       :         j        D   ,""""""""$@+@+@+@+@+T@+@+@+F((((((((V     6    dff$$$$v)v)v)v)v)Ev)v)v)r uuCGO*/OOOOOd8         DD     &&&OOOOd4$0!!!!!!!!!!r!PK!}T4W __pycache__/util.cpython-311.pycnu[ 0i_dZddlmZmZddlmZdZdZdZdZ dZ dZ ee eze zeze zz Z e dksJdZ d Zdd Zd Zd ZdZdZeddZdZdZdS)zVarious utility functions.) namedtupleCounter) commonprefixTP ct||z |z }|tkr(d|d|||t||z dfz}|S)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips 4/opt/alt/python311/lib64/python3.11/unittest/util.py_shortenrsW q66I  )D  *9* tQs1vv 7I7J7J5KL L HcVttt|}ttt|}|t kr|St |t t |z tztzz }|tkrZttztz|z zt ksJtt|tfd|DSttttfd|DS)Nc32K|]}|dzVdSN.0r prefixr s r z'_common_shorten_repr..'s0::Va m+::::::rc3dK|]*}t|dttzV+dSr)r _MIN_DIFF_LEN _MIN_END_LENrs rrz'_common_shorten_repr..*sP  (1YZZ=-NNN      r) tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr(s8 Y%% & &D S$ F  $  FF I9$~58HHJJO## 00?B"$&12222&.*==:::::T:::::: fno > >F            rFc t|}n*#t$rt|}YnwxYw|rt |t kr|S|dt dzS)Nz [truncated]...)repr Exceptionobject__repr__r r")objshortresults rr r -sv&c &&&%%& CKK+-- ,;, "3 33s $99c$|jd|jS)N.) __module__ __qualname__)clss rstrclassr66snnnc&6&6 77rcdx}}g}g} ||}||}||kr8|||dz }|||kr|dz }|||kn||kr8|||dz }|||kr|dz }|||knm|dz } |||kr|dz }|||k|dz }|||kr|dz }|||kn'#|dz }|||kr|dz }|||kwxYwnJ#t$r=|||d|||dYnwxYwG||fS)arFinds elements in only one or the other of two, sorted input lists. Returns a two-element tuple of lists. The first list contains those elements in the "expected" list but not in the "actual" list, and the second contains those elements in the "actual" list but not in the "expected" list. Duplicate elements in either input list are ignored. rTN)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerD9s IAGJ  Aq A1uuq!!!QqkQ&&FAqkQ&&Q!!!$$$QQi1nnFAQi1nnQ"1+**Q#1+**FA )q..Q!)q..FA )q..Q!)q......    NN8ABB< ( ( (   fQRRj ) ) ) E /6 J s+BDC:#D$DDAE  E cg}|rR|} ||n%#t$r||YnwxYw|R||fS)zSame behavior as sorted_list_difference but for lists of unorderable items (like dicts). As it does a linear search per item (remove) it has O(n*n) performance.)popremove ValueErrorr9)r<r=r@items runorderable_list_differencerJbs G !||~~ ! MM$     ! ! ! NN4  ! ! F?s0AAc||k||kz S)z.Return -1 if x < y, 0 if x == y and 1 if x > yr)xys r three_way_cmprNss Ea!e rMismatchzactual expected valuect|t|}}t|t|}}t}g}t|D]\}} | |ur dx} } t ||D]} || | kr | dz } ||| <t|D]\} } | | kr | dz } ||| <| | kr&t | | | }||t|D][\}} | |ur d} t ||D]} || | kr | dz } ||| <t d| | }||\|S)HReturns list of (cnt_act, cnt_exp, elem) triples where the counts differrr8)listr r, enumeraterange _Mismatchr9)r=r<r tmnNULLr0r>elemcnt_scnt_tr? other_elemdiffs r_count_diff_all_purposer_ys <<hqA q663q66qA 88D FQ<<  4 4<< q!  Att|| !&q\\  MAzT!! ! E>>UE400D MM$   Q<<  4 4<< q!  Att|| !E4(( d Mrct|t|}}g}|D]G\}}||d}||kr&t|||}||H|D]/\}}||vr&td||}||0|S)rQr)ritemsgetrUr9) r=r<r rVr0rZr[r\r^s r_count_diff_hashablercs 6??GH--qA Fwwyy  edA E>>UE400D MM$   wwyy  e q==Qt,,D MM$    MrN)F)__doc__ collectionsrros.pathr __unittestr"r r#rr$rrr(r r6rDrJrNrUr_rcrrrrhs; ++++++++    !11OC !#/01       *4444888&&&R" Jz#: ; ; !!!FrPK!2}1 __pycache__/mock.cpython-311.pycnu[ 0iH`dZddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZGdd eZd eeDZd ZeZd Zd ZdZdZdZ dZ!dydZ"dZ#dZ$dZ%dZ&dydZ'dZ(dZ)dZ*Gdde+Z,Gdde+Z-e-Z.e.j/Z/e.j0Z1e.j2Z3hd Z4d!Z5Gd"d#e6Z7d$Z8Gd%d&e+Z9Gd'd(e+Z:Gd)d*e:Z;ej<e;j=Z>Gd+d,e6Z?d-Z@Gd.d/e:ZAGd0d1eAe;ZBd2ZCGd3d4e+ZDd5ZEe/dddddfdd6d7ZF dzd8ZGe/dddddfdd6d9ZHGd:d;e+ZId<ZJd=ZKeFeH_+eIeH_LeGeH_MeKeH_Nd>eH_Od?ZPd@ZQdARdBeQSDZTdARdCeQSDZUhdDZVdEZWdFdARePeQeTeUgSDZXhdGZYdHhZZeYeZzZ[eXeVzZ\e\e[zZ]hdIZ^dJdKdLdMdNZ_e`e`e`e`dOddddPdQd dOddR ZadSZbdTZcdUZddVZeebecedeedWZfdXZgGdYdZe:ZhGd[d\ehe;ZiGd]d^ehZjGd_d`eheBZkGdadbe:ZlGdcdde:ZmGdedfemejeBZnGdgdhe+ZoeoZpdiZqGdjdkerZsesdlZt d{dd6dmZudnZvGdodpe+ZwexeuexepjyfZzda{da|dqZ}d|dsZ~GdtdueBZdvZGdwdxZdS)})Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockceZdZdZdS)InvalidSpecErrorz8Indicates that an invalid value was used as a mock spec.N__name__ __module__ __qualname____doc__4/opt/alt/python311/lib64/python3.11/unittest/mock.pyrr)sBBBBr"rc<h|]}|d|S_ startswith).0names r# r+-s) H H Hd4??33G3G HT H H Hr"Tct|rt|tsdSt|drt |d}t |pt j|S)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r# _is_async_objr65sgji&@&@usJ'c:&& s # # ?w':3'?'??r"cFt|ddrt|SdS)N__code__F)r1r)funcs r#_is_async_funcr:=s)tZ&&"4(((ur"cFtt|tSN) issubclasstyper r4s r#r.r.Ds d3ii 1 11r"ct|tp)t|tot|tSr<)r/ BaseExceptionr>r=r4s r# _is_exceptionrAJs63 && A3@*S-"@"@r"c^t|trt|dr|jS|SNmock)r/ FunctionTypesr0rDr4s r# _extract_mockrFQs3#}%%'#v*>*>x r"ct|tr |s |j}d}njt|ttfrt|trd}|j}n/t|t s |j}n#t$rYdSwxYw|rt|d}n|} |tj |fS#t$rYdSwxYw)z Given an arbitrary, possibly callable object, try to create a suitable signature object. Return a (reduced func, signature) tuple, or None. TN) r/r>__init__ classmethod staticmethodr-rE__call__AttributeErrorrr2 signature ValueError)r9 as_instanceeat_selfsig_funcs r#_get_signature_objectrRZs $k} D; 5 6 6  dK ( ( H} m , , =DD   44 4&&W&x0000 tts$3A;; B B "B88 CCFct|||dS\}fd}t|||t|_t|_dS)Nc"j|i|dSr<bind)selfargskwargssigs r#checksigz"_check_signature..checksig $!&!!!!!r")rR_copy_func_detailsr>_mock_check_sig __signature__)r9rD skipfirstinstancer[rZs @r#_check_signaturerb}sr h : :C {ID#"""""tX&&&!)DJJ"DJJr"c pdD]2} t||t||##t$rY/wxYwdS)N)rr __text_signature__r __defaults____kwdefaults__)setattrr1rL)r9funcopy attributes r#r]r]sa   GYi(@(@ A A A A    D  s & 33ct|trdSt|tttfrt |jSt|dddSdS)NTrKF)r/r>rJrIr _callabler-r1r4s r#rkrks^#tt# k:>??'&&&sJ%%1t 5r"c<t|ttfvSr<)r>listtupler4s r#_is_listros 99u %%r"ct|tst|ddduS|f|jzD]}|jddS dS)ztGiven an object, return True if the object is callable. For classes, return True if instances would be callable.rKNTF)r/r>r1__mro____dict__get)r5bases r#_instance_callablerusn c4 :sJ--T99$ =  Z ( ( 444 5 5r"c0 t|t}t|||}||S|\} fd}t|||j}|sd}||d}d|z} t | |||} t| | | S)Nc"j|i|dSr<rU)rXrYrZs r#r[z _set_signature..checksigr\r"rh) _checksig_rDzYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r/r>rRr]r isidentifierexec _setup_func) rDoriginalrar`resultr9r[r*contextsrcrhrZs @r#_set_signaturers 8T**I "8Xy A AF ~ ID#"""""tX&&&  D     %t44G $&* +C #wdmGs### Nr"c_fd}fd}fd}fd}fd}fd}fd} fd} d _d _d_t _t _t _j_j _ j _ |_ |_ |_ | _| _|_|_|_|__dS) Ncj|i|Sr<)assert_called_withrXrYrDs r#rz'_setup_func..assert_called_with&t&7777r"cj|i|Sr<) assert_calledrs r#rz"_setup_func..assert_calleds!t!426222r"cj|i|Sr<)assert_not_calledrs r#rz&_setup_func..assert_not_calleds%t%t6v666r"cj|i|Sr<)assert_called_oncers r#rz'_setup_func..assert_called_oncerr"cj|i|Sr<)assert_called_once_withrs r#rz,_setup_func..assert_called_once_withs+t+T.assert_has_callss$t$d5f555r"cj|i|Sr<)assert_any_callrs r#rz$_setup_func..assert_any_calls#t#T4V444r"ct_t_j}t |r|ur|dSdSdSr<) _CallList method_calls mock_calls reset_mock return_valuer.)retrhrDs r#rz_setup_func..reset_mockso({{&[[ " S ! ! #++ NN       ++r"Fr)rDcalled call_count call_argsrcall_args_listrrr side_effect_mock_childrenrrrrrrrrr__mock_delegate) rhrDrZrrrrrrrrs `` r#r{r{sGL88888333337777788888=====6666655555GNGG&[[G$;;G"G,G*G!0G!3G&=G#/G-G#G)G 1G!3GG!Dr"c tjj_d_d_t _fd}dD]!}t|t||"dS)Nrc:tj||i|Sr<)r1rD)attrrXrYrDs r#wrapperz"_setup_async_mock..wrapper s$'wty$''8888r")assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listrgr)rDrris` r#_setup_async_mockrs +9DDDO$;;D 99999, > >  i)! >r"c$d|ddz|kS)N__%s__r!r*s r# _is_magicrs d1R4j D ((r"c$eZdZdZdZdZdZdS)_SentinelObjectz!A unique, named, sentinel object.c||_dSr<rrWr*s r#rHz_SentinelObject.__init__"s  r"cd|jzSNz sentinel.%srrWs r#__repr__z_SentinelObject.__repr__%ty((r"cd|jzSrrrs r# __reduce__z_SentinelObject.__reduce__(rr"N)rrrr rHrrr!r"r#rr sG''))))))))r"rc$eZdZdZdZdZdZdS) _SentinelzAAccess attributes to return a named object, usable as a sentinel.ci|_dSr<) _sentinelsrs r#rHz_Sentinel.__init__.s r"cl|dkrt|j|t|S)N __bases__)rLr setdefaultrrs r# __getattr__z_Sentinel.__getattr__1s3 ;   ))$0E0EFFFr"cdS)Nrr!rs r#rz_Sentinel.__reduce__7szr"N)rrrr rHrrr!r"r#rr,sJKKGGG r"r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecxt|d|z}||fd}||fd}t||S)N_mock_cT|j}|t||St||Sr<)rr1)rWr* _the_namerZs r#_getz"_delegating_property.._getLs/! ;4++ +sD!!!r"cR|j}| ||j|<dSt|||dSr<)rrrrg)rWvaluer*rrZs r#_setz"_delegating_property.._setQs9! ;',DM) $ $ $ Cu % % % % %r")_allowed_namesaddproperty)r*rrrs r#_delegating_propertyrIset4I """" $y&&&& D$  r"ceZdZdZdZdS)rct|tst||St|}t|}||krdSt d||z dzD]}||||z}||krdSdS)NFrT)r/rm __contains__lenrange)rWr len_valuelen_selfisub_lists r#rz_CallList.__contains__^s%&& 2$$T511 1JJ t99 x  5q(Y.233  AAa kM*H5  tt!ur"cDtjt|Sr<)pprintpformatrmrs r#rz_CallList.__repr__ls~d4jj)))r"N)rrrrrr!r"r#rr\s2   *****r"rct|}t|sdS|js|js|j|jdS|}|||urdS|j}||r||_||_|r||_||_dS)NFT)rFr.rrrr)parentrr*new_name_parents r#_check_and_set_parentrps % E U # #u  U1   '   +uG   e  5*  (!''  # 4r"ceZdZdZdZdS) _MockIterc.t||_dSr<)iterr5)rWr5s r#rHz_MockIter.__init__s99r"c*t|jSr<)nextr5rs r#__next__z_MockIter.__next__sDH~~r"N)rrrrHrr!r"r#rrs2r"rceZdZeZdZdZdS)BaseNcdSr<r!rWrXrYs r#rHz Base.__init__s r")rrrrrrrHr!r"r#rrs/      r"rceZdZdZeZdZ d-dZdZd.dZ d/d Z d Z d Z d Z ee e e Zed ZedZedZedZedZedZdZdZeeeZd0ddddZdZdZdZdZdZdZ dZ!dZ"d1d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d.d(Z+d)Z,d*Z-d2d,Z.dS)3r z A non-callable version of `Mock`cz|f}t|ts]tj|g|Ri|j}|d|d}|t |r t|f}t|j|d|j i}tt| |}|S)Nspec_setspecr ) r=AsyncMockMixin _MOCK_SIG bind_partial argumentsrsr6r>rr _safe_superr __new__)clsrXkwbases bound_argsspec_argnewras r#rzNonCallableMock.__new__s#~.. ."/AdAAAbAAKJ!~~j*..2H2HIIH# h(?(?#'-3<CK(@AA44<rRrr) rWrrrrr&r(r*rresrrs r#rzNonCallableMock._mock_add_specs' T " " T"#R#R#R#RSS S  II * *D"74t#<#<== *##D)))  HTNN $%% )" "4jj '(99FFC!nc!fOt99D="- (&5"#$(!#/   r"c|j}|j |jj}|tur%|j||d}||_|S)N()rr)rrrrr_get_child_mock)rWrs r#__get_return_valuez"NonCallableMock.__get_return_values]%   *%2C '>>d.6&& D'C!$D  r"cb|j||j_dS||_t||dddS)Nr/)rrrr)rWrs r#__set_return_valuez"NonCallableMock.__set_return_value%s>   */4D  , , ,&+D # !$tT : : : : :r"z1The value to be returned when the mock is called.c<|jt|S|jSr<)r&r>rs r# __class__zNonCallableMock.__class__1s   #:: r"rrrrrc|j}||jS|j}|It|s:t |t s%t |st |}||_|Sr<)rrrcallabler/rrA)rW delegatedsfs r#__get_side_effectz!NonCallableMock.__get_side_effect>sj'  ) )  " N8B<>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError} >>> mock.configure_mock(**attrs)c8|ddS)Nr.)count)entrys r#z0NonCallableMock.configure_mock..sq1D1Dr")keyrIN)sorteditemssplitpopr1rg)rWrYargvalrXfinalr5rKs r#rzNonCallableMock.configure_mockrsv||~~$E#D FFF % %HC 99S>>DHHJJEC * *c5)) C $ $ $ $ % %r"c |dvrt||j%||jvs |tvrtd|znt|rt||js:|jr ||jvr*|drt|d|dt j5|j |}|turt||Cd}|j t|j |}| |||||}||j|<nt|trv t!|j|j|j|j|j}n>#t,$r1|jdp|}t-d|d |d |d |jd wxYw||j|<dddn #1swxYwY|S) N>rr)zMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)rr*rrrrCannot autospec attr from target , as it has already been mocked out. [target=, attr=r%)rLr) _all_magicsrrr(r _lockrrsrDrr1r1r/rCr rrrarr*rrr)rWr*r}r target_names r#rzNonCallableMock.__getattr__s 4 4 4 && &   +4---1D1D$%F%MNNN2E t__ ' && &  N$*< NDL^@^@^OPP N$MM'+MMMNNN " 4 4(,,T22F!!$T***#/$D$4d;;E--d%4 $..4#D))FJ// 4 D, V_fo v{FF(DDD"&- "="EK*CCC&CC#'CC28+CCCDDDD .4#D); 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4> s++B F:9,E&%F:&;F!! F::F>F>cn|jg}|j}|}d}|dgkrd}|7|}||j|zd}|jdkrd}|j}|7tt |}|jpd}t |dkr|ddvr|dz }||d<d|S)NrIr/r rDr)r/z().r)rrr,rmreversedrrjoin)rW _name_listrlastdot_firsts r#_extract_mock_namez"NonCallableMock._extract_mock_names)* ' $  C!D   g4s: ; ; ;C%--.G!(:..// *F z??Q  !}M11#  1 wwz"""r"c|}d}|dvrd|z}d}|jd}|jrd}||jjz}dt |j||dt |dS) Nr )rDzmock.z name=%rz spec=%rz spec_set=%r)rir&r'rr>rA)rWr* name_string spec_strings r#rzNonCallableMock.__repr__s&&(( ( ( ($t+K   '$K~ -, %(8(AAK JJ   K KK tHHHH   r"cvtst|S|jpg}t t |}t |j}d|j D}d|D}d|D}tt||z|z|zS)z8Filter the output of `dir(mock)` to only useful members.c*g|]\}}|tu|Sr!)rD)r)m_namem_values r# z+NonCallableMock.__dir__..s1(((&vwh&& &&&r"c<g|]}|d|Sr%r'r)es r#rrz+NonCallableMock.__dir__..s)CCC1c1B1BCQCCCr"cZg|](}|drt|&|)Sr%)r(rrts r#rrz+NonCallableMock.__dir__..sE###1c1B1B#q\\#Q###r") r object__dir__r)r+r>rmrrrrOrNset)rWextras from_type from_dictfrom_child_mockss r#rxzNonCallableMock.__dir__s (>>$'' '#)rT OO '' ((*.*=*C*C*E*E(((DC CCC ## ### c&9,y8;KKLLMMMr"cT|tvrt||Sjr+j$|jvr|jvrt d|z|tvrd|z}t ||tvrj|jvrt d|zt|s5tt|t|||fd}nft|d|tt|||j|<n+|dkr |_dSt|||r |j|<jr;t#|s+d|}t d|t||S)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.cg|Ri|Sr<r!)rXrr|rWs r#rLz-NonCallableMock.__setattr__.. s!HHT,GD,G,G,GB,G,Gr"r6rIz Cannot set )rrw __setattr__r'r)rrrL_unsupported_magicsr_r.rgr> _get_methodrrr&r r0ri)rWr*rmsg mock_namer|s` @r#rzNonCallableMock.__setattr__s > ! !%%dD%88 8n 2!3!? * * *  % % !Dt!KLL L ( ( (BTIC %% % [ !-$d>P2P2P$%H4%OPPP$U++ 2T D+dE*B*BCCC GGGGG&dE4>>>T D%000,1#D)) [ $D  F$T5$== 2,1#D)   |t|jvr(tt||||jvrdS|j|t }||jvr)tt| |n|turt||t ur|j|=t|j|<dSr<) r_r>rrdelattrrrs_missingrr __delattr__rDrL)rWr*r5s r#rzNonCallableMock.__delattr__!s ;  44::+>#>#> DJJ % % %4=((!%%dH55 4=  . . : :4 @ @ @ @ H__ && & h  #D)$,D!!!r"c6|jpd}t|||SrC)r_format_call_signaturerWrXrYr*s r#_format_mock_call_signaturez+NonCallableMock._format_mock_call_signature3s (&%dD&999r"rcdd}|||}|j}|j|}||||fzS)Nz0expected %s not found. Expected: %s Actual: %s)rr)rWrXrYactionmessageexpected_stringr actual_strings r#_format_mock_failure_messagez,NonCallableMock._format_mock_failure_message8sDF::4HHN 88)D &/=AAAr"c|s|jSd}|ddd}|j}|D]M}||}|t |t rnt|}|j}|j}N|S)aH * If call objects are asserted against a method/function like obj.meth1 then there could be no name for the call object to lookup. Hence just return the spec_signature of the method/function being asserted against. * If the name is not empty then remove () and split by '.' to get list of names to iterate through the children until a potential match is found. A child mock is created only during attribute access so if we get a _SpecState then no attributes of the spec were accessed and can be safely exited. Nr/r rI)r(replacerPrrsr/rCrF)rWr*rZnameschildrenrFs r#_get_call_signature_from_namez-NonCallableMock._get_call_signature_from_name@s (' ' T2&&,,S11& , ,DLL&&E} 5* = =} &e,, /+ r"ct|tr/t|dkr||d}n|j}|vt|dkrd}|\}}n|\}}} |j|i|}t ||j|jS#t$r}| dcYd}~Sd}~wwxYw|S)a Given a call (or simply an (args, kwargs) tuple), return a comparison key suitable for matching with other calls. This is a best effort method which relies on the spec's signature, if available, or falls back on the arguments themselves. rrNr ) r/rnrrr(rVrrXrY TypeErrorwith_traceback)rW_callrZr*rXrY bound_callrus r# _call_matcherzNonCallableMock._call_matcheras eU # # 'E Q44U1X>>CC&C ?5zzQ$ ff%*"dF .%SXt6v66 D*/:3DEEE . . .''-------- .Ls0'B C"B<6C<Cc|jdkr8d|jpdd|jd|}t|dS)z/assert that the mock was never called. r Expected 'rDz"' to not have been called. Called  times.Nrr _calls_reprAssertionErrorrWrs r#rz!NonCallableMock.assert_not_called|s^ ?a   o///ooo&&(((*C!%% % r"cR|jdkrd|jpdz}t|dS)z6assert that the mock was called at least once rz"Expected '%s' to have been called.rDN)rrrrs r#rzNonCallableMock.assert_calleds; ?a  7O-v/C %% % r"c|jdks8d|jpdd|jd|}t|dS)z3assert that the mock was called only once. rrrDz#' to have been called once. Called rNrrs r#rz"NonCallableMock.assert_called_onces^!###o///ooo&&(((*C!%% % $#r"ctj/}d}d|d|}t|fd}t fd}j}||kr1t |t r|nd}t||dS)zassert that the last call was made with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.Nz not called.z#expected call not found. Expected: z Actual: c4}|Sr<rrrXrYrWs r#_error_messagez:NonCallableMock.assert_called_with.._error_messages33D&AACJr"Ttwo)rrrr_Callr/ Exception)rWrXrYexpectedactual error_messagercauses``` r#rz"NonCallableMock.assert_called_withs > !77fEEH"FFxx)M // /       %%eT6N&E&E&EFF##DN33 X   *8Y ? ?IHHTE !1!122 =  r"c|jdks8d|jpdd|jd|}t||j|i|S)ziassert that the mock was called exactly once and that that call was with the specified arguments.rrrDz' to be called once. Called r)rrrrrrWrXrYrs r#rz'NonCallableMock.assert_called_once_withsn!###o///ooo&&(((*C!%% %&t&7777r"cfd|D}td|Dd}tfdjD}|su||vro|d}ndd|D}t |dt|d d |dSt|}g}|D]=} ||#t$r| |Y:wxYw|r-t j pd d t|d|d|dS)aassert the mock has been called with the specified calls. The `mock_calls` list is checked for the calls. If `any_order` is False (the default) then the calls must be sequential. There can be extra calls before or after the specified calls. If `any_order` is True then the calls can be in any order, but they must all appear in `mock_calls`.c:g|]}|Sr!rr)crWs r#rrz4NonCallableMock.assert_has_calls..'999aD&&q))999r"c3DK|]}t|t|VdSr<r/rrts r# z3NonCallableMock.assert_has_calls..1FFAZ9-E-EFaFFFFFFr"Nc3BK|]}|VdSr<rrs r#rz3NonCallableMock.assert_has_calls..s1MMd0033MMMMMMr"zCalls not found.z+Error processing expected calls. Errors: {}c@g|]}t|tr|ndSr<rrts r#rrz4NonCallableMock.assert_has_calls..;$7$7$7()*4Ay)A)A$KAAt$7$7$7r" Expected: z Actual)prefixrIrDz does not contain all of z in its call list, found z instead) rrrformatrrrstriprmremoverNr,rrn) rWcalls any_orderrr all_callsproblem not_foundkalls ` r#rz NonCallableMock.assert_has_callss:9995999FFFFFMMMMMMT_MMMMM  y((=0GG ,-3V$7$7-5$7$7$7.8.8%II!*5!1!1I''z'::AA#FFII  FOO   ' 'D '  &&&& ' ' '  &&&&& '   &*o&?&?&?&+I&6&6&6&6 C    sC--DDc$t||fd}t|tr|nd}fdjD}|s|t |vr)||}td|z|dS)zassert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if the call is the most recent one.TrNc:g|]}|Sr!rrs r#rrz3NonCallableMock.assert_any_call..s'EEEA$$$Q''EEEr"z%s call not found)rrr/rr _AnyComparerrrrWrXrYrrrrs` r#rzNonCallableMock.assert_any_calls %%eT6N&E&E&EFF&x;;EEEEE1DEEE  HL$8$888">>tVLLO #o5 98r"c |jr7d|vr d|dnd}||z}t||d}||jdvr t di|St |}t|tr|tvrt }nt|tr)|tvs|j r||j vrt}ndt }n\t|ts:t|trt}n*t|trt }n |jd}|di|S)aPCreate the child mocks for attributes and return value. By default child mocks will be the same type as the parent. Subclasses of Mock may want to override this to customize the way child mocks are made. For non-callable mocks the callable variant will be used (rather than any custom subclass).r*rIr/rr*rr!)r rirLrsrrr r>r=r_async_method_magicsr_all_sync_magicsr) CallableMixinr r rrq)rWrrirr_typeklasss r#r1zNonCallableMock._get_child_mocks[   ,,2bLL(BvJ(((dI//11I=I ++ +FF;''  n5 5 5??r?? "T  eY ' ' %I9M,M,MEE ~ . . %---&.+48J+J+J!!E=11 %%!566 !E?33 M!$Eu{{r{{r"CallscJ|jsdSd|dt|jdS)zRenders self.mock_calls as a string. Example: " Calls: [call(1), call(2)]." If self.mock_calls is empty, an empty string is returned. The output will be truncated if very long. r  z: rI)rr)rWrs r#rzNonCallableMock._calls_reprs6 2;F;;i88;;;;r") NNNNNNr NFNFF)FFr<)r)r)/rrrr rr`rrHrr#r"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr6rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrrrrrirrxrrrrrrrrrrrrrr1rr!r"r#r r s** EGGE   ">BEI   ;;;M8.0B.00L  X " !( + +F%%l33J$$[11I))*:;;N%%l33J   ***(,.?@@K$u%$$$$$<%%%,---`###6   *NNN$$5$5$5N---$::: BBBBB6&&&&&&&&&>>>, 8 8 8****Z    ###L < < < < < .5s1$HfF"r"TF)rallzip)rWitemrs r#rz_AnyComparer.__contains__2s{  Et99E ****(+D%(8(8 tt   ur"N)rrrr rr!r"r#rr-s-r"rc||St|r|St|r|S t|S#t$r|cYSwxYwr<)rArkrrr4s r#r=r==sk { S ~~ Cyy  s7 AAc HeZdZddedddddddf dZdZdZdZdZdZ dS) rNr c x||jd<tt|j||||||| | fi| ||_dS)Nr)rrrrrHr) rWrrrrr*rrrrrrYs r#rHzCallableMixin.__init__Nsa/; *+1 M4((1 %x K  39   'r"cdSr<r!rs r#r^zCallableMixin._mock_check_sigZs r"cP|j|i||j|i||j|i|Sr<)r^_increment_mock_call _mock_callrs r#rKzCallableMixin.__call___sK d-f---!!426222t////r"c|j|i|Sr<)_execute_mock_callrs r#rzCallableMixin._mock_callgs&t&7777r"c~d|_|xjdz c_t||fd}||_|j||jdu}|j}|j}|dk}|j td||f|j }||rB|j t|||f|jdu}|r |jdz|z}t|||f} |j | |jr|rd} nd} |jdk}|j| z|z}|j }|dSdS)NTrrr/r rI) rrrrrr,rrrrrr) rWrXrYrdo_method_callsmethod_call_namemock_call_name is_a_callrthis_mock_callrgs r#rz"CallableMixin._increment_mock_calljs  1 tVn$/// ""5)))+47?,"d*  ub$%788999+ % W(//7Gv6V0W0WXXX"-":$"F"W'2'='CFV'V$#ND&#ABBN  " ) ). 9 9 9) SCCC'6$> !,!;c!AN!R&6K-%%%%%r"c^|j}|Tt|r|t|s!t|}t|r|n||i|}|tur|S|jtur|jS|jr|jjtur|jS|j |j|i|S|jSr<) rrArkrrrrrr)rWrXrYeffectr}s r#rz CallableMixin._execute_mock_calls!  V$$ 1 v&& 1f ((! L! 000W$$  "' 1 1$ $   %4#6#C7#R#R$ $   '#4#T4V44 4  r") rrrrrHr^rKrrrr!r"r#rrLs d$d!RT ' ' ' '   000888,7,7,7\!!!!!r"rceZdZdZdS)ra Create a new `Mock` object. `Mock` takes several optional arguments that specify the behaviour of the Mock object: * `spec`: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an `AttributeError`. If `spec` is an object (rather than a list of strings) then `mock.__class__` returns the class of the spec object. This allows mocks to pass `isinstance` tests. * `spec_set`: A stricter variant of `spec`. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as `spec_set` will raise an `AttributeError`. * `side_effect`: A function to be called whenever the Mock is called. See the `side_effect` attribute. Useful for raising exceptions or dynamically changing return values. The function is called with the same arguments as the mock, and unless it returns `DEFAULT`, the return value of this function is used as the return value. If `side_effect` is an iterable then each call to the mock will return the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. * `unsafe`: By default, accessing any attribute whose name starts with *assert*, *assret*, *asert*, *aseert* or *assrt* will raise an AttributeError. Passing `unsafe=True` will allow access to these attributes. * `wraps`: Item for the mock object to wrap. If `wraps` is not None then calling the Mock will pass the call through to the wrapped object (returning the real result). Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist will raise an `AttributeError`). If the mock has an explicit `return_value` set then calls are not passed to the wrapped object and the `return_value` is returned instead. * `name`: If the mock has a name then it will be used in the repr of the mock. This can be useful for debugging. The name is propagated to child mocks. Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. Nrr!r"r#rrs5555r"rc@d}|D]}||vrt|ddS)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r#_check_spec_arg_typosrsN 2E ? " "PPP  #r"c~eZdZdZgZdddZdZdZdZe j dZ d Z d Z d Zd Zd ZdZdZdS)_patchNFrc |)|turtd|td| st| t|rt d|d|dt|rt d|d|d||_||_||_||_||_ ||_ d|_ ||_ ||_ | |_g|_dS)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=r%z? as the spec_set target has already been mocked out. [spec_set=F)rrNrr.rgetterrir  new_callablercreate has_localrautospecrYadditional_patchers) rWrrir rrrr rrYrs r#rHz_patch.__init__sV  #'!! B# G * !& ) ) ) T " " A"@I@@6:@@@AA A X & & P"OIOOAIOOOPP P "(       #%   r"c t|j|j|j|j|j|j|j|j|j }|j |_ d|j D|_ |S)Nc6g|]}|Sr!)copy)r)ps r#rrz_patch.copy..,s-' ' ' AFFHH' ' ' r") rrrir rrrr rrYattribute_namer )rWpatchers r#rz _patch.copy%sq K49 K M4,dk   "&!4' ' "6' ' ' #r"ct|tr||Stj|r||S||Sr<r/r>decorate_classr2rdecorate_async_callabledecorate_callable)rWr9s r#rKz_patch.__call__2sc dD ! ! -&&t,, ,  &t , , 6//55 5%%d+++r"ct|D]q}|tjs"t ||}t |dsC|}t||||r|SNrK)r+r(r TEST_PREFIXr1r0rrg)rWrr attr_valuers r#rz_patch.decorate_class:sJJ 6 6D??5#455  --J:z22 iikkG E4!4!4 5 5 5 5 r"c#TKg}tj5}|jD]W}||}|j||4|jtur||X|t|z }||fVddddS#1swxYwYdSr<) contextlib ExitStack patchings enter_contextrupdater rr,rn)rWpatchedrXkeywargs extra_args exit_stackpatchingrRs r#decoration_helperz_patch.decoration_helperHs  ! # # #z#- + + ..x88*6OOC((((\W,,%%c*** E*%% %D" " " " # # # # # # # # # # # # # # # # # #sA8BB!$B!ctdrjStfdg_S)Nrc|||5\}}|i|cdddS#1swxYwYdSr<r&rXr"newargs newkeywargsr9r!rWs r#r!z)_patch.decorate_callable..patched]s''(,(022 55Kg{tW4 44 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s 155r0rr,rrWr9r!s``@r#rz_patch.decorate_callableWsv 4 % %  N ! !$ ' ' 'K t 5 5 5 5 5 5  5 "Fr"ctdrjStfdg_S)NrcK||5\}}|i|d{VcdddS#1swxYwYdSr<r)r*s r#r!z/_patch.decorate_async_callable..patchedns''(,(022 ;5Kg{!T7:k:::::::: ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;s 9==r-r.s``@r#rz_patch.decorate_async_callablehsv 4 % %  N ! !$ ' ' 'K t ; ; ; ; ; ;  ; "Fr"c`|}|j}t}d} |j|}d}n-#tt f$rt ||t}YnwxYw|tvrt|trd|_ |j s|turt |d|||fS)NFTz does not have the attribute ) rrirrrrLKeyErrorr1 _builtinsr/rr)rWtargetr*r|locals r# get_originalz_patch.get_originalys~ t,HEE) 6 6 6vtW55HHH 6 9  FJ!?!? DK{ x722 7=vvttD s 6'A A c |j|j|j}}}|j|j}}|j}||_|durd}|durd}|durd}||td|||dvrtd| \}}|tur|d} |dur |}|dur|}d}n| |dur|}d}n|dur|}||/|turtdt|trd} |t|rt} nt} i} ||} nN||J|} ||} t!| rd| v} nt#|  } t| rt} n | rt$} ||| d <||| d <t| tr&t'| t(r|jr |j| d <| || di| }| r_t/|rP|} ||} t!| st1| st$} | d | d|d d | |_n||turtd|turtdt7|}|dur|}t/|jr#t9d|jd|jd|dt/|rAt;|jd|j}t9d|jd|d|jd|d t=|f||jd|}n|rtd|}||_||_ tCj"|_# tI|j|j||j%ci}|jtur |||j%<|j&D]?}|j#'|}|jtur||@|S|S#|j(tSj*sYdSxYw)zPerform the patch.FNzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerKrrr*r/r0zBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=Truer[z: as the patch target has already been mocked out. [target=r^r%rr\r])r_namez.Can't pass kwargs to a mock we aren't creatingr!)+r rrr rYrrr4rr6rr/r>r6r rror8r r=r rir r.rurQrboolrr1r temp_originalis_localrr _exit_stackrgrr r__exit__sysexc_info)rWr rrr rYrr|r5inheritKlass_kwargs this_spec not_callableranew_attrr#r%rRs r# __enter__z_patch.__enter__s"h 4=8T=$+&( kkmm  5==D u  H u  H   4=>> >  !5 L ( (TUU U++--% '>>h.Gt||t##'HD!t###HDT!!#8#7w&&#$GHHHh--#"G| h 7 7|!!G'$!X%9 ' (II&&;#-Y#>LL'/ ':':#:L ++1%EE!10E"&#&. #5$'' 15/22 17;~ 1"&. NN6 " " "%""'""C 4,S11 4! ' (I ++1&y1110E F####(5$4SD$4$4+2$4$4  !'!!(7"" GHHHH~~H4# -- D&CDNCC#{CC5=CCCDDD!** D%dk:t{KK &CDNCC"CC#{CC5=CCCDDD "(BX(,BB:@BBCC  NLMM M% %/11  DK : : :". 8w&&7:Jt23 $ 8//H*88BBC|w.."))#...!!J  4=#,..1    sBOOO<ch|jr/|jtur!t|j|j|jndt |j|j|jsCt|j|jr |jdvr t|j|j|j|`|`|`|j }|` |j |S)zUndo the patch.)r rre__annotations__rf) r;r:rrgr4rirrr0r<r=)rWr?r$s r#r=z_patch.__exit__#s = IT/w>> DK1C D D D D DK 0 0 0; I T^(L(L I+=== T^T5GHHH   M K%  "z"H--r"cb|}|j||Sz-Activate a patch, returning any created mock.)rF_active_patchesr,rWr}s r#startz _patch.start8s-!! ##D))) r"c |j|n#t$rYdSwxYw|dddSzStop an active patch.N)rKrrNr=rs r#stopz _patch.stop?s[   ' ' - - - -   44 }}T4...s  ++)rrrrrKrHrrKrrcontextmanagerr&rrr6rFr=rMrPr!r"r#rrsNOAF"&"&"&"&"&J   ,,,    # # #""0PPPd...*/////r"rc |dd\}}n-#tttf$rtd|wxYwt t j||fS)NrIrz,Need a valid target to patch. You supplied: )rsplitrrNrLrpkgutil resolve_name)r4ris r# _get_targetrVKsG"MM#q11 z> 2GGG E6 E EGG GG 7' 0 0) ;;s *Arc tturtdfd} t| |||||||| | S)a patch the named member (`attribute`) on an object (`target`) with a mock object. `patch.object` can be used as a decorator, class decorator or a context manager. Arguments `new`, `spec`, `create`, `spec_set`, `autospec` and `new_callable` have the same meaning as for `patch`. Like `patch`, `patch.object` takes arbitrary keyword arguments for configuring the mock object it creates. When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. z3 must be the actual object to be patched, not a strcSr<r!r4sr#rLz_patch_object..jsVr"r)r>strrr) r4rir rrrr rrrYrs ` r# _patch_objectr[Tsn$ F||s L L L   ^^^F  3f(L&   r"c tturttj}nfd}|st dt |}|d\} } t|| | |||||i } | | _ |ddD]=\} } t|| | |||||i } | | _ | j | >| S)aPerform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the patches:: with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): ... Use `DEFAULT` as the value if you want `patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, and a dictionary is returned when `patch.multiple` is used as a context manager. `patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments `spec`, `spec_set`, `create`, `autospec` and `new_callable` have the same meaning as for `patch`. These arguments will be applied to *all* patches done by `patch.multiple`. When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX` for choosing which methods to wrap. cSr<r!rYsr#rLz!_patch_multiple..sr"z=Must supply at least one keyword argument with patch.multiplerrN) r>rZrrTrUrNrmrOrrr r,) r4rrrr rrYrrOrir r this_patchers ` r#_patch_multipler_qs , F||s-v66   K     E1XNIs 3fh,G'G)99 3 IsD&( lB  '0 ##**<8888 Nr"c Xt|\} } t| | |||||||| S)a: `patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the `target` is patched with a `new` object. When the function/with statement exits the patch is undone. If `new` is omitted, then the target is replaced with an `AsyncMock if the patched object is an async function or a `MagicMock` otherwise. If `patch` is used as a decorator and `new` is omitted, the created mock is passed in as an extra argument to the decorated function. If `patch` is used as a context manager the created mock is returned by the context manager. `target` should be a string in the form `'package.module.ClassName'`. The `target` is imported and the specified object replaced with the `new` object, so the `target` must be importable from the environment you are calling `patch` from. The target is imported when the decorated function is executed, not at decoration time. The `spec` and `spec_set` keyword arguments are passed to the `MagicMock` if patch is creating one for you. In addition you can pass `spec=True` or `spec_set=True`, which causes patch to pass in the object being mocked as the spec/spec_set object. `new_callable` allows you to specify a different class, or callable object, that will be called to create the `new` object. By default `AsyncMock` is used for async functions and `MagicMock` for the rest. A more powerful form of `spec` is `autospec`. If you set `autospec=True` then the mock will be created with a spec from the object being replaced. All attributes of the mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise a `TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. Instead of `autospec=True` you can pass `autospec=some_object` to use an arbitrary object as the spec instead of the one being replaced. By default `patch` will fail to replace attributes that don't exist. If you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! Patch can be used as a `TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods share a common patchings set. `patch` finds tests by looking for method names that start with `patch.TEST_PREFIX`. By default this is `test`, which matches the way `unittest` finds tests. You can specify an alternative prefix by setting `patch.TEST_PREFIX`. Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use "as" then the patched object will be bound to the name after the "as"; very useful if `patch` is creating a mock object for you. Patch will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `patch` takes arbitrary keyword arguments. These will be passed to `AsyncMock` if the patched object is asynchronous, to `MagicMock` otherwise or to `new_callable` if specified. `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are available for alternate use-cases. r)rVr) r4r rrrr rrrYrris r#rrsDV$F++FI  3f(L&   r"cVeZdZdZddZdZdZdZdZd Z d Z d Z d Z d Z dZdS) _patch_dicta# Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test. `in_dict` can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys. `in_dict` can also be a string specifying the name of the dictionary, which will then be fetched by importing it. `values` can be a dictionary of values to set in the dictionary. `values` can also be an iterable of `(key, value)` pairs. If `clear` is True then the dictionary will be cleared before the new values are set. `patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary:: with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()): ... `patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator `patch.dict` honours `patch.TEST_PREFIX` for choosing which methods to wrap. r!Fc ||_t||_|j|||_d|_dSr<)in_dictdictrBr clear _original)rWrdrBrfrYs r#rHz_patch_dict.__init__s> 6ll  6""" r"ct|tr||Stj|r||S||Sr<r)rWfs r#rKz_patch_dict.__call__sc a   *&&q)) )  &q ) ) 3//22 2%%a(((r"c@tfd}|S)Nc |i|S#wxYwr<rb _unpatch_dictrXrrirWs r#_innerz-_patch_dict.decorate_callable.._inner#sV       %q$~"~~""$$$$""$$$$s 3A rrWriros`` r#rz_patch_dict.decorate_callable"9 q % % % % %  % r"c@tfd}|S)NcK |i|d{V S#wxYwr<rlrns r#roz3_patch_dict.decorate_async_callable.._inner/so       %Q^^^+++++++""$$$$""$$$$s <Arprqs`` r#rz#_patch_dict.decorate_async_callable.rrr"c t|D]}}t||}|tjrLt |dr"/ ==DL,  -||~~HH - - -H - - '   - -  - "  !   + NN6 " " " " " + + + + +%c{  + + + +s$A$$BBB66CCc|j}|j}t| ||dS#t$r|D] }||||<YdSwxYwr<)rdrgrzr rL)rWrdr|rMs r#rmz_patch_dict._unpatch_dictgs,>G - NN8 $ $ $ $ $ - - - - -'}  - - - -s6AAc<|j|dS)zUnpatch the dict.NF)rgrm)rWrXs r#r=z_patch_dict.__exit__ts! > %    ur"cl|}tj||SrJ)rFrrKr,rLs r#rMz_patch_dict.start{s-!!%%d+++ r"c tj|n#t$rYdSwxYw|dddSrO)rrKrrNr=rs r#rPz_patch_dict.stops[   " ) )$ / / / /   44 }}T4...s " 00N)r!F)rrrr rHrKrrrrFrbrmr=rMrPr!r"r#rbrbs8)))       +++8 - - -/////r"rbc |dS#t$rt|}|D]}||=YdSwxYwr<)rfrLrm)rdkeysrMs r#rzrzse  G}}  C    s !==cfttjD]}|dS)z7Stop all active patches. LIFO to unroll nested patches.N)rcrrKrP)rs r#_patch_stopallrs5&011 r"testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c# K|] }d|zV dS)zi%sNr!r)ns r#rrs&77519777777r"c# K|] }d|zV dS)zr%sNr!rs r#rrs&55q555555r">rx__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c fd}||_|S)z:Turns a callable object (like a mock) into a real functionc|g|Ri|Sr<r!)rWrXrr9s r#methodz_get_method..methods#tD&4&&&2&&&r")r)r*r9rs ` r#rrs('''''FO Mr"ch|]}d|zS)rr!)r)rs r#r+r+s*    Hv   r"> __aexit__ __anext__ __aenter__ __aiter__>__del__rrHr __prepare__r__instancecheck____subclasscheck__c6t|Sr<)rw__hash__rs r#rLrLsV__T22r"c6t|Sr<)rw__str__rs r#rLrLsFNN400r"c6t|Sr<)rw __sizeof__rs r#rLrLsv0066r"cxt|jd|dt|S)N/)r>rrirArs r#rLrLs;$t**"5^^8O8O8Q8Q^^TVW[T\T\^^r")rrr __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r= __complex__ __float____bool__ __index__rcfd}|S)NcLjj}|tur|S|urdStSNT)__eq__rrNotImplemented)otherret_valrWs r#rz_get_eq..__eq__s1+0 ' ! !N 5==4r"r!)rWrs` r#_get_eqrs# Mr"cfd}|S)NcRjjturtS|urdStSNF)__ne__rrr)rrWs r#rz_get_ne..__ne__s, ; ) 8 8N 5==5r"r!)rWrs` r#_get_ners# Mr"cfd}|S)Ncjjj}|turtgSt|Sr<)__iter__rrrrrWs r#rz_get_iter..__iter__s1-2 g  88OG}}r"r!)rWrs` r# _get_iterr s# Or"cfd}|S)Ncjj}|turtt gStt |Sr<)rrr_AsyncIteratorrrs r#rz"_get_async_iter..__aiter__s@.3 g  !$r((++ +d7mm,,,r"r!)rWrs` r#_get_async_iterrs$----- r")rrrrc&t|t}|tur ||_dSt|}|||}||_dSt |}||||_dSdSr<)_return_valuesrsrr_calculate_return_value_side_effect_methodsr)rDrr*fixedreturn_calculatorr side_effectors r#_set_return_valuer(s   tW - -E G#/33D99$((.. *(,,T22M *]400! r"ceZdZdZdZdS) MagicMixinc|tt|j|i||dSr<)_mock_set_magicsrrrHrWrXrs r#rHzMagicMixin.__init__;sN . J%%.;;;; r"c ttz}|}t|ddX||j}t }||z }|D](}|t |jvrt||)|t t |jz }t |}|D]!}t||t||"dS)Nr)) _magicsrr1 intersectionr)ryr>rrrrg MagicProxy)rW orig_magics these_magics remove_magicsrKrs r#rzMagicMixin._mock_set_magicsAs 44 " 4$ / / ;&33D4FGGLEEM',6M& ) )DJJ///D%((($c$t***=&>&>> T ! ; ;E E5*UD"9"9 : : : : ; ;r"N)rrrrHrr!r"r#rr:s2   ;;;;;r"rceZdZdZddZdS)r z-A version of `MagicMock` that isn't callable.FcZ||||dSr!rrr"s r#r#z"NonCallableMagicMock.mock_add_spec[2 D(+++ r"Nrrrrr r#r!r"r#r r Ys.77      r"r ceZdZdZdS)AsyncMagicMixinc|tt|j|i||dSr<)rrrrHrs r#rHzAsyncMagicMixin.__init__fsN 3 OT**3T@R@@@ r"NrrrrHr!r"r#rres#     r"rceZdZdZddZdS)ra MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself. If you use the `spec` or `spec_set` arguments then *only* magic methods that exist in the spec will be created. Attributes and the return value of a `MagicMock` will also be `MagicMocks`. FcZ||||dSr!rr"s r#r#zMagicMock.mock_add_specvrr"Nrrr!r"r#rrks2        r"rc"eZdZdZdZddZdS)rc"||_||_dSr<r*r)rWr*rs r#rHzMagicProxy.__init__s  r"c|j}|j}||||}t|||t ||||S)N)r*rr)r*rr1rgr)rWrKrms r# create_mockzMagicProxy.create_mocksZ   " "/5 # 7 7q!!!&!U+++r"Nc*|Sr<)r)rWr5rs r#rzMagicProxy.__get__s!!!r"r<)rrrrHrrr!r"r#rrsF""""""r"rceZdZedZedZedZfdZdZdZ dZ dZ d Z d Z dd Zd ZfdZxZS)rrrrctj|i|tjj|jd<d|jd<d|jd<t |jd<tt}tj tj ztj z|_ d|_d|_d|_d|_||jd<d |jd <t%|jd <i|jd <d|jd <dS)Nrr_mock_await_count_mock_await_args_mock_await_args_listr)rXrYr8r rrerfrH)superrHrrrrrrr rr2 CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountrn)rWrXrY code_mockr6s r#rHzAsyncMockMixin.__init__s$)&)))*1);)I o&-. )*,0 ()1: -.#X666    !$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(((r"c`Kt||fd}|xjdz c_||_|j||j}|t |r|t|s8 t|}n#t$rtwxYwt |r|n&t|r||i|d{V}n||i|}|tur|S|j tur|jS|j4t|jr|j|i|d{VS|j|i|S|jS)NTrr)rrrrr,rrArkr StopIterationStopAsyncIterationrrrrr)rWrXrYrrr}s r#rz!AsyncMockMixin._execute_mock_callstVn$/// A ##E***!  V$$ 1 v&& 1-!&\\FF$----,-!((! L!$V,, 1%vt6v66666666000W$$  "' 1 1$ $   '"4#344 ?-T-t>v>>>>>>>>>#4#T4V44 4  s 1BBcT|jdkrd|jpdd}t|dS)zA Assert that the mock was awaited at least once. r Expected rDz to have been awaited.Nrrrrs r#rzAsyncMockMixin.assert_awaiteds?  q Odo7OOOC %% % ! r"cd|jdks$d|jpdd|jd}t|dS)z@ Assert that the mock was awaited exactly once. rrrD$ to have been awaited once. Awaited rNrrs r#rz"AsyncMockMixin.assert_awaited_oncesW1$$9t8&99#/999C %% %%$r"chj)}td|dfd}t fd}j}||kr1t |t r|nd}t||dS)zN Assert that the last await was with the specified arguments. NzExpected await: z Not awaitedc8d}|S)Nawait)rrrs r#rz:AsyncMockMixin.assert_awaited_with.._error_messages"33D&3QQCJr"Tr)rrrrrr/r)rWrXrYrrrrs``` r#rz"AsyncMockMixin.assert_awaited_withs ? "77fEEH !KH!K!K!KLL L       %%eT6N&E&E&EFF##DO44 X   *8Y ? ?IHHTE !1!122 =  r"cz|jdks$d|jpdd|jd}t||j|i|S)zi Assert that the mock was awaited exactly once and with the specified arguments. rrrDr r)rrrrrs r#rz'AsyncMockMixin.assert_awaited_once_withsg 1$$9t8&99#/999C %% %'t'8888r"c$t||fd}t|tr|nd}fdjD}|s|t |vr)||}td|z|dS)zU Assert the mock has ever been awaited with the specified arguments. TrNc:g|]}|Sr!rrs r#rrz3AsyncMockMixin.assert_any_await.. s'FFFA$$$Q''FFFr"z%s await not found)rrr/rrrrrrs` r#rzAsyncMockMixin.assert_any_await s%%eT6N&E&E&EFF&x;;EFFFF1EFFF  HL$8$888">>tVLLO $6 98r"Fc*fd|D}td|Dd}tfdjD}|sT||vrN|d}ndd|D}t |dt|d j|dSt |}g}|D]=} ||#t$r||Y:wxYw|r t t|d |dS) a Assert the mock has been awaited with the specified calls. The :attr:`await_args_list` list is checked for the awaits. If `any_order` is False (the default) then the awaits must be sequential. There can be extra calls before or after the specified awaits. If `any_order` is True then the awaits can be in any order, but they must all appear in :attr:`await_args_list`. c:g|]}|Sr!rrs r#rrz4AsyncMockMixin.assert_has_awaits..# rr"c3DK|]}t|t|VdSr<rrts r#rz3AsyncMockMixin.assert_has_awaits..$ rr"Nc3BK|]}|VdSr<rrs r#rz3AsyncMockMixin.assert_has_awaits..% s1SSt11!44SSSSSSr"zAwaits not found.z,Error processing expected awaits. Errors: {}c@g|]}t|tr|ndSr<rrts r#rrz4AsyncMockMixin.assert_has_awaits..- rr"rz Actual: z not all found in await list) rrrrrrmrrNr,rn) rWrrrr all_awaitsrrrs ` r#rz AsyncMockMixin.assert_has_awaits s:9995999FFFFFMMSSSSd>RSSSSS  z))=1GG ,-3V$7$7-5$7$7$7.8.8%66!*5!1!166#366  F*%%   ' 'D '!!$'''' ' ' '  &&&&& '   49)4D4D4D4DF   s6C  C.-C.cd|jdkr$d|jpdd|jd}t|dS)z9 Assert that the mock was never awaited. rrrDz# to not have been awaited. Awaited rNrrs r#rz!AsyncMockMixin.assert_not_awaitedC sW  q 9t8&99#/999C %% % ! r"c|tj|i|d|_d|_t |_dS)z0 See :func:`.Mock.reset_mock()` rN)rrrrrr)rWrXrYr6s r#rzAsyncMockMixin.reset_mockL sB D+F+++({{r"r)rrrrrrrrHrrrrrrrrr __classcell__)r6s@r#rrs&&}55K%%l33J**+<==O000008&!&!&!P&&&&&&>>>$ 9 9 9   ****X&&&+++++++++r"rceZdZdZdS)r aY Enhance :class:`Mock` with features allowing to mock an async function. The :class:`AsyncMock` object will behave so the object is recognized as an async function, and the result of a call is an awaitable: >>> mock = AsyncMock() >>> iscoroutinefunction(mock) True >>> inspect.isawaitable(mock()) True The result of ``mock()`` is an async function which will have the outcome of ``side_effect`` or ``return_value``: - if ``side_effect`` is a function, the async function will return the result of that function, - if ``side_effect`` is an exception, the async function will raise the exception, - if ``side_effect`` is an iterable, the async function will return the next value of the iterable, however, if the sequence of result is exhausted, ``StopIteration`` is raised immediately, - if ``side_effect`` is not defined, the async function will return the value defined by ``return_value``, hence, by default, the async function returns a new :class:`AsyncMock` object. If the outcome of ``side_effect`` or ``return_value`` is an async function, the mock async function obtained when the mock object is called will be this async function itself (and not an async function returning an async function). The test author can also specify a wrapped object with ``wraps``. In this case, the :class:`Mock` object behavior is the same as with an :class:`.Mock` object: the wrapped object may have methods defined as async function functions. Based on Martin Richard's asynctest project. Nrr!r"r#r r V s''''r"r c$eZdZdZdZdZdZdS)_ANYz2A helper object that compares equal to everything.cdSrr!rWrs r#rz _ANY.__eq__ str"cdSrr!rs r#rz _ANY.__ne__ sur"cdS)Nzr!rs r#rz _ANY.__repr__ swr"N)rrrr rrrr!r"r#rr sG88r"rcd|z}d}dd|D}dd|D}|r|}|r |r|dz }||z }||zS)Nz%s(%%s)r z, c,g|]}t|Sr!)repr)r)rRs r#rrz*_format_call_signature.. s7773T#YY777r"c"g|] \}}|d| S)=r!)r)rMrs r#rrz*_format_call_signature.. s4#-3333r")rdrO)r*rXrYrformatted_args args_string kwargs_strings r#rr s$GN))77$77788KII17M%$(  # d "N-' ^ ##r"ceZdZdZ ddZ ddZd ZejZd Z d Z d Z d Z e dZe dZdZdZdS)ra A tuple for holding the results of a call to a mock, either in the form `(args, kwargs)` or `(name, args, kwargs)`. If args or kwargs are empty then a call tuple will compare equal to a tuple without those values. This makes comparisons less verbose:: _Call(('name', (), {})) == ('name',) _Call(('name', (1,), {})) == ('name', (1,)) _Call(((), {'a': 'b'})) == ({'a': 'b'},) The `_Call` object provides a useful shortcut for comparing with call:: _Call(((1, 2), {'a': 3})) == call(1, 2, a=3) _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3) If the _Call has no name then it will match any name. r!r NFTcd}i}t|}|dkr|\}}}n~|dkr<|\} } t| tr| }t| tr| }nD| }nA| | }}n<|dkr6|\}t|tr|}nt|tr|}n|}|rt|||fSt||||fS)Nr!rr)rr/rZrnr) rrr*rr from_kallrXrY_lenfirstseconds r#rz _Call.__new__ s5zz 199!& D$ QYY!ME6%%% -fe,,$!DD#FF$ff QYYFE%%% E5))   6==tVn55 5}}S4v"6777r"c0||_||_||_dSr<)rr_mock_from_kall)rWrr*rrr+s r#rHz_Call.__init__ s"(r"cr t|}n#t$r tcYSwxYwd}t|dkr|\}}n|\}}}t|ddr#t|ddr|j|jkrdSd}|dkrdi}}n|dkr|\}}}n|dkr?|\} t | t r| }i}nit | tr| }di}}nMd}| }nH|dkr@|\} } t | tr!| }t | t r| i}}n d| }}n| | }}ndS|r||krdS||f||fkS) Nr rrFrr!r*r)rrrr1rr/rnrZ) rWr len_other self_name self_args self_kwargs other_name other_args other_kwargsrr-r.s r#rz _Call.__eq__ s "E II " " "! ! ! ! " t99>>%) "I{{04 -Iy+ D.$ / / GE>SW4X4X %);;;5 >>')2 JJ !^^38 0J LL !^^FE%'' %" ! E3'' %" +-rL  $ !^^!ME6%%% 9" fe,,:/5r JJ/16 JJ+0&L 5  y005L)i-EEEs &&c|jtd||fdS|jdz}t|j||f||S)Nr r/rrrrrs r#rKz_Call.__call__ sN ? ""dF+$777 7%dotV44MMMMr"cn|jt|dS|jd|}t||dS)NF)r*r+rI)r*rr+r:)rWrr*s r#rz_Call.__getattr__ sD ? "de444 4///440$tu====r"cb|tjvrtt||Sr<)rnrrrL__getattribute__)rWrs r#r=z_Call.__getattribute__$ s+ 5> ! ! %%dD111r"cHt|dkr|\}}n|\}}}||fS)Nr)rrs r#_get_call_argumentsz_Call._get_call_arguments* s2 t99>>LD&&!% D$V|r"c6|dSNrr?rs r#rXz _Call.args2 ''))!,,r"c6|dS)NrrBrs r#rYz _Call.kwargs6 rCr"c|js%|jpd}|drd|z}|St|dkrd}|\}}n+|\}}}|sd}n |dsd|z}nd|z}t |||S)Nrr/zcall%srzcall.%s)r0rr(rr)rWr*rXrYs r#rz_Call.__repr__: s# ?,fDt$$ '$K t99>>DLD&&!% D$ '__T** ' 4'$%dD&999r"cg}|}|%|jr|||j}|%tt |S)zFor a call object that represents multiple calls, `call_list` returns a list of all the intermediate calls as well as the final call.)r0r,rrrc)rWvalsthings r# call_listz_Call.call_listO sW$ # E"""&E$(((r")r!r NFT)r!NNFT)rrrr rrHrrwrrKrr=r?rrXrYrrIr!r"r#rr s$:?8888@>C))))2F2F2Fj]FNNN>>>222 --X---X-:::* ) ) ) ) )r"r)r+c $t|rt|}t|t}t|rt d|dt |}d|i} |rd|i} n|i} | r|rd| d<|st || |t} tj |ri} nL|r|rtdt} n1t|st} n|r|rt|st} | d |}|} |d } | d||| |d | } t|t"r"t%| |} |rt'| nt)|| ||| |s | |j|<|d } |r |sd |vrt/||dd| | | _t3|D];}t5|r t7||}n#t8$rY1wxYwd|i}| r&t;| |r|||rd|i}t|t"st=||| ||}|| j|<n{| }t|t"r| j}tA|||}||d<tC|rt}nt}|d||||d|}|| j|<t)|||t|t"rtE| ||=| S)aCreate a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the `spec` object as their spec. Functions or methods being mocked will have their arguments checked to check that they are called with the correct signature. If `spec_set` is True then attempting to set attributes that don't exist on the spec object will raise an `AttributeError`. If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by passing `instance=True`. The returned mock will only be callable if instances of the mock are callable. `create_autospec` will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock.z'Cannot autospec a Mock object. [object=r%rrNTrzJInstance can not be True when create_autospec is mocking an async functionr*r )rrrr*rrr/)rar8rrrpr)rr*rr)r`r!)#ror>r/r.rr:rr rr2isdatadescriptorrr rkr rurQrErrrbrrsr rr+rr1rLr0rCrD _must_skiprrg)rrrarr8rrYis_type is_async_funcrBrArrDwrappedrKr|r rr` child_klasss r#r r _ s.~~Dzzt$$G5 4*. 4 4 455 5"4((MtnGt$ ,8,'+#$ &f%%% NN6 E%% % %  ? >?? ? t__%$ %X%&8&>&>%$ KK & &EI 5 (W  ( (& ( (D$ &&8dD))  $ d # # #tWh7778(,u%jj!!G;x;N&$@$@+D(T2629;;;T3&3& U     tU++HH    H (#  *ww.. * MMM ) ) )  , (+F(M22 AXxuhGGC),D  & &F$ .. #"488I"+F; "8,, (' ' +(V%5*0(( &((C*-D  & Xsi @ @ @ @ c= ) ) & D% % % % Ks'G88 HHcDt|ts|t|divrdS|j}|jD]f}|j|t}|tur,t|ttfrdSt|tr|cSdS|S)z[ Return whether we should skip the first argument on spec's `entry` attribute. rrF) r/r>r1r6rqrrrsrrJrIrE)rrKrMrr}s r#rLrL s dD ! ! GD*b11 1 15~  ##E733 W    f|[9 : : 55  . . NNN55 Nr"ceZdZ ddZdS)rCFNcZ||_||_||_||_||_||_dSr<)ridsrrrar*)rWrrrr*rTras r#rHz_SpecState.__init__ s0       r")FNNNFrr!r"r#rCrC s.48/4r"rCc|t|trtj|Stj|Sr<)r/bytesioBytesIOStringIO) read_datas r# _to_streamr[% s4)U##&z)$$${9%%%r"r c V t}|dg fd} fd} fd fd fd}tdddl}tt t |jt t |jat2ddl}tt t |j a |tdt }tt  j _ d j_ d j_ d j_ d j_ | j_ d < d  j_| j_ j_| j_ fd }||_ |_ |S) a A helper function to create a mock to replace the use of `open`. It works for `open` called directly or used as a context manager. The `mock` argument is the mock object to configure. If `None` (the default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. `read_data` is a string for the `read`, `readline` and `readlines` of the file handle to return. This is an empty string by default. NcZjj jjSdj|i|SrA) readlinesrrXrY_statehandles r#_readlines_side_effectz)mock_open.._readlines_side_effect; s7   ( 4#0 0"vay"D3F333r"cZjj jjSdj|i|SrA)readrr_s r#_read_side_effectz$mock_open.._read_side_effect@ s4 ; # /;+ +vay~t.v...r"c?VKEd{V dj|i|VNTr)readline)rXrY_iter_side_effectr`s r#_readline_side_effectz(mock_open.._readline_side_effectE sT$$&&&&&&&&& 6$&)$d5f55 5 5 5 6r"c3bKjj jjVdD]}|VdSrg)rhr)liner`ras r#riz$mock_open.._iter_side_effectJ sU ? ' 3 3o2222 31I  DJJJJ  r"c^jj jjStdSrA)rhrr)r`rasr#_next_side_effectz$mock_open.._next_side_effectQ s) ? ' 3?/ /F1Ir"ropen)r*r)rrctd<jjdkrd<dj_tS)Nrr)r[rhrr)rXrYrjr`rarZs r# reset_datazmock_open..reset_dataq sMy))q ? &&) 3 3--//F1I*0)FO 'r")r[ file_spec_iormryr+ TextIOWrapperunionrX open_specrorrFrwriterdrhr^rrr) rDrZ _read_datarbrernrsrqrirjr`ras ` @@@@r#rr, sI&&J$ F444444 ////// 666666   S!23344::3s3;?O?O;P;PQQRR  S]]++,,  |f9555 I & & &F$*F! $FL#FK#'FO $(F!/FK%%''F1I"()FO#9F "3FO"3FO"DD Kr"c&eZdZdZdZddZdZdS)raW A mock intended to be used as a property, or other descriptor, on a class. `PropertyMock` provides `__get__` and `__set__` methods so you can specify a return value when it is fetched. Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. c tdi|S)Nr!)r)rWrYs r#r1zPropertyMock._get_child_mock s""6"""r"Nc|Sr<r!)rWr5obj_types r#rzPropertyMock.__get__ s tvv r"c||dSr<r!)rWr5rSs r#rzPropertyMock.__set__ s S r"r<)rrrr r1rrr!r"r#rr~ sP###r"rc4d|_t|D]} t||}n#t$rY wxYwt |t s:t |j|trh|j |urt|dS)aDisable the automatic generation of child mocks. Given an input Mock, seals it to ensure no further mocks will be generated when accessing an attribute that was not already defined. The operation recursively seals the mock passed in, meaning that the mock itself, any mocks generated by accessing one of its attributes, and all assigned mocks without a name or spec will be sealed. TN) r r+r1rLr/r rrsrCrr)rDrrs r#rr sDD   d##AA    H !_--   a&**400* = =    % % GGG  s + 88ceZdZdZdZdZdS)rz8 Wraps an iterator in an asynchronous iterator. ct||_tt}tj|_||jd<dS)Nrr8)iteratorr rr2CO_ITERABLE_COROUTINErrr)rWrrs r#rHz_AsyncIterator.__init__ s6  #X666 $: $- j!!!r"c^K t|jS#t$rYnwxYwtr<)rrrrrs r#rz_AsyncIterator.__anext__ sA  && &    D   s  %%N)rrrr rHrr!r"r#rr s<... !!!!!r"rr)NFNNN)FFNN)Nr )__all__rrrWr2rr>builtinsrTrtypesrrr unittest.utilr functoolsrr threadingrrrr+r3r rrr6r:r.rArFrRrbr]rkrorurr{rrrwrrrrMISSINGrDELETEDrDrrrmrrrrr rMrHrrr=rrrrrVr[r_rrbrzrremultiplestopallr magic_methodsnumericsrdrPinplaceright _non_defaultsrrr_sync_async_magics _async_magicsrr_rrrrrrrrrrrr rrrrr rrrrnrrr rLrCr>rrErrrvr[rrrrr!r"r#rs5  &  ''''''2222222222######$$$$$$$$CCCCCyCCC I Hcc(mm H H H   @@@222    F # # # #   &&&   6."."."b>>>6))) ) ) ) ) )f ) ) )         9;;         &********(6      6   N <N <N <N <N       :         j        D   ,""""""""$@+@+@+@+@+T@+@+@+F((((((((V     6    dff$$$$v)v)v)v)v)Ev)v)v)r uuCGO*/OOOOOd8         DD     &&&OOOOd4$0!!!!!!!!!!r"PK!AEE'__pycache__/suite.cpython-311.opt-1.pycnu[ 0i4dZddlZddlmZddlmZdZdZGdd eZGd deZ Gd d eZ d Z GddeZ dS) TestSuiteN)case)utilTc>t||d}|dS)NcdSNr 5/opt/alt/python311/lib64/python3.11/unittest/suite.pyz!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s$ 64 . .DDFFFFFr cZeZdZdZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZdS) BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. Tr cLg|_d|_||dSNr)_tests_removed_testsaddTests)selftestss r __init__zBaseTestSuite.__init__s)  er c\dtj|jdt|dS)N)rstrclass __class__listrs r __repr__zBaseTestSuite.__repr__s+"&-"?"?"?"?dLLr czt||jstSt|t|kSr ) isinstancer!NotImplementedr")rothers r __eq__zBaseTestSuite.__eq__s3%00 "! !DzzT%[[((r c*t|jSr )iterrr#s r __iter__zBaseTestSuite.__iter__"sDK   r cP|j}|D]}|r||z }|Sr )rcountTestCases)rcasestests r r.zBaseTestSuite.countTestCases%s=# / /D /,,... r c@t|s/tdt|t |t r0t |tjtfrtd|j |dS)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr&type issubclassrTestCaserrappendrr0s r addTestzBaseTestSuite.addTest,s~~ E077T CCDD D dD ! ! @j26-1K'M'M @?@@ @ 4     r ct|trtd|D]}||dS)Nz0tests must be an iterable of tests, not a string)r&strr3r;)rrr0s r rzBaseTestSuite.addTests6sR eS ! ! PNOO O  D LL      r ct|D]5\}}|jrn(|||jr||6|Sr ) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr0s r runzBaseTestSuite.run<s\$T?? / /KE4   DLLL} /''... r c |j|}t|dr"|xj|z c_d|j|<dS#t$rYdSwxYw)z2Stop holding a reference to the TestCase at index.r.N)rhasattrrr.r3)rrDr0s r rBz BaseTestSuite._removeTestAtIndexEs~ &;u%Dt-.. =##t':':'<'<<##!%DK       DD s A AAc|j|i|Sr rE)rargskwdss r __call__zBaseTestSuite.__call__Sstx&&&&r c8|D]}|dS)7Run the tests without collecting errors in a TestResultN)debugr:s r rOzBaseTestSuite.debugVs*  D JJLLLL  r N)r )__name__ __module__ __qualname____doc__rArr$r)r,r.r;rrErBrLrOr r r rrsH MMM))) !!!!!!  & & &'''r rcReZdZdZd dZdZdZdZdZ dd Z dd Z d Z d Z dS)raA test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. Fcld}t|dddur dx|_}t|D]\}}|jrnt |rv||||||||||j|_ t|jddst|ddr|s ||n| |j r| ||r2|d|| |d|_|S)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrVr?r@ _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr!_previousTestClassrOrArB_handleModuleTearDown)rrCrOtopLevelrDr0s r rEz TestSuite.runfsb 6,e 4 4 = =04 4F "X$T?? / /KE4  4   ++D&999))$777&&tV444,0N)DN,?GGF$8%@@ V  } /''...  +  ' 'f 5 5 5  & &v . . .%*F " r cNt}||ddS)rNTN) _DebugResultrE)rrOs r rOzTestSuite.debugs% r ct|dd}|j}||krdS|jrdSt|ddrdSd} d|_n#t$rYnwxYwt|dd}t|dd}|t |d |nt#t $rg}t|trd} d|_n#t$rYnwxYwtj |} | ||d| Yd}~nd}~wwxYw|r6|4||j D]"} | || dd| | #t |d dS#t |d wxYwdS) Nr]__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) rr!rXrWr3r Exceptionr&rarr "_createClassOrModuleLevelExceptiontearDown_exceptions) rr0rC previousClass currentClassfailedrdree classNameexc_infos r r\zTestSuite._handleClassSetUps8(> !,0A4HH  ! FN 3 3 3 : GJLLLL G G G!&,77!F9= 66$ $ l ; ;I;;FAd}t|dd}||j}|S)Nr])rrQ)rrCpreviousModulerms r _get_previous_modulezTestSuite._get_previous_modules-(> * * * * * -s|~~66666t,,,,,r c|||}|dS|jrdS tj|}n#t$rYdSwxYwt |d t |dd}|Q |nE#t$r8}t|tr| ||d|Yd}~nd}~wwxYw tj nE#t$r8}t|tr| ||d|Yd}~nd}~wwxYwt |ddS#t |dwxYw)NrftearDownModuleri) rurXrxryrzrrrjr&rarkrr{)rrCrtr}rrps r r^zTestSuite._handleModuleTearDowns226::  ! F  $  F [0FF    FF  /// 6$V-=tDDN)L"N$$$$ LLL!&,77;;FACD) D.D D)DD))D;ct|dd}|j}||ks|dSt|ddrdSt|ddrdSt|ddrdSt|dd}t|dd}||dSt|d |e |nY#t$rL}t |t rt j|}|||d|Yd}~nd}~wwxYw|e||j D]S} t |t r| d t j|}||| d d|| Tt|d dS#t|d wxYw) Nr]rWFrXrc tearDownClassrerfrrgri) rr!rrjr&rarr rkrl) rr0rCrmrnrrerprqrrs r rZz TestSuite._tearDownPreviousClasss%(rs      IIIIIFIIIXi6i6i6i6i6 i6i6i6X$$$$$6$$$L6r PK!b6ss&__pycache__/util.cpython-311.opt-2.pycnu[ 0i_ ddlmZmZddlmZdZdZdZdZdZ dZ eeeze zeze zz Z dZ dZ dd Zd Zd Zd ZdZeddZdZdZdS)) namedtupleCounter) commonprefixTP ct||z |z }|tkr(d|d|||t||z dfz}|S)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips 4/opt/alt/python311/lib64/python3.11/unittest/util.py_shortenrsW q66I  )D  *9* tQs1vv 7I7J7J5KL L Hcttt|}ttt|}|t kr|St |t t |z tztzz }|tkr2tt|tfd|DSttttfd|DS)Nc32K|]}|dzVdSN.0r prefixr s r z'_common_shorten_repr..'s0::Va m+::::::rc3dK|]*}t|dttzV+dSr)r _MIN_DIFF_LEN _MIN_END_LENrs rrz'_common_shorten_repr..*sP  (1YZZ=-NNN      r) tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr(s Y%% & &D S$ F  $  FF I9$~58HHJJO##&.*==:::::T:::::: fno > >F            rFc t|}n*#t$rt|}YnwxYw|rt |t kr|S|dt dzS)Nz [truncated]...)repr Exceptionobject__repr__r r")objshortresults rr r -sv&c &&&%%& CKK+-- ,;, "3 33s $99c$|jd|jS)N.) __module__ __qualname__)clss rstrclassr66snnnc&6&6 77rc dx}}g}g} ||}||}||kr8|||dz }|||kr|dz }|||kn||kr8|||dz }|||kr|dz }|||knm|dz } |||kr|dz }|||k|dz }|||kr|dz }|||kn'#|dz }|||kr|dz }|||kwxYwnJ#t$r=|||d|||dYnwxYwG||fS)NrT)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerD9s IAGJ  Aq A1uuq!!!QqkQ&&FAqkQ&&Q!!!$$$QQi1nnFAQi1nnQ"1+**Q#1+**FA )q..Q!)q..FA )q..Q!)q......    NN8ABB< ( ( (   fQRRj ) ) ) E /6 J s+BDC;#D$DDAE  E c g}|rR|} ||n%#t$r||YnwxYw|R||fSr)popremove ValueErrorr9)r<r=r@items runorderable_list_differencerJbs G !||~~ ! MM$     ! ! ! NN4  ! ! F?s1AAc ||k||kz Srr)xys r three_way_cmprNss8 Ea!e rMismatchzactual expected valuec t|t|}}t|t|}}t}g}t|D]\}} | |ur dx} } t ||D]} || | kr | dz } ||| <t|D]\} } | | kr | dz } ||| <| | kr&t | | | }||t|D][\}} | |ur d} t ||D]} || | kr | dz } ||| <t d| | }||\|S)Nrr8)listr r, enumeraterange _Mismatchr9)r=r<r tmnNULLr0r>elemcnt_scnt_tr? other_elemdiffs r_count_diff_all_purposer^ysN <<hqA q663q66qA 88D FQ<<  4 4<< q!  Att|| !&q\\  MAzT!! ! E>>UE400D MM$   Q<<  4 4<< q!  Att|| !E4(( d Mrc t|t|}}g}|D]G\}}||d}||kr&t|||}||H|D]/\}}||vr&td||}||0|S)Nr)ritemsgetrTr9) r=r<r rUr0rYrZr[r]s r_count_diff_hashablerbsN 6??GH--qA Fwwyy  edA E>>UE400D MM$   wwyy  e q==Qt,,D MM$    MrN)F) collectionsrros.pathr __unittestr"r r#rr$rrr(r r6rDrJrNrTr^rbrrrrfs% ++++++++    !11OC !#/01       *4444888&&&R" Jz#: ; ; !!!FrPK!}3׶22"__pycache__/result.cpython-311.pycnu[ 0iF!hdZddlZddlZddlZddlmZddlmZdZdZ dZ d Z Gd d e Z dS) zTest result objectN)utilwrapsTc<tfd}|S)Ncft|ddr||g|Ri|S)NfailfastF)getattrstop)selfargskwmethods 6/opt/alt/python311/lib64/python3.11/unittest/result.pyinnerzfailfast..inner sD 4U + +  IIKKKvd(T(((R(((r)rrs` rr r s3 6]]))))]) Lrz Stdout: %sz Stderr: %sceZdZdZdZdZdZddZdZdZ dZ dZ d Z d Z d Zed Zed ZdZdZdZdZedZdZdZdZdZdZdZdZdS) TestResultaHolder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. NFcd|_g|_g|_d|_g|_g|_g|_d|_d|_d|_ d|_ d|_ tj |_tj|_d|_dS)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccesses shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__zTestResult.__init__&s|     "#%  "" #  # "rcdS)z#Called by TestRunner after test runNr s r printErrorszTestResult.printErrors7rc\|xjdz c_d|_|dS)z-Called when the given test is about to be runrFN)rr& _setupStdoutr tests r startTestzTestResult.startTest:s2  " rc|jr[|j0tj|_tj|_|jt _|jt _dSdS)N)rr ioStringIOrr!r"r$r-s rr1zTestResult._setupStdout@sS ; -"*&(kmm#&(kmm#,CJ,CJJJ  - -rcdS)zpCalled once before any tests are executed. See startTest for a method called before each test. Nr,r-s r startTestRunzTestResult.startTestRunHr/rc<|d|_dS)z'Called when the given test has been runFN)_restoreStdoutr&r2s rstopTestzTestResult.stopTestNs" "rc|jrI|jrtj}tj}|r<|ds|dz }|jt|z|r<|ds|dz }|j t|z|jt_|j t_|j d|j |j d|jdSdS)N r)rr&r!r"getvaluer$endswithr#write STDOUT_LINEr% STDERR_LINErseektruncater )r outputerrors rr;zTestResult._restoreStdoutSs> ; +! E,,.. ++--F!??400'$)// f0DEEEE >>$//& )// e0CDDD.CJ.CJ   $ $Q ' ' '   ( ( * * *   $ $Q ' ' '   ( ( * * * * *% + +rcdS)zmCalled once after all tests are executed. See stopTest for a method called after each test. Nr,r-s r stopTestRunzTestResult.stopTestRunhr/rct|j||||fd|_dS)zmCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). TN)rappend_exc_info_to_stringr&r r3errs raddErrorzTestResult.addErrorns= D$":":3"E"EFGGG!rct|j||||fd|_dS)zdCalled when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)rrKrLr&rMs r addFailurezTestResult.addFailurevs= dD$<$|j||fdS)zCalled when a test is skipped.N)rrK)r r3reasons raddSkipzTestResult.addSkips" T6N+++++rcf|j||||fdS)z/Called when an expected failure/error occurred.N)rrKrLrMs raddExpectedFailurezTestResult.addExpectedFailures? $$ 4++C66 7 9 9 9 9 9rc:|j|dS)z5Called when a test was expected to fail, but succeed.N)rrKr2s raddUnexpectedSuccesszTestResult.addUnexpectedSuccesss!  ''-----rct|jt|jcxkodknco(t|d pt|jdkS)z/Tells whether or not this result was a success.rr)lenrrhasattrrr-s r wasSuccessfulzTestResult.wasSuccessfulsj T]##s4;'7'7<<<<1<<<<5T#89994T-..!3 6rcd|_dS)z+Indicates that the tests should be aborted.TN)rr-s rr zTestResult.stops rcP|\}}}|||||}tj||||jd}t |}|jrtj }tj } |r7| ds|dz }| t|z| r7| ds| dz } | t| zd|S)z>Converts a sys.exc_info()-style tuple of values into a string.T)capture_localscompactr>)_clean_tracebacks tracebackTracebackExceptionrlistformatrr!r"r?r$r@rKrBrCjoin) r rNr3exctypevaluetbtb_emsgLinesrFrGs rrLzTestResult._exc_info_to_strings   # #GUB = =+ UB>4999 && ; 5Z((**FJ''))E 6t,,#dNF f 4555 5~~d++"TME e 3444wwx   rcd}d}|||fg}t|h}|r|\}}}|r3||r|j}|r||||jur|||r|}d}n||_|p|j|jfD]a} | ]t| |vrL| t| | | jf| t| b||S)NTF) idpop_is_relevant_tb_leveltb_nextrT_remove_unittest_tb_frames __traceback__ __cause__ __context__rKtypeadd) r rorprqr3retfirstexcsseencs rrizTestResult._clean_tracebackssC%$%5 { (#'88:: WeR 33B77 Z 33B77 $/////333 )&(# /5+<=((A}Ad):): T!WWa$ABBBA) (* rcd|jjvS)N __unittest)tb_frame f_globals)r rqs rrwz TestResult._is_relevant_tb_levelsr{444rcd}|r5||s |}|j}|r|| | d|_dSdS)aTruncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified. N)rwrx)r rqprevs rryz%TestResult._remove_unittest_tb_framessl 33B77 DB 33B77   DLLL  rcdtj|j|jt |jt |jfzS)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rrarrr-s r__repr__zTestResult.__repr__s@3 dn--t}c$+>N>NDM""$$ %r)NNN)__name__ __module__ __qualname____doc___previousTestClass_testRunEntered_moduleSetUpFailedr*r.r4r1r9r<r;rIr rOrQrVrXr[r]r_rcr rLrirwryrr,rrrrs  O####"... ---   ### +++*   ""X"""X" &&&"   ,,,999 ..X.666!!!,8555    %%%%%rr)rr6r!rjrhr functoolsrrr rBrCobjectrr,rrrs     \%\%\%\%\%\%\%\%\%\%rPK!mvn@n@"__pycache__/runner.cpython-311.pycnu[ 0i$dZddlZddlZddlZddlmZddlmZddlm Z dZ Gdd e Z Gd d ej ZGd d e ZdS)z Running testsN)result)_SubTest)registerResultTc&eZdZdZdZdZddZdS)_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodc||_dSN)stream)selfr s 6/opt/alt/python311/lib64/python3.11/unittest/runner.py__init__z_WritelnDecorator.__init__s  cR|dvrt|t|j|S)N)r __getstate__)AttributeErrorgetattrr )r attrs r __getattr__z_WritelnDecorator.__getattr__s. - - - && &t{4(((rNc^|r|||ddSN )write)r args r writelnz_WritelnDecorator.writelns1   JJsOOO 4rr )__name__ __module__ __qualname____doc__rrrrr rrsLJJ))) rrceZdZdZdZdZfdZdZfdZdZ fdZ fd Z fd Z fd Z fd Zfd ZfdZdZdZxZS)TextTestResultzhA test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------ctt||||||_|dk|_|dk|_||_d|_dS)NrT)superr"rr showAlldots descriptions_newline)r r r' verbosity __class__s r rzTextTestResult.__init__&sU nd##,,V\9MMM  1} N ( rc|}|jr&|r$dt||fSt|Sr)shortDescriptionr'joinstr)r testdoc_first_lines r getDescriptionzTextTestResult.getDescription.sN..00    99c$ii899 9t99 rc8tt|||jri|j|||jd|jd|_dSdS)N ... F) r$r" startTestr%r rr1flushr(r r/r*s r r4zTextTestResult.startTest5s nd##--d333 < " K  d11$77 8 8 8 K  g & & & K     !DMMM  " "rct|t}|s|jr|js|j|r|jd|j|||jd|j||jd|_dS)Nz r3T) isinstancerr(r rrr1r5)r r/status is_subtests r _write_statuszTextTestResult._write_status=sh//  ' '= & ##%%% ( !!$''' K  d11$77 8 8 8 K  g & & & F###  rc||jrIt|d|jr||dn||dnp|jrit|d|jr|jdn|jd|jtt| |||dS)NrFAILERRORFE) r% issubclassfailureExceptionr;r&r rr5r$r" addSubTest)r r/subtesterrr*s r rCzTextTestResult.addSubTestJs ?| $c!fg&>??9&&w7777&&w8888 $c!fg&>??+K%%c****K%%c*** !!### nd##..tWcBBBBBrctt|||jr||ddS|jr5|jd|jdSdS)Nok.) r$r" addSuccessr%r;r&r rr5r6s r rIzTextTestResult.addSuccessYs nd##..t444 <   tT * * * * * Y K  c " " " K         rctt||||jr||ddS|jr5|jd|jdSdS)Nr>r@) r$r"addErrorr%r;r&r rr5r r/rEr*s r rKzTextTestResult.addErroras nd##,,T3777 <   tW - - - - - Y K  c " " " K         rctt||||jr||ddS|jr5|jd|jdSdS)Nr=r?) r$r" addFailurer%r;r&r rr5rLs r rNzTextTestResult.addFailureis nd##..tS999 <   tV , , , , , Y K  c " " " K         rc6tt||||jr+||d|dS|jr5|jd|j dSdS)Nz skipped {0!r}s) r$r"addSkipr%r;formatr&r rr5)r r/reasonr*s r rQzTextTestResult.addSkipqs nd##++D&999 <   t_%;%;F%C%C D D D D D Y K  c " " " K         rcJtt||||jr5|jd|jdS|jr5|jd|jdSdS)Nzexpected failurex) r$r"addExpectedFailurer%r rr5r&rrLs r rVz!TextTestResult.addExpectedFailureys nd##66tSAAA < K   2 3 3 3 K        Y K  c " " " K         rcHtt|||jr5|jd|jdS|jr5|jd|jdSdS)Nzunexpected successu) r$r"addUnexpectedSuccessr%r rr5r&rr6s r rYz#TextTestResult.addUnexpectedSuccesss nd##88>>> < K   4 5 5 5 K        Y K  c " " " K         rc|js|jr2|j|j|d|j|d|jt|dd}|ro|j|j |D]2}|jd| |3|jdSdS)Nr>r=unexpectedSuccessesr zUNEXPECTED SUCCESS: ) r&r%r rr5printErrorListerrorsfailuresr separator1r1)r r[r/s r printErrorszTextTestResult.printErrorss 9   K   ! ! ! K      GT[111 FDM222%d,A2FF  K   0 0 0+ X X ##$V4;N;Nt;T;T$V$VWWWW K          rcb|D]\}}|j|j|j|d|||j|j|jd|z|jdS)Nz: z%s)r rr_r1 separator2r5)r flavourr]r/rEs r r\zTextTestResult.printErrorLists  ID# K   0 0 0 K  GGGD4G4G4M4M4M N O O O K   0 0 0 K  s + + + K         r)rrrrr_rbrr1r4r;rCrIrKrNrQrVrYr`r\ __classcell__)r*s@r r"r"sWJJ"""""    C C C C C                                         rr"c4eZdZdZeZ d dddZdZd ZdS) TextTestRunnerzA test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. NTrF) tb_localsc| tj}t||_||_||_||_||_||_||_ | ||_ dSdS)zConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysstderrrr r'r)failfastbufferrgwarnings resultclass) r r r'r)rkrlrnrmrgs r rzTextTestRunner.__init__sf >ZF'// ("   "   "*D    # "rcN||j|j|jSr )rnr r'r))r s r _makeResultzTextTestRunner._makeResults! T->OOOrc|}t||j|_|j|_|j|_t j5|jr>t j|j|jdvrt jdtdtj }t|dd}| | ||t|dd}| |n##t|dd}| |wwxYwtj }dddn #1swxYwY||z }|j t|dr|j|j|j}|jd ||d krd pd |fz|jd x} x} } t't(|j|j|jf} | \} } } n#t0$rYnwxYwg} |jsw|jdt)|jt)|j}}|r| d|z|r| d|zn|jd| r| d| z| r| d| z| r| d| z| r2|jdd| dn|jd|j|S)z&Run the given test case or test suite.)defaultalwaysmodulezPlease use assert\w+ instead.)categorymessage startTestRunN stopTestRunrbzRan %d test%s in %.3fsrrPrFAILEDz failures=%dz errors=%dOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rprrkrlrgrmcatch_warnings simplefilterfilterwarningsDeprecationWarningtime perf_counterrr`hasattrr rrbtestsRunmaplenexpectedFailuresr[skippedr wasSuccessfulrr^r]appendr-r5)r r/r startTimerwrxstopTime timeTakenrun expectedFailsr[rresultsinfosfailederroreds r rzTextTestRunner.runs!!##v-  >  $ & & + +} F%dm444 =$999+H%7$DFFFF)++I"6>4@@L'  "V %fmTBB *KMMM&fmTBB *KMMMM+(**H/ + + + + + + + + + + + + + + +0y(  6< ( ( 3 K   1 2 2 2o 4 #("2s"8b)DE F F F 899 9+g B# 7 & : & 011G ;B 7M.    D  #v#%% $ K  h ' ' '!&/22C 4F4FGF 5 ]V3444 4 [72333 K  d # # #  1 LL/ 0 0 0  A LL/-? @ @ @  J LL25HH I I I  $ K   499U+;+;+;+; = > > > > K  d # # #  s=A6D= C;D=; DD==EE'H HH)NTrFFNN) rrrrr"rnrrprr rr rfrfsr !KABJN+#+++++(PPPGGGGGrrf)rrirrmryrcasersignalsr __unittestobjectr TestResultr"rfr rr rs ######           @ @ @ @ @ V&@ @ @ FfffffVfffffrPK!AEE!__pycache__/suite.cpython-311.pycnu[ 0i4dZddlZddlmZddlmZdZdZGdd eZGd deZ Gd d eZ d Z GddeZ dS) TestSuiteN)case)utilTc>t||d}|dS)NcdSNr 5/opt/alt/python311/lib64/python3.11/unittest/suite.pyz!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s$ 64 . .DDFFFFFr cZeZdZdZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZdS) BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. Tr cLg|_d|_||dSNr)_tests_removed_testsaddTests)selftestss r __init__zBaseTestSuite.__init__s)  er c\dtj|jdt|dS)N)rstrclass __class__listrs r __repr__zBaseTestSuite.__repr__s+"&-"?"?"?"?dLLr czt||jstSt|t|kSr ) isinstancer!NotImplementedr")rothers r __eq__zBaseTestSuite.__eq__s3%00 "! !DzzT%[[((r c*t|jSr )iterrr#s r __iter__zBaseTestSuite.__iter__"sDK   r cP|j}|D]}|r||z }|Sr )rcountTestCases)rcasestests r r.zBaseTestSuite.countTestCases%s=# / /D /,,... r c@t|s/tdt|t |t r0t |tjtfrtd|j |dS)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr&type issubclassrTestCaserrappendrr0s r addTestzBaseTestSuite.addTest,s~~ E077T CCDD D dD ! ! @j26-1K'M'M @?@@ @ 4     r ct|trtd|D]}||dS)Nz0tests must be an iterable of tests, not a string)r&strr3r;)rrr0s r rzBaseTestSuite.addTests6sR eS ! ! PNOO O  D LL      r ct|D]5\}}|jrn(|||jr||6|Sr ) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr0s r runzBaseTestSuite.run<s\$T?? / /KE4   DLLL} /''... r c |j|}t|dr"|xj|z c_d|j|<dS#t$rYdSwxYw)z2Stop holding a reference to the TestCase at index.r.N)rhasattrrr.r3)rrDr0s r rBz BaseTestSuite._removeTestAtIndexEs~ &;u%Dt-.. =##t':':'<'<<##!%DK       DD s A AAc|j|i|Sr rE)rargskwdss r __call__zBaseTestSuite.__call__Sstx&&&&r c8|D]}|dS)7Run the tests without collecting errors in a TestResultN)debugr:s r rOzBaseTestSuite.debugVs*  D JJLLLL  r N)r )__name__ __module__ __qualname____doc__rArr$r)r,r.r;rrErBrLrOr r r rrsH MMM))) !!!!!!  & & &'''r rcReZdZdZd dZdZdZdZdZ dd Z dd Z d Z d Z dS)raA test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. Fcld}t|dddur dx|_}t|D]\}}|jrnt |rv||||||||||j|_ t|jddst|ddr|s ||n| |j r| ||r2|d|| |d|_|S)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrVr?r@ _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr!_previousTestClassrOrArB_handleModuleTearDown)rrCrOtopLevelrDr0s r rEz TestSuite.runfsb 6,e 4 4 = =04 4F "X$T?? / /KE4  4   ++D&999))$777&&tV444,0N)DN,?GGF$8%@@ V  } /''...  +  ' 'f 5 5 5  & &v . . .%*F " r cNt}||ddS)rNTN) _DebugResultrE)rrOs r rOzTestSuite.debugs% r ct|dd}|j}||krdS|jrdSt|ddrdSd} d|_n#t$rYnwxYwt|dd}t|dd}|t |d |nt#t $rg}t|trd} d|_n#t$rYnwxYwtj |} | ||d| Yd}~nd}~wwxYw|r6|4||j D]"} | || dd| | #t |d dS#t |d wxYwdS) Nr]__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) rr!rXrWr3r Exceptionr&rarr "_createClassOrModuleLevelExceptiontearDown_exceptions) rr0rC previousClass currentClassfailedrdree classNameexc_infos r r\zTestSuite._handleClassSetUps8(> !,0A4HH  ! FN 3 3 3 : GJLLLL G G G!&,77!F9= 66$ $ l ; ;I;;FAd}t|dd}||j}|S)Nr])rrQ)rrCpreviousModulerms r _get_previous_modulezTestSuite._get_previous_modules-(> * * * * * -s|~~66666t,,,,,r c|||}|dS|jrdS tj|}n#t$rYdSwxYwt |d t |dd}|Q |nE#t$r8}t|tr| ||d|Yd}~nd}~wwxYw tj nE#t$r8}t|tr| ||d|Yd}~nd}~wwxYwt |ddS#t |dwxYw)NrftearDownModuleri) rurXrxryrzrrrjr&rarkrr{)rrCrtr}rrps r r^zTestSuite._handleModuleTearDowns226::  ! F  $  F [0FF    FF  /// 6$V-=tDDN)L"N$$$$ LLL!&,77;;FACD) D.D D)DD))D;ct|dd}|j}||ks|dSt|ddrdSt|ddrdSt|ddrdSt|dd}t|dd}||dSt|d |e |nY#t$rL}t |t rt j|}|||d|Yd}~nd}~wwxYw|e||j D]S} t |t r| d t j|}||| d d|| Tt|d dS#t|d wxYw) Nr]rWFrXrc tearDownClassrerfrrgri) rr!rrjr&rarr rkrl) rr0rCrmrnrrerprqrrs r rZz TestSuite._tearDownPreviousClasss%(rs      IIIIIFIIIXi6i6i6i6i6 i6i6i6X$$$$$6$$$L6r PK!~9$__pycache__/__main__.cpython-311.pycnu[ 0idZddlZejddr1ddlZejejZedzejd<[dZ ddl m Z e ddS) zMain entry pointNz __main__.pyz -m unittestT)main)module) __doc__sysargvendswithos.pathospathbasename executable __unittestr8/opt/alt/python311/lib64/python3.11/unittest/__main__.pyrs 8A; && NNN !!#.11J~-CHQK  DrPK!^>! ! &__pycache__/util.cpython-311.opt-1.pycnu[ 0i_dZddlmZmZddlmZdZdZdZdZ dZ dZ ee eze zeze zz Z dZ d Zdd Zd Zd ZdZdZeddZdZdZdS)zVarious utility functions.) namedtupleCounter) commonprefixTP ct||z |z }|tkr(d|d|||t||z dfz}|S)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips 4/opt/alt/python311/lib64/python3.11/unittest/util.py_shortenrsW q66I  )D  *9* tQs1vv 7I7J7J5KL L Hcttt|}ttt|}|t kr|St |t t |z tztzz }|tkr2tt|tfd|DSttttfd|DS)Nc32K|]}|dzVdSN.0r prefixr s r z'_common_shorten_repr..'s0::Va m+::::::rc3dK|]*}t|dttzV+dSr)r _MIN_DIFF_LEN _MIN_END_LENrs rrz'_common_shorten_repr..*sP  (1YZZ=-NNN      r) tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr(s Y%% & &D S$ F  $  FF I9$~58HHJJO##&.*==:::::T:::::: fno > >F            rFc t|}n*#t$rt|}YnwxYw|rt |t kr|S|dt dzS)Nz [truncated]...)repr Exceptionobject__repr__r r")objshortresults rr r -sv&c &&&%%& CKK+-- ,;, "3 33s $99c$|jd|jS)N.) __module__ __qualname__)clss rstrclassr66snnnc&6&6 77rcdx}}g}g} ||}||}||kr8|||dz }|||kr|dz }|||kn||kr8|||dz }|||kr|dz }|||knm|dz } |||kr|dz }|||k|dz }|||kr|dz }|||kn'#|dz }|||kr|dz }|||kwxYwnJ#t$r=|||d|||dYnwxYwG||fS)arFinds elements in only one or the other of two, sorted input lists. Returns a two-element tuple of lists. The first list contains those elements in the "expected" list but not in the "actual" list, and the second contains those elements in the "actual" list but not in the "expected" list. Duplicate elements in either input list are ignored. rTN)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerD9s IAGJ  Aq A1uuq!!!QqkQ&&FAqkQ&&Q!!!$$$QQi1nnFAQi1nnQ"1+**Q#1+**FA )q..Q!)q..FA )q..Q!)q......    NN8ABB< ( ( (   fQRRj ) ) ) E /6 J s+BDC:#D$DDAE  E cg}|rR|} ||n%#t$r||YnwxYw|R||fS)zSame behavior as sorted_list_difference but for lists of unorderable items (like dicts). As it does a linear search per item (remove) it has O(n*n) performance.)popremove ValueErrorr9)r<r=r@items runorderable_list_differencerJbs G !||~~ ! MM$     ! ! ! NN4  ! ! F?s0AAc||k||kz S)z.Return -1 if x < y, 0 if x == y and 1 if x > yr)xys r three_way_cmprNss Ea!e rMismatchzactual expected valuect|t|}}t|t|}}t}g}t|D]\}} | |ur dx} } t ||D]} || | kr | dz } ||| <t|D]\} } | | kr | dz } ||| <| | kr&t | | | }||t|D][\}} | |ur d} t ||D]} || | kr | dz } ||| <t d| | }||\|S)HReturns list of (cnt_act, cnt_exp, elem) triples where the counts differrr8)listr r, enumeraterange _Mismatchr9)r=r<r tmnNULLr0r>elemcnt_scnt_tr? other_elemdiffs r_count_diff_all_purposer_ys <<hqA q663q66qA 88D FQ<<  4 4<< q!  Att|| !&q\\  MAzT!! ! E>>UE400D MM$   Q<<  4 4<< q!  Att|| !E4(( d Mrct|t|}}g}|D]G\}}||d}||kr&t|||}||H|D]/\}}||vr&td||}||0|S)rQr)ritemsgetrUr9) r=r<r rVr0rZr[r\r^s r_count_diff_hashablercs 6??GH--qA Fwwyy  edA E>>UE400D MM$   wwyy  e q==Qt,,D MM$    MrN)F)__doc__ collectionsrros.pathr __unittestr"r r#rr$rrr(r r6rDrJrNrUr_rcrrrrhs( ++++++++    !11OC !#/01       *4444888&&&R" Jz#: ; ; !!!FrPK!k*__pycache__/__main__.cpython-311.opt-2.pycnu[ 0i ddlZejddr1ddlZejejZedzejd<[dZddl m Z e ddS)Nz __main__.pyz -m unittestT)main)module) sysargvendswithos.pathospathbasename executable __unittestr8/opt/alt/python311/lib64/python3.11/unittest/__main__.pyrs 8A; && NNN !!#.11J~-CHQK  DrPK!ax55&__pycache__/main.cpython-311.opt-1.pycnu[ 0i,dZddlZddlZddlZddlZddlmZmZddlm Z dZ dZ dZ d Z d Zd ZGd d eZeZdS)zUnittest main programN)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase cVtj|r|drtj|rstj|tj}tj|s|tj r|S|}tj |dd dd ddS|S)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths 4/opt/alt/python311/lib64/python3.11/unittest/main.py _convert_namers  w~~dP 5 5e < <P 7==   wtRY[[99Hw}}X&& (*=*=bi*H*H  Dw%%crc*224==EEc3OOO Kcd|DS)Nc,g|]}t|S)r).0rs r z"_convert_names../s 2 2 2DM$   2 2 2rr)namess r_convert_namesr#.s 2 2E 2 2 22rcd|vrd|z}|S)N*z*%s*r)patterns r_convert_select_patternr'2s '>>7" Nrc eZdZdZdZdZdxZxZxZxZ xZ Z dZ dddde jddddddf dddZdd Zd Zd Zdd Zd ZdZdZdZddZdZdS) TestProgramzA command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. Nr__main__TF) tb_localsc Vt|trOt||_|dddD]} t |j| |_n||_| t j}||_||_ | |_ ||_ | |_ | |_ | t jsd|_n| |_||_||_||_t&j|d|_|||dS)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr+ warnoptionswarnings defaultTest testRunner testLoaderr r basenameprogName parseArgsrunTests)selfr1r=r5r>r?r6r9r7r8r:r<r+parts r__init__zTestProgram.__init__Bs fc " " !$V,,DK S))!""- 9 9%dk488  9!DK <8D   $" "  CO &DMM%DM&$$((a11  t rctjdt|rt||j||tjddS)NzHTestProgram.usageExit() is deprecated and will be removed in Python 3.13) r<warnDeprecationWarningprint_discovery_parser_initArgParsers _print_helpr4r6)rDmsgs r usageExitzTestProgram.usageExithsr 01C E E E   #JJJ  ! )  " " "   rcZ|j_t|jttd|jiz|jdSt|jttd|jizdS)Nprog) r1rK _main_parser format_help MAIN_EXAMPLESrArL print_helpMODULE_EXAMPLES)rDargskwargss rrNzTestProgram._print_helprs ;  $#//11 2 2 2 -64="99 : : :  " - - / / / / / $#//11 2 2 2 /VT]$;; < < < < !>""48,,,   ( (abb4 8 8 8: ""2&&&     ( (abb4 8 8 8 : 4+DJ77DN:%%"   %!DNN (# . . 4".0DNN!$"233DN rc^|jr|j|j_|r;||jn |}|j|j|j|j|_dS|j&|j|j |_dS|j |j|j |_dSN) testNamePatternsr?r[startr&toptestr`loadTestsFromModuler1loadTestsFromNames)rDfrom_discoveryLoaderrs rrczTestProgram.createTestss   E/3/DDO ,  H(.T__FFHHF' DL$(KKDIII ^ #;;DKHHDIII::4>;?;HHDIIIrc|}|||_|||_dSre)_getParentArgParser_getMainArgParserrS_getDiscoveryArgParserrL)rD parent_parsers rrMzTestProgram._initArgParserssE0022  22=AA!%!rTextTestRunnerr.r|r9r7r:r<r+ TypeErrorrunriresultr6r4 wasSuccessful)rDr>s rrCzTestProgram.runTestssY ?      ? "$3DO dot , , ) / I!%4>:>-8< :>-;?> "1"K"KJJ !III!%4>:>-8< :>-"1"I"IJJJI  / / /!__..  / J nnTY// 9 6 H22444 5 5 5 5 5 6 6s0 3A>=B<>7B85B<7B88B<<CCre)FN)ra __module__ __qualname____doc__r1r9r7r8r:rAr<rfrLrdefaultTestLoaderrFrPrNrBrcrMrorprqr]rCrrrr)r)8s> FINRRHRzRFRXR;K(d#0HTd$$>C$$$$$L===: H H H HLLL !!!F   * = = = =66666rr))rr4r}r r<rrsignalsr __unittestrUrWrr#r'objectr)mainrrrrs  ######    333 \6\6\6\6\6&\6\6\6|rPK!ON j j(__pycache__/loader.cpython-311.opt-1.pycnu[ 0iXldZddlZddlZddlZddlZddlZddlZddlZddlmZm Z ddl m Z m Z m Z dZejdejZGdd e jZd Zd Zd Zd ZdZGddeZeZddZe jdfdZde je jfdZ de je jfdZ!dS)zLoading unittests.N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c,eZdZdZfdZfdZxZS) _FailedTestNcf||_tt||dSN) _exceptionsuperr __init__)self method_name exception __class__s 6/opt/alt/python311/lib64/python3.11/unittest/loader.pyrz_FailedTest.__init__s.# k4  ))+66666cz|jkr(tt|Sfd}|S)Ncjr )r rsr testFailurez,_FailedTest.__getattr__..testFailure!s / !r)_testMethodNamerr __getattr__)rnamerrs` rrz_FailedTest.__getattr__sO 4' ' 'd++77== = " " " " "r)__name__ __module__ __qualname__rrr __classcell__rs@rr r sVO77777rr crd|dtj}t|t|||S)NzFailed to import test module:  ) traceback format_exc_make_failed_test ImportError)r suiteClassmessages r_make_failed_import_testr*&s< i"$$$&G T;w#7#7W M MMrcRdtj}t||||S)NzFailed to call load_tests: )r$r%r&)rrr(r)s r_make_failed_load_testsr,+s32;2F2H2H2HJG  iW . ..rc>t||}||f|fSr )r ) methodnamerr(r)tests rr&r&0s( z9 - -D :tg   ''rctjt|d}||i}tdtjf|}|||fS)NcdSr rs r testSkippedz'_make_skipped_test..testSkipped5s r ModuleSkipped)rskipstrtypeTestCase)r.rr(r3attrs TestClasss r_make_skipped_testr;4si Ys9~~    %E_t}&6>>I :yy,,. / //rc|dr |ddStj|dS)Nz $py.classir)lowerendswithospathsplitext)r@s r_jython_aware_splitextrB<sI zz||[))CRCy 7  D ! !! $$rceZdZdZdZeejZdZ e j Z dZ fdZdZdddZddZdd Zd Zdd Zd ZdZdZdZdZdZxZS) TestLoaderz This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite r/Nctt|g|_t |_dSr )rrDrerrorsset_loading_packages)rrs rrzTestLoader.__init__Ms: j$((*** "%rc,t|tjrtd|tjtjfvrg}n*||}|st|drdg}| 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 TypeErrorrr8FunctionTestCasegetTestCaseNameshasattrr(map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCasez TestLoader.loadTestsFromTestCaseTs mU_ 5 5 )()) ) T]D,AB B BMM 11-@@M  ,W]I%F%F ,!* s=-'H'HII rpatternct|dksd|vr0tjdt|ddt|dkr4t|dz}t d|t|dkr7t|d}t d|g}t|D]}t||}t|tr\t|tjrB|tjtjfvr(|||t|dd} ||}| _ | |||S#t&$rD} t)|j| |j\} } |j| | cYd} ~ Sd} ~ wwxYw|S) z>Return a suite of all test cases contained in the given moduleruse_load_testsz(use_load_tests is deprecated and ignoredNrzCloadTestsFromModule() takes 1 positional argument but {} were givenz=loadTestsFromModule() got an unexpected keyword argument '{}' load_tests)lenwarningswarnDeprecationWarningpoprMformatsorteddirgetattr isinstancer7rKrr8rNappendrUr( Exceptionr,rrF) rmodulerWargskws complainttestsrobjrZe error_case error_messages rloadTestsFromModulezTestLoader.loadTestsFromModulefs t99q==,33 MD, . . . GG$d + + + t99q==D A Iahhirsstt t s88q== s AI[bbclmmnn nKK > >D&$''C3%% >sDM22 > t/DEEE T77<<===V\488 &&  ! "!z$w777 " " ",COQ-9-9) M ""=111!!!!!!!  "  s F$$ G2.9G-'G2-G2c v|d}d\}}||dd}|r d|}t|}n^#t$rO|}t ||j\}}|s|j||cYSYnwxYw||dd}|} |D]} | t| | } } #t$r} t| dd%|#|j||cYd} ~ cSt| | |jdtj \}}|j||cYd} ~ cSd} ~ wwxYwt| tjr|| St| t$rIt'| t(jr/| t(jt(jfvr|| St| tjrt| t$rlt'| t(jrR|d}| |} tt| |tjs|| gSnt| t2jr| St7| rl| }t|t2jr|St|t(jr||gSt9d| d |d t9d | z) 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'r_r*r(rFrercAttributeErrorr&r$r%rdtypes ModuleTyperpr7rKrr8rNrU FunctionTyperrLcallablerM)rrrgpartsrnro parts_copy module_namenext_attributerlpartparentrminstr/s rloadTestsFromNamezTestLoader.loadTestsFromNames 3$.! M >qqqJ * *"%((:"6"6K' 44F"***%/^^%5%5N0H&1919-J %* **=999))))** *  *!""IE & &D &!73#5#5! & & &CT22>". K&&}555%%%%%%%%%1Ba%022251616-J K&&}555%%%%%%%%%% &( c5+ , , ++C00 0 sD ! ! 3 .. DM4+@AAA--c22 2e011 && // 9D6$<C E'.E" E'A E"E'"E'cNfd|D}|S)zReturn a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. c<g|]}|Sr2)r).0rrgrs r z1TestLoader.loadTestsFromNames..s)III4$((v66IIIr)r()rnamesrgsuitess` ` rloadTestsFromNameszTestLoader.loadTestsFromNamess5JIIII5IIIv&&&rcfd}tt|t}jr-|t jj|S)zLReturn a sorted sequence of method names found within testCaseClass c|jsdSt|}t|sdSdjj|fzjduptfdjDS)NFz%s.%s.%sc38K|]}t|VdSr )r)rrWfullNames r zKTestLoader.getTestCaseNames..shouldIncludeMethod..s-XXwK'22XXXXXXr) startswithtestMethodPrefixrcr}rrtestNamePatternsany)attrnametestFuncrrrRs @rshouldIncludeMethodz8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<== u}h77HH%% u"(-*Dh&H(D0YXXXX$BWXXXXX Yr)key)listfilterrbsortTestMethodsUsingsort functools cmp_to_key)rrRr testFnNamess`` rrOzTestLoader.getTestCaseNamess Y Y Y Y Y Y6"5s=7I7IJJKK  $ R   !5d6O!P!P  Q Q Qrtest*.pycd}||j|j}n|d}|}tj|}|tjvr tjd|||_d}tjtj|retj|}||kr>tjtj|d }n t|tj |}| dd} tjtj |j }nD#t$r7|jtjvrt#ddt#d|dwxYw|r9|||_tj|n#t($rd}YnwxYw|rt)d |zt+|||}||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__.pyrrz2Can 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@abspathsysinsertisdirisfilerwrxmodulesrvdirname__file__ryrbuiltin_module_namesrM _get_directory_containing_moduleremover'r _find_testsr() r start_dirrW top_level_dirset_implicit_topis_not_importable the_moduletop_partrks rdiscoverzTestLoader.discoverse8!  T%8%D /MM  "# %M 66 (( HOOA} - - -+! 7==33 4 4 3 22IM))(*rw||I}7]7](^(^$^! 39%%%![3 $??3//2 ( ")<>>!@!@II%(((!*c.FFF')ABBGKL(MzMM#'( ($3*.*O*OPX*Y*YD'HOOM222) ) ) )$(!!! ),  SE QRR RT%%i99::u%%%s HAFAG H H ctj|}tj|j}tj|dr> > 7??9-- -rc ||jkrdSttj|}tj||j}|tjjd}|S)Nrr)rrBr?r@normpathrelpathreplacesep)rr@_relpathrs r_get_name_from_pathzTestLoader._get_name_from_path]sj 4& & &3%bg&6&6t&<&<==7??4)<== S11 rcDt|tj|Sr )rxrr)rrs r_get_module_from_namez TestLoader._get_module_from_nameis4{4  rc"t||Sr )r)rr@rrWs r _match_pathzTestLoader._match_pathmstW%%%rc#rK||}|dkr,||jvr#|||\}}||V|sdStt j|}|D]}tj||}|||\}}||V|r||}|j| | ||Ed{V|j |#|j |wxYwdS)z/Used by discovery. Yields test suites it loads.rrN) rrH_find_test_pathrar?listdirr@rwaddrdiscard) rrrWrrkshould_recursepathsr@rs rrzTestLoader._find_testsqsv'' 22 3;;4t'===%)$8$8G$L$L !E>  ! rz),,-- 9 9D Y55I$($8$8G$L$L !E>   9// ::&**40009#// 7CCCCCCCCC*2248888D*2248888 9 9 9s DD3ctj|}tj|rt|sdS||||sdS||} ||}tj t|d|}ttj |}ttj |}| | krtj|} ttj|} tj|} d} t| | | | fz|||dfS#t"j$r"} t'|| |jdfcYd} ~ Sd} ~ wt+||j\}}|j||dfcYSxYwtj|rztjtj|dsdSd}d}||} ||}t|dd}|j| |||}||df|j|S|d f|j|S#|j|wxYw#t"j$r"} t'|| |jdfcYd} ~ Sd} ~ wt+||j\}}|j||dfcYSxYwdS) 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?rVFNrrZT)r?r@rrVALID_MODULE_NAMEmatchrrrrrcrBrealpathr=rr'rprSkipTestr;r(r*rFrerrwrHrr)rrrWrrrgmod_filerfullpath_noext module_dirmod_name expected_dirmsgrmrnrorZrkpackages rrzTestLoader._find_test_paths7##I.. 7>>) $ $? $**844 #"{##HiAA #"{++I66D P33D997??FJ ::<<1G$$X..00!7G$$Y//"1"1>>##~';';'='===!#!:!:J5((33 5 5H#%7??9#=#=LDC%x\BBDDD///HH%OO/= K K K)$4?CCUJJJJJJJ ),T4?CC* M ""=111!5(((($W]]9 % % 7>>"',,y-"H"HII #"{JE++I66D 944T::%WlDAA &**40009 44Wg4NNE!-$e|*2248888!$;*2248888D*2248888%= K K K)$4?CCUJJJJJJJ ),T4?CC* M ""=111!5((((;sN G**I9HI;INM%M%%NO-N0*O-0;O-r )rN)rrr__doc__r staticmethodr three_way_cmprrrrLr(rrrUrprrrOrrrrrrrr r!s@rrDrDBsX'<(:;;JN'''''$:>*****XPJPJPJPJd''''&Q&Q&Q&Q&f . . .   !!!&&&999@HHHHHHHrrDc^t}||_||_||_|r||_|Sr )rDrrrr()prefix sortUsingr(rloaders r _makeLoaderrs8 \\F"+F$F.F'& Mrcddl}|jdtdt||||S)Nrzunittest.getTestCaseNames() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.getTestCaseNames() instead. stacklevel)r)r\r]r^rrO)rRrrrr\s rrOrOsXOOOHM Eq vy;K L L L ] ]^k l llrr/cddl}|jdtdt||||S)Nrzunittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.rr)r\r]r^rrU)rRrrr(r\s r makeSuitersZOOOHM Jq vy* 5 5 K K  rcddl}|jdtdt||||S)Nrzunittest.findTestCases() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromModule() instead.rr)r\r]r^rrp)rgrrr(r\s r findTestCasesrsZOOOHM Hq vy* 5 5 I I  rrs)"rr?rerr$rzrr\rrrrr __unittestcompile IGNORECASErr8r r*r,r&r;rBobjectrDdefaultTestLoaderrrrOrLrrr2rrrs  ((((((((  BJ0"-@@     $-   NNN ... (((000%%% WWWWWWWWt JLL 7;6H[_mmmm%+d6H    "(43E"_      rPK!88&__pycache__/_log.cpython-311.opt-2.pycnu[ 0i ddlZddlZddlmZejdddgZGddejZGd d eZdS) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc"eZdZ dZdZdZdS)_CapturingHandlercntj|tgg|_dSN)loggingHandler__init__rwatcherselfs 4/opt/alt/python311/lib64/python3.11/unittest/_log.pyrz_CapturingHandler.__init__s-  &&&&r2.. cdSr rs rflushz_CapturingHandler.flushs rc|jj|||}|jj|dSr )rrappendformatr)rrecordmsgs remitz_CapturingHandler.emitsK ##F+++kk&!! ""3'''''rN)__name__ __module__ __qualname__rrrrrrr r sF///   (((((rr c&eZdZ dZdZdZdZdS)_AssertLogsContextz"%(levelname)s:%(name)s:%(message)sctj||||_|r&tj|||_ntj|_d|_||_ dSr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser#r&r(s rrz_AssertLogsContext.__init__!s\%dI666&  & -11%??DJJ DJ rc,t|jtjr|jx}|_n tj|jx}|_tj|j}t}| |j | ||j |_ |j dd|_|j |_|j|_|g|_ | |j d|_|jrdS|j S)NF) isinstancer#r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr& setFormatterrhandlers old_handlers old_level propagate old_propagater()rr- formatterhandlers r __enter__z_AssertLogsContext.__enter__+s d& 7 7 G#'#3 3FT[[#*#4T5E#F#F FFT[%d&9:: #%%$$$Y''' "OAAA.#-") ###  <  Frc|j|j_|j|j_|j|j|dS|jrSt|j j dkr4| d |j j dSdSt|j j dkrL| d tj|j|jjdSdS)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r4r-r3r7r6r1r5r(lenrr _raiseFailurerrr getLevelNamer&name)rexc_type exc_valuetbs r__exit__z_AssertLogsContext.__exit__?s#0  $ 2  T^,,,  5 < Q4<'((1,,""188 +-,4<'((A--""CVG0<NOOQQQQQ.-rN)rrrr0rr:rCrrrr!r!sN@9N(QQQQQrr!) r collectionscaser namedtuplerr r r!rrrrGs&&&&&&)+():*3X)>@@(((((((($:Q:Q:Q:Q:Q-:Q:Q:Q:Q:QrPK!:&__pycache__/case.cpython-311.opt-2.pycnu[ 0i@ ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZmZmZmZdZeZdZGddeZGd d eZGd d eZGd deZdZdZdZdZgZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'GddZ(Gdde(Z)Gdd e)Z*Gd!d"e)Z+Gd#d$ej,Z-Gd%d&eZ.Gd'd(e.Z/Gd)d*e.Z0dS)+N)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.ceZdZdS)SkipTestN__name__ __module__ __qualname__4/opt/alt/python311/lib64/python3.11/unittest/case.pyr r srr ceZdZdS) _ShouldStopNr rrrrr!rrceZdZdS)_UnexpectedSuccessNr rrrrr&rrrc8eZdZddZejddZdS)_OutcomeNchd|_||_t|d|_d|_d|_dS)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init__z_Outcome.__init__-s8!& (/ (E(E% #rFc#BK|j}d|_ dV|r(|jr!|j|j|dn#t$rt $r4}d|_t |j|t|Yd}~nzd}~wt$rYnktj }|j r||_ nAd|_|r"|j|j||nt|j||d}YnxYw|jo||_dS#|jo||_wxYw)NTF)rrr test_caseKeyboardInterruptr _addSkipstrrsysexc_inforr _addError)r!r$subTest old_successer)s rtestPartExecutorz_Outcome.testPartExecutor4sql   8 EEE, M4< M &&y':ItLLL-!     5 5 5 DL T[)SVV 4 4 4 4 4 4 4 4    D |~~H% @'/$$$ @K**9+> 8TTTTdk9h???HHH  <7KDLLL4<7KDL 7 7 7 7s;A+DC;*B?D C;DA&C;9DDN)F)r rrr" contextlibcontextmanagerr.rrrrr,sL$$$$888888rrct|dd}||||dStjdtd|j|dS)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr$reasonr3s rr&r&Usffi..G 6""""" L$a ) ) ))$$$$$rc|C|Ct|d|jr|j||dS|j||dSdSdSNr) issubclassfailureException addFailureaddError)rtestr)s rr*r*^si h2 hqk4#8 9 9 , F dH - - - - - FOD( + + + + + 22rc|Sr/r)objs r_idrDes Jrct|} |j}|j}n/#t$r"t d|jd|jddwxYw||}|||ddd|S)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrRis r((CO | OOODCNDDS-=DDDEEJN OOU2YYFJtRtT*** Ms  ,A cB t|||fdSr/)_module_cleanupsappend)functionargskwargss raddModuleCleanuprYys(2XtV455555rc. t|tSr/)rRrY)rMs renterModuleContextr[~s0 ". / //rc g}trZt\}}} ||i|n,#t$r}||Yd}~nd}~wwxYwtZ|r|ddSr<)rTpop ExceptionrU) exceptionsrVrWrXexcs rdoModuleCleanupsrasJ #!1!5!5!7!7$ # Hd %f % % % % # # #   c " " " " " " " " # # ms2 AAAcf fd}ttjr}d||S|S)Nct|ts!tj|fd}|}d|_|_|S)Nc"tr/r )rWrXr:s r skip_wrapperz-skip..decorator..skip_wrappersv&&&rT) isinstancerH functoolswraps__unittest_skip____unittest_skip_why__) test_itemrfr:s r decoratorzskip..decorators^)T** % _Y ' ' ' ' ' '( ' '$I&* #*0 'r)rgtypes FunctionType)r:rmrls` rskiprqsX     &%,--$ y### rc4 |rt|StSr/rqrD conditionr:s rskipIfrvs"F|| Jrc4 |st|StSr/rsrts r skipUnlessrxs" F|| Jrcd|_|S)NT)__unittest_expecting_failure__)rls rr r s/3I, rct|trtfd|DSt|tot |S)Nc38K|]}t|VdSr/) _is_subtype).0r-basetypes r z_is_subtype..s->>;q(++>>>>>>r)rgtupleallrHr=)expectedrs `rr}r}sW(E""?>>>>X>>>>>> h % % H*Xx*H*HHrceZdZdZdZdS)_BaseTestCaseContextc||_dSr/)r$)r!r$s rr"z_BaseTestCaseContext.__init__s "rcv|j|j|}|j|r/)r$_formatMessagemsgr>)r! standardMsgrs r _raiseFailurez"_BaseTestCaseContext._raiseFailures1n++DHkBBn--c222rN)r rrr"rrrrrrs2###33333rrceZdZddZdZdS)_AssertRaisesBaseContextNct||||_||_|t j|}||_d|_d|_dSr/) rr"rr$recompileexpected_regexobj_namer)r!rr$rs rr"z!_AssertRaisesBaseContext.__init__sU%%dI666  "  %Z77N, rc t|j|jst|d|j|sM|dd|_|r,ttt|d|d}S|^}} |j |_ n$#t$rt||_ YnwxYw|5||i|dddn #1swxYwYd}dS#d}wxYw)Nz() arg 1 must be rz1 is an invalid keyword argument for this function) r}r _base_typerL_base_type_strr]rnextiterr rrKr')r!namerWrX callable_objs rhandlez_AssertRaisesBaseContext.handles  t}do>> =!%t':':!<=== !::eT22M#7;DLL7I7I7I7I%LMMMDD#' L4 2 , 5 ! 2 2 2 #L 1 1  2 . . d-f--- . . . . . . . . . . . . . . .DDD4DKKKKsZA?C!C! BC!B85C!7B88C!= C C!CC!CC!!C%r/)r rrr"rrrrrrs7rrcDeZdZ eZdZdZdZee j Z dS)_AssertRaisesContextz-an exception type or tuple of exception typesc|Sr/rr!s rrIz_AssertRaisesContext.__enter__s rc| |jj}n$#t$rt|j}YnwxYw|jr/|d||jn=|d|ntj|t||jsdS| d|_ |j dS|j }| t|s;|d|jt|dS)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rr rKr'rrformat traceback clear_framesr=with_traceback exceptionrsearchpattern)r!exc_type exc_valuetbexc_namers rrJz_AssertRaisesContext.__exit__se   .=1! . . .t}-- .} E""#8#?#?@D $O$OPPPP""?#9#9(#C#CDDDD  "2 & & &(DM22 5"11$77   &4,$$S^^44 >   9@@#+S^^ = = > > >ts 22N) r rr BaseExceptionrrrIrJ classmethodro GenericAlias__class_getitem__rrrrrsPMJDN6$ E$677rrc$eZdZ eZdZdZdZdS)_AssertWarnsContextz(a warning type or tuple of warning typesc6ttjD]}t |ddri|_t jd|_|j |_t j d|j |S)N__warningregistry__T)recordalways) listr(modulesvaluesr5rr6catch_warningswarnings_managerrI simplefilterr)r!vs rrIz_AssertWarnsContext.__enter__ sck((**++ + +Aq/66 +(*% ( 7t D D D-7799 h 666 rc|j||||dS |jj}n$#t$rt |j}YnwxYwd}|jD]s}|j}t||js||}|j (|j t |sR||_ |j |_ |j |_ dS|@|d|j jt ||jr0|d||jdS|d|dS)Nrz{} not triggered by {}z{} not triggered)rrJrr rKr'r6messagergrrwarningfilenamelinenorrrr)r!rrrrfirst_matchingmws rrJz_AssertWarnsContext.__exit__+s &&xB???   F *}-HH * * *4=))HHH *  A Aa// %!"#/'..s1vv660DLJDM(DK FF  %   9@@(0#n2E2E G G H H H = D   7>>x?C} N N O O O O O   188BB C C C C Cs /AAN)r rrWarningrrrIrJrrrrrsDLJ?N    D D D D DrrceZdZdZdS)_OrderedChainMapc#~Kt}|jD]$}|D]}||vr|||V %dSr/)setmapsadd)r!seenmappingks r__iter__z_OrderedChainMap.__iter__Os`uuy  G  D==HHQKKKGGG   rN)r rrrrrrrrNs#rrceZdZ eZdZdZdZfdZdNdZ dZ dZ d Z e d Ze d Zd Zd Ze dZe dZdZdZdZdZdZdZdZdZejefdZdZ dZ!dZ"dZ#dZ$dZ%dOd Z&d!Z'e d"Z(d#Z)d$Z*d%Z+dOd&Z,dOd'Z-dOd(Z.d)Z/d*Z0d+Z1dPd,Z2dPd-Z3d.Z4dOd/Z5dOd0Z6dOd1Z7 dQd2Z8 dQd3Z9dPd4Z:d5Z;dOd6ZdOd9Z?dOd:Z@dOd;ZAdOd<ZBdOd=ZCdOd>ZDdOd?ZEdOd@ZFdOdAZGdOdBZHdOdCZIdOdDZJdOdEZKdOdFZLdOdGZMdOdHZNdIZOdJZPdOdKZQdOdLZRdMZSeSe6xZTZUeSe7xZVZWeSe8xZXZYeSe9xZZZ[eSe.xZ\Z]eSe0Z^eSe-Z_eSeOZ`eSeQZaeSeRZbxZcS)RTestCaseTiicVd|_g|_tj|i|dS)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rOrWrX __class__s rrzTestCase.__init_subclass__s5 % !!42622222rrunTestc< ||_d|_d|_ t||}|j|_n0#t $r#|dkrt d|jd|YnwxYwg|_d|_ i|_ | td| td| td| td| t d| t"d dS) NzNo testrzno such test method in : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr5__doc__rK ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr')r! methodName testMethods rr"zTestCase.__init__sF  * ' 5 z22J#-"4D   4 4 4Y&&!j~~~zz"3444'& 4 %'!   '8999   '8999   (:;;;   &6777   ,<===   &<=====s5*A"!A"c ||j|<dSr/)r)r!typeobjrVs rrzTestCase.addTypeEqualityFuncs .6!'***rcB |j|||fdSr/)rrUr!rVrWrXs r addCleanupzTestCase.addCleanups- K xv677777rc. t||jSr/)rRr)r!rMs r enterContextzTestCase.enterContexts b$/222rcB |j|||fdSr/)rrUrOrVrWrXs raddClassCleanupzTestCase.addClassCleanups+ 4 ""HdF#;<<<<t|jd|jS)NrGrrrrs ridz TestCase.ids#"4>2222D4H4HIIrclt|t|urtS|j|jkSr/)rHNotImplementedrr!others r__eq__zTestCase.__eq__s0 ::T%[[ ( (! !#u'<<rrs r__repr__zTestCase.__repr__s.(((($*>*>*>@ @rc+K |j |jjsdVdS|j}|t|}n|j|}t ||||_ |j|jd5dVdddn #1swxYwY|jjs|jj }||j rtn|jj rt||_dS#||_wxYw)NT)r+) rrrrparams new_child_SubTestr.rrfailfastrr )r!rr$parent params_maprs rr+zTestCase.subTestsN =  (N EEE F >)&11JJ0088J sJ77  #// t/LL                 =( "-%&/%%%. ""!"DMMMFDM " " " "s0'!C)B C)BC) B!?C)) C2c |j}|||dS#t$r.tjdt|j|YdSwxYw)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerKr6r7r8r9)r!rr)r+s r_addExpectedFailurezTestCase._addExpectedFailure&s~ /!'!:   tX . . . . .  $ $ $ M\( * * * F d # # # # # # $s4AAc |j}||dS#t$rXtjdt t d#t $r'|j|tjYYdSwxYwwxYw)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrKr6r7r8rr?r(r))r!rr.s r_addUnexpectedSuccesszTestCase._addUnexpectedSuccess0s '#)#>  !  & & & & & 8 8 8 M_( * * * 8(d2% 8 8 8!!$ 7777777 8 8s&$A8A,A4/A83A44A8c.|dSr/)rrs r _callSetUpzTestCase._callSetUp?s rc^|"tjd|dtddSdS)NzFIt is deprecated to return a value that is not None from a test case (r) stacklevel)r6r7DeprecationWarning)r!methods r_callTestMethodzTestCase._callTestMethodBs\ 688  M2(.2223ERS U U U U U U rc.|dSr/)rrs r _callTearDownzTestCase._callTearDownGs rc||i|dSr/rrs r _callCleanupzTestCase._callCleanupJs$!&!!!!!rNc|C|}t|dd}t|dd}| |nd}|j| t||j}t|jddst|ddrWt|jddpt|dd}t |||||j|| |SSt|ddpt|dd}t|} ||_| |5| dddn #1swxYwY|j r||_ | |5| |dddn #1swxYwYd|_ | |5|dddn #1swxYwY||j rK|r9|jr|||jn&||n|j||d|_d}d|_|j|| |SS#d|_d}d|_wxYw#|j|| |wwxYw)N startTestRun stopTestRunrjFrkrnrz)rr5 startTestrrr&stopTestrrr.r1rrr7r9 doCleanupsr r,r/r9)r!rr=r>rskip_whyroutcomes rrunz TestCase.runMs >++--F"6>4@@L!&->>K' K2  t';<FFM $DeLL v&&G % ' --d33&&OO%%%&&&&&&&&&&&&&&&?-0AG- 11$7799,,Z88899999999999999905G- 11$77--**,,,---------------!!!?0(0"2? 44VW=TUUUU 66v>>>>))$///+/'!%  FOD ! ! !& '+/'!% $$$$ FOD ! ! !& 'sA5J(,1J(J:E JEJ"E#&J F+ J+F//J2F/3JG3' J3G77J:G7;A*J%J(J%%J((Kc |jp t}|jrb|j\}}}||5|j|g|Ri|dddn #1swxYwY|jb|jSr/)rrrr]r.r;r)r!rCrVrWrXs rrAzTestCase.doCleanupss --8::n =%)^%7%7%9%9 "HdF))$// = =!!(%> "HdF ?$)&)))) ? ? ?'..s|~~>>>>> ? ! ? ? ? ? ?s75A/.A/c|j|i|Sr/)rD)r!rWkwdss r__call__zTestCase.__call__stx&&&&rc t||j}t|jddst|ddr6t|jddpt|dd}t||||||jr7|j\}}}|j |g|Ri||j5dSdS)NrjFrkrn) r5rrr r1r7r9rr]r;)r!rrBrVrWrXs rdebugzTestCase.debugsDT4#788 DN$7 ? ? % J 3U ; ; % 0GLLL":/FKK 8$$ $  Z((( n 9%)^%7%7%9%9 "HdF D h 8 8 8 8 8 8 8n 9 9 9 9 9rc" t|r/re)r!r:s rskipTestzTestCase.skipTestsvrc. ||r/)r>)r!rs rfailz TestCase.fails7##C(((rc |r;||dt|z}||dS)Nz%s is not falserrr>r!exprrs r assertFalsezTestCase.assertFalsesL1  -%%c+>.$??GGdGNNNNs,0cR t||}|d||S)N assertWarnsrr)r!expected_warningrWrXr`s rrbzTestCase.assertWarnss/ 6&&6==~~mT6:::rc. ddlm}||||dS)Nr_AssertLogsContextFno_logs_logrgr!loggerlevelrgs r assertLogszTestCase.assertLogs"s5 ( -,,,,,!!$uEEEErc. ddlm}||||dS)NrrfTrhrjrls r assertNoLogszTestCase.assertNoLogs:s5 -,,,,,!!$tDDDDrc t|t|urP|jt|}|'t|trt ||}|S|jSr/)rHrgetrgr'r5_baseAssertEqual)r!firstsecondasserters r_getAssertEqualityFunczTestCase._getAssertEqualityFuncCsq ;;$v,, & &044T%[[AAH#h,,7&tX66H$$rc ||ks>dt||z}|||}||dS)N%s != %s)r rr>)r!rurvrrs rrtzTestCase._baseAssertEqual]sSH$';E6'J'JJK%%c;77C'',, ,rcP |||}||||dS)N)r)rx)r!rurvrassertion_funcs r assertEqualzTestCase.assertEqualds; 44UFCCuf#......rc ||ksJ||t|dt|}||dS)N == rS)r!rurvrs rassertNotEqualzTestCase.assertNotEqualksj %%c59I9I9I9I:CF:K:K:K,MNNC'',, ,rc  ||krdS||tdt||z }|K||krdSt|dt|dt|dt|d}nO|d}t||dkrdSt|dt|d|dt|d}|||}||) N specify delta or places not bothz !=  within  delta ( difference)rz places (rLabsrroundrr>r!rurvplacesrdeltadiffrs rassertAlmostEqualzTestCase.assertAlmostEqualts1  F?? F  !3>?? ?56>""  u}}%    &!!!!%    $ !KK ~T6""a''%    &!!!!$ !K !!#{33##C(((rc  ||tdt||z }|Q||ks||krdSt|dt|dt|dt|d}nE|d}||kst||dkrdSt|dt|d|d}|||}||) Nrrrrrrrz placesrrs rassertNotAlmostEqualzTestCase.assertNotAlmostEquals#   !3>?? ?56>""  VOO%    &!!!!%    $ !KK ~VOOtV)<)<)A)A9B59I9I9I9I9B69J9J9J9J9?AK!!#{33##C(((rc  |x|j}t||s(|d|dt|t||s(|d|dt|nd}d} t |}n#t t f$rd|z}YnwxYw|- t |}n#t t f$rd|z}YnwxYw|||krdSd|ft||zz}tt||D]} || } n(#t tt f$r|d| |fzz }YnwxYw || } n(#t tt f$r|d | |fzz }YnQwxYw| | kr|d | ft| | zzz }n+||kr$|"t|t|krdS||krS|d |||z fzz } |d |t||fzz }n#t tt f$r |d ||fzz }Yn]wxYw||krS|d|||z fzz } |d |t||fzz }n'#t tt f$r |d||fzz }YnwxYw|} dd tjt!j|t!j|z} || | } ||| }||dS)NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r )r rgr>rlenrLNotImplementedError capitalizer rangemin IndexErrorrHjoindifflibndiffpprintpformat splitlines_truncateMessagerrQ)r!seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualzTestCase.assertSequenceEquals   $-MdH-- L++++8==)D///-KLLLdH-- L++++8==)D///-KLLL L'M  #t99DD./ # # #B!#III #   '4yy23 ' ' 'G%'  '  t||0"--//1(t4456I3tT??++   GEE!:/BC"N"#]!3#45IEE  GEE!:/BC"O"#]!3#45IEE E>>"K#$$)=eU)K)K"K#MNIE" DLLX%5JJ$t**,,Fd{{+.;TD[-IJK K"A#'4:)>)>"?#@AII!:/BCKKK#259=4I#JKIIIK+.;TD[-IJK L"A#'4:)>)>"?#@AII!:/BCLLL#36:M5J#KLIIIL  M&...99;; ...99;; = =>>>++KAA !!#{33 #slBB*)B*0CCC0D99!EE"E++!FF4H!H65H6 I++!JJcx|j}|t||kr||zS|tt|zzSr/)maxDiffr DIFF_OMITTED)r!rrmax_diffs rrzTestCase._truncateMessage's?<  s4yyH44T> !,T233rcD ||||tdSN)r)rr)r!list1list2rs rrzTestCase.assertListEqual-s,    sT BBBBBrcD ||||tdSr)rr)r!tuple1tuple2rs rrzTestCase.assertTupleEqual9s,    u EEEEErcL ||}nY#t$r"}|d|zYd}~n2d}~wt$r"}|d|zYd}~nd}~wwxYw ||}nY#t$r"}|d|zYd}~n2d}~wt$r"}|d|zYd}~nd}~wwxYw|s|sdSg}|r<|d|D]$}|t |%|r<|d|D]$}|t |%d|} |||| dS)Nz/invalid type when attempting set difference: %sz2first 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 ) differencerLrQrKrUreprrr) r!set1set2r difference1r- difference2linesitemrs rrzTestCase.assertSetEqualDs+  P//$//KK M M M IIG!K L L L L L L L L P P P IIJQN O O O O O O O O P Q//$//KK M M M IIG!K L L L L L L L L Q Q Q IIKaO P P P P P P P P Q {  F  ) LLE F F F# ) ) T$ZZ((((  ) LLE F F F# ) ) T$ZZ((((ii&&  $%%c;7788888sD A/A A/ A**A/3B CB00 C=CCc ||vrLt|dt|}||||dSdS)N not found in rrQrr!member containerrrs rassertInzTestCase.assertInosgR  " "2;F2C2C2C2C2;I2F2F2FHK IId))#{;; < < < < < # "rc ||vrLt|dt|}||||dSdS)Nz unexpectedly found in rrs r assertNotInzTestCase.assertNotInvsgV Y  ;DV;L;L;L;L8A)8L8L8LNK IId))#{;; < < < < <  rc ||urLt|dt|}||||dSdS)Nz is not rr!expr1expr2rrs rassertIszTestCase.assertIs}sfR   ,5e,<,<,<,<-6u-=-=-=?K IId))#{;; < < < < <  rc ||ur=dt|}||||dSdS)Nzunexpectedly identical: rrs r assertIsNotzTestCase.assertIsNotsRV E>>>:CE:J:J:JLK IId))#{;; < < < < < >rc ||td||td||krdt||z}ddt jt j|t j|z}| ||}| | ||dSdS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrzr ) assertIsInstancerr rrrrrrrrQr)r!d1d2rrrs rrzTestCase.assertDictEquals b$(LMMM b$(MNNN 88$';B'C'CCK499W]!>"--88::!>"--88::&<&<===D// TBBK IId))#{;; < < < < < 8rc J tjdtg}g}|D]u\}}||vr|||||krJ|t |dt |dt ||v|s|sdSd}|r"ddd|Dz}|r"|r|dz }|d d|zz }||||dS) Nz&assertDictContainsSubset is deprecatedz , expected: z , actual: rnz Missing: %s,c34K|]}t|VdSr/)r)r~rs rrz4TestCase.assertDictContainsSubset..s83=3=A9Q<<3=3=3=3=3=3=rz; zMismatched values: %s) r6r7r5itemsrUrrrQr) r!subset dictionaryrmissing mismatchedkeyvaluers rassertDictContainsSubsetz!TestCase.assertDictContainsSubsets}@ >( * * *  ,,.. @ @JC*$$s####*S/))!!#,S>>>>9U3C3C3C3C#,Z_#=#=#=#?@@@ :  F  ='#((3=3=4;3=3=3=+=+==K  J $t# 2SXXj5I5II IK $%%c;7788888rc t|t|}} tj|}tj|}||krdSt||}n #t$rt ||}YnwxYw|rfd}d|D}d|} ||| }|||}| |dSdS)NzElement counts were not equal: cg|]}d|zS)z First has %d, Second has %d: %rr)r~rs r z-TestCase.assertCountEqual..sWWW47$>WWWrr ) r collectionsCounterrrLrrrrrQ) r!rurvr first_seq second_seq differencesrrrs rassertCountEqualzTestCase.assertCountEquals !%U T&\\:  F' 22E (44F .y*EEKK  I I I1)ZHHKKK I  A?c ||td||td||kr*t||jkst||jkr|||||d}|d}t|dkr%|d|kr |dzg}|dzg}dt||z}dd tj ||z}| ||}| | ||dSdS) NzFirst argument is not a stringzSecond argument is not a stringT)keependsrz r rzrn)rr'r_diffThresholdrtrr r rrrrrQr)r!rurvr firstlines secondlinesrrs rrzTestCase.assertMultiLineEqualsd; eS*JKKK fc+LMMM F??E T000F d111%%eVS999))4)88J ++T+::K:!## F(;(;u(D(D#dl^ %}o $';E6'J'JJK"'''- K"H"HIIID// TBBK IId))#{;; < < < < < ?rc ||ksLt|dt|}||||dSdS)Nz not less than rr!abrrs r assertLesszTestCase.assertLesssYQ1uu3K IId))#{;; < < < < < ?rcf |-d}||||dSdS)Nzunexpectedly None)rQrrs rassertIsNotNonezTestCase.assertIsNotNones>6 ;-K IId))#{;; < < < < < ;rc t||s?t|d|}||||dSdS)Nz is not an instance of rgrrQrr!rCrOrrs rrzTestCase.assertIsInstance sa #s## =;DS>>>>33OK IId))#{;; < < < < < = =rc t||r?t|d|}||||dSdS)Nz is an instance of rrs rassertNotIsInstancezTestCase.assertNotIsInstances_: c3   =7@~~~~ssKK IId))#{;; < < < < < = =rcT t|||}|d||S)NassertRaisesRegexr^)r!r_rrWrXr`s rrzTestCase.assertRaisesRegexs2 ''94PP~~14@@@rcT t|||}|d||S)NassertWarnsRegexrc)r!rdrrWrXr`s rrzTestCase.assertWarnsRegex(s2 &&6nMM~~0$???rc t|ttfrtj|}||s8d|jd|}|||}||dS)NzRegex didn't match: r) rgr'bytesrrrrrr>)r!textrrrs r assertRegexzTestCase.assertRegex;sK nsEl 3 3 8Z77N$$T** - -&&&.K%%c;77C'',, ,  - -rcd t|ttfrtj|}||}|rgd|||d|jd|}| ||}| |dS)NzRegex matched: z matches z in ) rgr'rrrrstartendrrr>)r!runexpected_regexrmatchrs rassertNotRegexzTestCase.assertNotRegexGsG &e 5 5 <!z*:;;  ''--  - -U[[]]UYY[[0111 (((K %%c;77C'',, , - -rcfd}|S)Ncztjdjtd|i|S)NzPlease use {0} instead.r4)r6r7rr r5)rWrX original_funcs rdeprecated_funcz,TestCase._deprecate..deprecated_funcWsG M)001GHH"A ' ' '!=$1&11 1rr)rrs` r _deprecatezTestCase._deprecateVs$ 2 2 2 2 2 r)rr/)NNNNN)dr rrAssertionErrorr>rZrrrr"rrrrrrrrrrrrrrrrrr"r0r1_subtest_msg_sentinelr+r,r/r1r7r9r;rDrArHrKrMrOrQrVrXrr]rbrorqrxrtr}rrrrrrrrrrrrrrrrrrrrrrrrrrr rrfailUnlessEqual assertEquals failIfEqualassertNotEqualsfailUnlessAlmostEqualassertAlmostEqualsfailIfAlmostEqualassertNotAlmostEquals failUnlessassert_failUnlessRaisesfailIfassertRaisesRegexpassertRegexpMatchesassertNotRegexpMatches __classcell__rs@rrrXs@&KGN33333 >>>>@ 6 6 6888333==[= 77[7      VV[Vaa[a###CCCJJJ=== 888eee@@@/####</// ' ' 'UUU """====~    ? ?[ ?'''999"))))---- ---- III*B;;;>FFFF0EEEE%%%4----////----AE $+)+)+)+)ZDH#'!)!)!)!)FaaaaF444 C C C C F F F F)9)9)9)9V================ = = = =9999:@====(==== ==== ==== ==== ==== ==== ======== AAA @@@& - - - - - - - -&0Z %<%<$>>K/1;)r!r$rr$rs rr"z_SubTest.__init__s?  " ) :rc td)Nzsubtests cannot be run directly)rrs rrz_SubTest.runTests!"CDDDrctg}|jtur-|d|j|jr^dd|jD}|d|d|pdS)Nz[{}]z, c3HK|]\}}d||VdS)z{}={!r}N)r)r~rrs rrz+_SubTest._subDescription..sJ$3$3Q  A&&$3$3$3$3$3$3rz({}) z ())r=rrUrr$rr)r!parts params_descs r_subDescriptionz_SubTest._subDescriptions = 5 5 5 LLt}55 6 6 6 ; 5))$3$3"k//11$3$3$333K LL{33 4 4 4xx/-/rcd|j|SNz{} {})rr$rrDrs rrz _SubTest.ids0~~dn//1143G3G3I3IJJJrc6 |jSr/)r$rrs rrz_SubTest.shortDescriptions ~..000rc\d|j|SrF)rr$rDrs rrz_SubTest.__str__s$~~dnd.B.B.D.DEEEr) r rrr"rrDrrrr'r(s@rr&r&s;;;;;EEE 0 0 0KKK111 FFFFFFFrr&)1r(rhrrrr6rr0rrornrutilrrrrr __unittestobjectrrr^r rrrr&r*rDrRrTrYr[rarqrvrxr r}rrrrChainMaprrr*r&rrrrMs   ?????????????? 7 y)  &8&8&8&8&8v&8&8&8R%%%,,,   666 000    (III 33333333'''''3'''T$8$8$8$8$83$8$8$8N1D1D1D1D1D21D1D1Dh{+P8P8P8P8P8vP8P8P8h 7:7:7:7:7:x7:7:7:t!F!F!F!F!Fx!F!F!F!F!FrPK!HҖ*__pycache__/__init__.cpython-311.opt-1.pycnu[ 0i^dZgdZegddZddlmZddlmZmZm Z m Z m Z m Z m Z mZmZmZddlmZmZddlmZmZdd lmZmZdd lmZmZdd lmZmZmZm Z dd lm!Z!m"Z"m#Z#eZ$d Z%dZ&dZ'dS)a Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework (used with permission). This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Simple usage: import unittest class IntegerArithmeticTestCase(unittest.TestCase): def testAdd(self): # test method names begin with 'test' self.assertEqual((1 + 2), 3) self.assertEqual(0 + 1, 1) def testMultiply(self): self.assertEqual((0 * 10), 0) self.assertEqual((5 * 8), 40) if __name__ == '__main__': unittest.main() Further information is available in the bundled documentation, and from http://docs.python.org/library/unittest.html Copyright (c) 1999-2003 Steve Purcell Copyright (c) 2003-2010 Python Software Foundation This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContext)getTestCaseNames makeSuite findTestCasesT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrr)rrrcvddl}|jt}|||S)N) start_dirpattern)os.pathpathdirname__file__discover)loadertestsr!osthis_dirs 8/opt/alt/python311/lib64/python3.11/unittest/__init__.py load_testsr,Os4NNNwx((H ??Xw? ? ??cJtdhzS)Nr)globalskeysr-r+__dir__r2Zs 99>>  89 99r-c\|dkr ddlmatStdtd|)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r+ __getattr__r8]sE (((777777&& I8IIII J JJr-N)(__doc____all__extend __unittestresultrcaserrrr r r rrrrsuiterrr'rr r rrunnerrrsignalsrrrrrrr_TextTestResultr,r2r8r1r-r+rCs,,\ I I IAAABBB  '''''''''''''''''''''''',+++++++11111111########22222222PPPPPPPPPPPP>>>>>>>>>>! @@@:::KKKKKr-PK!a55)__pycache__/signals.cpython-311.opt-2.pycnu[ 0ic ~ddlZddlZddlmZdZGddeZejZdZ dZ da dZ d d Z dS) N)wrapsTceZdZdZdZdS)_InterruptHandlercd|_||_t|tr@|tjkr tj}n#|tjkrd}ntd||_ dS)NFcdSN) unused_signum unused_frames 7/opt/alt/python311/lib64/python3.11/unittest/signals.pydefault_handlerz3_InterruptHandler.__init__..default_handlersDzYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr )selfr s r __init__z_InterruptHandler.__init__ s / os + + 3&.00"("< FN22 !2333 /rctjtj}||ur||||jr|||d|_t D]}|dS)NT)r getsignalSIGINTr r_resultskeysstop)rsignumframeinstalled_handlerresults r __call__z_InterruptHandler.__call__s",V];; D ( (   / / / ; 0   / / / mmoo  F KKMMMM  rN)__name__ __module__ __qualname__rr$r rr rr s2///$     rrcdt|<dS)N)rr#s r registerResultr+*sHVrcRtt|dSr)boolrpopr*s r removeResultr/-s  VT** + ++rctStjtj}t |atjtjtdSdSr)_interrupt_handlerrrrr)r s r installHandlerr21sK! *6=99.?? fm%788888"!rctfd}|St+tjtjtjdSdS)Nctjtj}t |i|tjtj|S#tjtj|wxYwr)rrr removeHandler)argskwargsinitialmethods r innerzremoveHandler..inner;sf&v}55G OOO 6vt.v.. fmW5555 fmW5555s A!A7)rr1rrr)r9r:s` r r5r59sg  v 6 6 6 6  6 % fm%7%HIIIII&%rr)rweakref functoolsr __unittestobjectrWeakKeyDictionaryrr+r/r1r2r5r rr r@s   @ %7 $ & &,,,999JJJJJJrPK!mvn@n@(__pycache__/runner.cpython-311.opt-1.pycnu[ 0i$dZddlZddlZddlZddlmZddlmZddlm Z dZ Gdd e Z Gd d ej ZGd d e ZdS)z Running testsN)result)_SubTest)registerResultTc&eZdZdZdZdZddZdS)_WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodc||_dSN)stream)selfr s 6/opt/alt/python311/lib64/python3.11/unittest/runner.py__init__z_WritelnDecorator.__init__s  cR|dvrt|t|j|S)N)r __getstate__)AttributeErrorgetattrr )r attrs r __getattr__z_WritelnDecorator.__getattr__s. - - - && &t{4(((rNc^|r|||ddSN )write)r args r writelnz_WritelnDecorator.writelns1   JJsOOO 4rr )__name__ __module__ __qualname____doc__rrrrr rrsLJJ))) rrceZdZdZdZdZfdZdZfdZdZ fdZ fd Z fd Z fd Z fd Zfd ZfdZdZdZxZS)TextTestResultzhA test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------ctt||||||_|dk|_|dk|_||_d|_dS)NrT)superr"rr showAlldots descriptions_newline)r r r' verbosity __class__s r rzTextTestResult.__init__&sU nd##,,V\9MMM  1} N ( rc|}|jr&|r$dt||fSt|Sr)shortDescriptionr'joinstr)r testdoc_first_lines r getDescriptionzTextTestResult.getDescription.sN..00    99c$ii899 9t99 rc8tt|||jri|j|||jd|jd|_dSdS)N ... F) r$r" startTestr%r rr1flushr(r r/r*s r r4zTextTestResult.startTest5s nd##--d333 < " K  d11$77 8 8 8 K  g & & & K     !DMMM  " "rct|t}|s|jr|js|j|r|jd|j|||jd|j||jd|_dS)Nz r3T) isinstancerr(r rrr1r5)r r/status is_subtests r _write_statuszTextTestResult._write_status=sh//  ' '= & ##%%% ( !!$''' K  d11$77 8 8 8 K  g & & & F###  rc||jrIt|d|jr||dn||dnp|jrit|d|jr|jdn|jd|jtt| |||dS)NrFAILERRORFE) r% issubclassfailureExceptionr;r&r rr5r$r" addSubTest)r r/subtesterrr*s r rCzTextTestResult.addSubTestJs ?| $c!fg&>??9&&w7777&&w8888 $c!fg&>??+K%%c****K%%c*** !!### nd##..tWcBBBBBrctt|||jr||ddS|jr5|jd|jdSdS)Nok.) r$r" addSuccessr%r;r&r rr5r6s r rIzTextTestResult.addSuccessYs nd##..t444 <   tT * * * * * Y K  c " " " K         rctt||||jr||ddS|jr5|jd|jdSdS)Nr>r@) r$r"addErrorr%r;r&r rr5r r/rEr*s r rKzTextTestResult.addErroras nd##,,T3777 <   tW - - - - - Y K  c " " " K         rctt||||jr||ddS|jr5|jd|jdSdS)Nr=r?) r$r" addFailurer%r;r&r rr5rLs r rNzTextTestResult.addFailureis nd##..tS999 <   tV , , , , , Y K  c " " " K         rc6tt||||jr+||d|dS|jr5|jd|j dSdS)Nz skipped {0!r}s) r$r"addSkipr%r;formatr&r rr5)r r/reasonr*s r rQzTextTestResult.addSkipqs nd##++D&999 <   t_%;%;F%C%C D D D D D Y K  c " " " K         rcJtt||||jr5|jd|jdS|jr5|jd|jdSdS)Nzexpected failurex) r$r"addExpectedFailurer%r rr5r&rrLs r rVz!TextTestResult.addExpectedFailureys nd##66tSAAA < K   2 3 3 3 K        Y K  c " " " K         rcHtt|||jr5|jd|jdS|jr5|jd|jdSdS)Nzunexpected successu) r$r"addUnexpectedSuccessr%r rr5r&rr6s r rYz#TextTestResult.addUnexpectedSuccesss nd##88>>> < K   4 5 5 5 K        Y K  c " " " K         rc|js|jr2|j|j|d|j|d|jt|dd}|ro|j|j |D]2}|jd| |3|jdSdS)Nr>r=unexpectedSuccessesr zUNEXPECTED SUCCESS: ) r&r%r rr5printErrorListerrorsfailuresr separator1r1)r r[r/s r printErrorszTextTestResult.printErrorss 9   K   ! ! ! K      GT[111 FDM222%d,A2FF  K   0 0 0+ X X ##$V4;N;Nt;T;T$V$VWWWW K          rcb|D]\}}|j|j|j|d|||j|j|jd|z|jdS)Nz: z%s)r rr_r1 separator2r5)r flavourr]r/rEs r r\zTextTestResult.printErrorLists  ID# K   0 0 0 K  GGGD4G4G4M4M4M N O O O K   0 0 0 K  s + + + K         r)rrrrr_rbrr1r4r;rCrIrKrNrQrVrYr`r\ __classcell__)r*s@r r"r"sWJJ"""""    C C C C C                                         rr"c4eZdZdZeZ d dddZdZd ZdS) TextTestRunnerzA test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. NTrF) tb_localsc| tj}t||_||_||_||_||_||_||_ | ||_ dSdS)zConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysstderrrr r'r)failfastbufferrgwarnings resultclass) r r r'r)rkrlrnrmrgs r rzTextTestRunner.__init__sf >ZF'// ("   "   "*D    # "rcN||j|j|jSr )rnr r'r))r s r _makeResultzTextTestRunner._makeResults! T->OOOrc|}t||j|_|j|_|j|_t j5|jr>t j|j|jdvrt jdtdtj }t|dd}| | ||t|dd}| |n##t|dd}| |wwxYwtj }dddn #1swxYwY||z }|j t|dr|j|j|j}|jd ||d krd pd |fz|jd x} x} } t't(|j|j|jf} | \} } } n#t0$rYnwxYwg} |jsw|jdt)|jt)|j}}|r| d|z|r| d|zn|jd| r| d| z| r| d| z| r| d| z| r2|jdd| dn|jd|j|S)z&Run the given test case or test suite.)defaultalwaysmodulezPlease use assert\w+ instead.)categorymessage startTestRunN stopTestRunrbzRan %d test%s in %.3fsrrPrFAILEDz failures=%dz errors=%dOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rprrkrlrgrmcatch_warnings simplefilterfilterwarningsDeprecationWarningtime perf_counterrr`hasattrr rrbtestsRunmaplenexpectedFailuresr[skippedr wasSuccessfulrr^r]appendr-r5)r r/r startTimerwrxstopTime timeTakenrun expectedFailsr[rresultsinfosfailederroreds r rzTextTestRunner.runs!!##v-  >  $ & & + +} F%dm444 =$999+H%7$DFFFF)++I"6>4@@L'  "V %fmTBB *KMMM&fmTBB *KMMMM+(**H/ + + + + + + + + + + + + + + +0y(  6< ( ( 3 K   1 2 2 2o 4 #("2s"8b)DE F F F 899 9+g B# 7 & : & 011G ;B 7M.    D  #v#%% $ K  h ' ' '!&/22C 4F4FGF 5 ]V3444 4 [72333 K  d # # #  1 LL/ 0 0 0  A LL/-? @ @ @  J LL25HH I I I  $ K   499U+;+;+;+; = > > > > K  d # # #  s=A6D= C;D=; DD==EE'H HH)NTrFFNN) rrrrr"rnrrprr rr rfrfsr !KABJN+#+++++(PPPGGGGGrrf)rrirrmryrcasersignalsr __unittestobjectr TestResultr"rfr rr rs ######           @ @ @ @ @ V&@ @ @ FfffffVfffffrPK!a55#__pycache__/signals.cpython-311.pycnu[ 0ic ~ddlZddlZddlmZdZGddeZejZdZ dZ da dZ d d Z dS) N)wrapsTceZdZdZdZdS)_InterruptHandlercd|_||_t|tr@|tjkr tj}n#|tjkrd}ntd||_ dS)NFcdSN) unused_signum unused_frames 7/opt/alt/python311/lib64/python3.11/unittest/signals.pydefault_handlerz3_InterruptHandler.__init__..default_handlersDzYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr )selfr s r __init__z_InterruptHandler.__init__ s / os + + 3&.00"("< FN22 !2333 /rctjtj}||ur||||jr|||d|_t D]}|dS)NT)r getsignalSIGINTr r_resultskeysstop)rsignumframeinstalled_handlerresults r __call__z_InterruptHandler.__call__s",V];; D ( (   / / / ; 0   / / / mmoo  F KKMMMM  rN)__name__ __module__ __qualname__rr$r rr rr s2///$     rrcdt|<dS)N)rr#s r registerResultr+*sHVrcRtt|dSr)boolrpopr*s r removeResultr/-s  VT** + ++rctStjtj}t |atjtjtdSdSr)_interrupt_handlerrrrr)r s r installHandlerr21sK! *6=99.?? fm%788888"!rctfd}|St+tjtjtjdSdS)Nctjtj}t |i|tjtj|S#tjtj|wxYwr)rrr removeHandler)argskwargsinitialmethods r innerzremoveHandler..inner;sf&v}55G OOO 6vt.v.. fmW5555 fmW5555s A!A7)rr1rrr)r9r:s` r r5r59sg  v 6 6 6 6  6 % fm%7%HIIIII&%rr)rweakref functoolsr __unittestobjectrWeakKeyDictionaryrr+r/r1r2r5r rr r@s   @ %7 $ & &,,,999JJJJJJrPK!se_6_6&__pycache__/case.cpython-311.opt-1.pycnu[ 0iBdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZmZmZdZeZdZGdd eZGd d eZGd d eZGddeZdZdZdZdZgZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(GddZ)Gdde)Z*Gd d!e*Z+Gd"d#e*Z,Gd$d%ej-Z.Gd&d'eZ/Gd(d)e/Z0Gd*d+e/Z1dS),zTest 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.ceZdZdZdS)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__4/opt/alt/python311/lib64/python3.11/unittest/case.pyr r srr ceZdZdZdS) _ShouldStopz The test should stop. Nr rrrrr!rrceZdZdZdS)_UnexpectedSuccessz7 The test was supposed to fail, but it didn't! Nr rrrrr&rrrc8eZdZddZejddZdS)_OutcomeNchd|_||_t|d|_d|_d|_dS)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init__z_Outcome.__init__-s8!& (/ (E(E% #rFc#BK|j}d|_ dV|r(|jr!|j|j|dn#t$rt $r4}d|_t |j|t|Yd}~nzd}~wt$rYnktj }|j r||_ nAd|_|r"|j|j||nt|j||d}YnxYw|jo||_dS#|jo||_wxYw)NTF)r rr test_caseKeyboardInterruptr _addSkipstrrsysexc_inforr! _addError)r"r%subTest old_successer*s rtestPartExecutorz_Outcome.testPartExecutor4sql   8 EEE, M4< M &&y':ItLLL-!     5 5 5 DL T[)SVV 4 4 4 4 4 4 4 4    D |~~H% @'/$$$ @K**9+> 8TTTTdk9h???HHH  <7KDLLL4<7KDL 7 7 7 7s;A+DC;*B?D C;DA&C;9DDN)F)r rrr# contextlibcontextmanagerr/rrrrr,sL$$$$888888rrct|dd}||||dStjdtd|j|dS)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr%reasonr4s rr'r'Usffi..G 6""""" L$a ) ) ))$$$$$rc|C|Ct|d|jr|j||dS|j||dSdSdS)Nr) issubclassfailureException addFailureaddError)rtestr*s rr+r+^si h2 hqk4#8 9 9 , F dH - - - - - FOD( + + + + + 22rc|Sr0r)objs r_idrDes Jrct|} |j}|j}n/#t$r"t d|jd|jddwxYw||}|||ddd|S)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrRis r((CO | OOODCNDDS-=DDDEEJN OOU2YYFJtRtT*** Ms  ,A c@t|||fdS)znSame as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).N)_module_cleanupsappend)functionargskwargss raddModuleCleanuprYys%XtV455555rc,t|tS)z&Same as enterContext, but module-wide.)rRrY)rMs renterModuleContextr[~s ". / //rcg}trZt\}}} ||i|n,#t$r}||Yd}~nd}~wwxYwtZ|r|ddS)zWExecute all module cleanup functions. Normally called for you after tearDownModule.Nr)rTpop ExceptionrU) exceptionsrVrWrXexcs rdoModuleCleanupsrasJ #!1!5!5!7!7$ # Hd %f % % % % # # #   c " " " " " " " " # # ms1 AAAcdfd}ttjr}d||S|S)z& Unconditionally skip a test. ct|ts!tj|fd}|}d|_|_|S)Nc"tr0r )rWrXr;s r skip_wrapperz-skip..decorator..skip_wrappersv&&&rT) isinstancerH functoolswraps__unittest_skip____unittest_skip_why__) test_itemrfr;s r decoratorzskip..decorators^)T** % _Y ' ' ' ' ' '( ' '$I&* #*0 'r)rgtypes FunctionType)r;rmrls` rskiprqsS     &%,--$ y### rc2|rt|StS)z/ Skip a test if the condition is true. rqrD conditionr;s rskipIfrvsF|| Jrc2|st|StS)z3 Skip a test unless the condition is true. rsrts r skipUnlessrxs F|| Jrcd|_|S)NT)__unittest_expecting_failure__)rls rr!r!s/3I, rct|trtfd|DSt|tot |S)Nc38K|]}t|VdSr0) _is_subtype).0r.basetypes r z_is_subtype..s->>;q(++>>>>>>r)rgtupleallrHr=)expectedrs `rr}r}sW(E""?>>>>X>>>>>> h % % H*Xx*H*HHrceZdZdZdZdS)_BaseTestCaseContextc||_dSr0)r%)r"r%s rr#z_BaseTestCaseContext.__init__s "rcv|j|j|}|j|r0)r%_formatMessagemsgr>)r" standardMsgrs r _raiseFailurez"_BaseTestCaseContext._raiseFailures1n++DHkBBn--c222rN)r rrr#rrrrrrs2###33333rrceZdZddZdZdS)_AssertRaisesBaseContextNct||||_||_|t j|}||_d|_d|_dSr0) rr#rr%recompileexpected_regexobj_namer)r"rr%rs rr#z!_AssertRaisesBaseContext.__init__sU%%dI666  "  %Z77N, rc t|j|jst|d|j|sM|dd|_|r,ttt|d|d}S|^}} |j |_ n$#t$rt||_ YnwxYw|5||i|dddn #1swxYwYd}dS#d}wxYw)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. z() arg 1 must be rNz1 is an invalid keyword argument for this function) r}r _base_typerL_base_type_strr]rnextiterr rrKr()r"namerWrX callable_objs rhandlez_AssertRaisesBaseContext.handlesz t}do>> =!%t':':!<=== !::eT22M#7;DLL7I7I7I7I%LMMMDD#' L4 2 , 5 ! 2 2 2 #L 1 1  2 . . d-f--- . . . . . . . . . . . . . . .DDD4DKKKKsZA?C C BC B74C 6B77C < C C CC CC C$r0)r rrr#rrrrrrs7rrcFeZdZdZeZdZdZdZe e j Z dS)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typesc|Sr0rr"s rrIz_AssertRaisesContext.__enter__s rc| |jj}n$#t$rt|j}YnwxYw|jr/|d||jn=|d|ntj|t||jsdS| d|_ |j dS|j }| t|s;|d|jt|dS)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rr rKr(rrformat traceback clear_framesr=with_traceback exceptionrsearchpattern)r"exc_type exc_valuetbexc_namers rrJz_AssertRaisesContext.__exit__se   .=1! . . .t}-- .} E""#8#?#?@D $O$OPPPP""?#9#9(#C#CDDDD  "2 & & &(DM22 5"11$77   &4,$$S^^44 >   9@@#+S^^ = = > > >ts 22N) r rrr BaseExceptionrrrIrJ classmethodro GenericAlias__class_getitem__rrrrrsSMMJDN6$ E$677rrc&eZdZdZeZdZdZdZdS)_AssertWarnsContextzBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typesc6ttjD]}t |ddri|_t jd|_|j |_t j d|j |S)N__warningregistry__T)recordalways) listr)modulesvaluesr6rr7catch_warningswarnings_managerrI simplefilterr)r"vs rrIz_AssertWarnsContext.__enter__ sck((**++ + +Aq/66 +(*% ( 7t D D D-7799 h 666 rc|j||||dS |jj}n$#t$rt |j}YnwxYwd}|jD]s}|j}t||js||}|j (|j t |sR||_ |j |_ |j |_ dS|@|d|j jt ||jr0|d||jdS|d|dS)Nrz{} not triggered by {}z{} not triggered)rrJrr rKr(r7messagergrrwarningfilenamelinenorrrr)r"rrrrfirst_matchingmws rrJz_AssertWarnsContext.__exit__+s &&xB???   F *}-HH * * *4=))HHH *  A Aa// %!"#/'..s1vv660DLJDM(DK FF  %   9@@(0#n2E2E G G H H H = D   7>>x?C} N N O O O O O   188BB C C C C Cs /AAN) r rrrWarningrrrIrJrrrrrsGLLJ?N    D D D D DrrceZdZdZdS)_OrderedChainMapc#~Kt}|jD]$}|D]}||vr|||V %dSr0)setmapsadd)r"seenmappingks r__iter__z_OrderedChainMap.__iter__Os`uuy  G  D==HHQKKKGGG   rN)r rrrrrrrrNs#rrceZdZdZeZdZdZdZfdZ dOdZ dZ d Z d Z ed Zed Zd ZdZedZedZdZdZdZdZdZdZdZdZejefdZ dZ!dZ"dZ#dZ$dZ%dZ&dPd!Z'd"Z(ed#Z)d$Z*d%Z+d&Z,dPd'Z-dPd(Z.dPd)Z/d*Z0d+Z1d,Z2dQd-Z3dQd.Z4d/Z5dPd0Z6dPd1Z7dPd2Z8 dRd3Z9 dRd4Z:dQd5Z;d6ZdPd9Z?dPd:Z@dPd;ZAdPd<ZBdPd=ZCdPd>ZDdPd?ZEdPd@ZFdPdAZGdPdBZHdPdCZIdPdDZJdPdEZKdPdFZLdPdGZMdPdHZNdPdIZOdJZPdKZQdPdLZRdPdMZSdNZTeTe7xZUZVeTe8xZWZXeTe9xZYZZeTe:xZ[Z\eTe/xZ]Z^eTe1Z_eTe.Z`eTePZaeTeRZbeTeSZcxZdS)STestCaseaWA 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. TiicVd|_g|_tj|i|dS)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rOrWrX __class__s rrzTestCase.__init_subclass__s5 % !!42622222rrunTestc:||_d|_d|_ t||}|j|_n0#t $r#|dkrt d|jd|YnwxYwg|_d|_ i|_ | td| td| td| td | t d | t"d 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 : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr6rrK ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr()r" methodName testMethods rr#zTestCase.__init__sA * ' 5 z22J#-"4D   4 4 4Y&&!j~~~zz"3444'& 4 %'!   '8999   '8999   (:;;;   &6777   ,<===   &<=====s4*A! A!c||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)r"typeobjrVs rrzTestCase.addTypeEqualityFuncs.6!'***rc@|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).N)rrUr"rVrWrXs r addCleanupzTestCase.addCleanups' xv677777rc,t||jS)zEnters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method. )rRr)r"rMs r enterContextzTestCase.enterContexts b$/222rc@|j|||fdS)zpSame as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).N)rrUrOrVrWrXs raddClassCleanupzTestCase.addClassCleanups( ""HdF#;<<<<t|jd|jS)NrGrrrrs ridz TestCase.ids#"4>2222D4H4HIIrclt|t|urtS|j|jkSr0)rHNotImplementedrr"others r__eq__zTestCase.__eq__s0 ::T%[[ ( (! !#u'<<rrs r__repr__zTestCase.__repr__s.(((($*>*>*>@ @rc+K|j |jjsdVdS|j}|t|}n|j|}t ||||_ |j|jd5dVdddn #1swxYwY|jjs|jj }||j rtn|jj rt||_dS#||_wxYw)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. NT)r,) rrrrparams new_child_SubTestr/r rfailfastrr!)r"rr#parent params_maprs rr,zTestCase.subTestsI =  (N EEE F >)&11JJ0088J sJ77  #// t/LL                 =( "-%&/%%%. ""!"DMMMFDM " " " "s0&!C(B C(BC(B ?C(( C1c |j}|||dS#t$r.tjdt|j|YdSwxYw)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerKr7r8r9r:)r"rr*r*s r_addExpectedFailurezTestCase._addExpectedFailure&s~ /!'!:   tX . . . . .  $ $ $ M\( * * * F d # # # # # # $s4AAc |j}||dS#t$rXtjdt t d#t $r'|j|tjYYdSwxYwwxYw)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrKr7r8r9rr?r)r*)r"rr-s r_addUnexpectedSuccesszTestCase._addUnexpectedSuccess0s '#)#>  !  & & & & & 8 8 8 M_( * * * 8(d2% 8 8 8!!$ 7777777 8 8s&$A8A,A4/A83A44A8c.|dSr0)rrs r _callSetUpzTestCase._callSetUp?s rc^|"tjd|dtddSdS)NzFIt is deprecated to return a value that is not None from a test case (r) stacklevel)r7r8DeprecationWarning)r"methods r_callTestMethodzTestCase._callTestMethodBs\ 688  M2(.2223ERS U U U U U U rc.|dSr0)rrs r _callTearDownzTestCase._callTearDownGs rc||i|dSr0rrs r _callCleanupzTestCase._callCleanupJs$!&!!!!!rNc|C|}t|dd}t|dd}| |nd}|j| t||j}t|jddst|ddrWt|jddpt|dd}t |||||j|| |SSt|ddpt|dd}t|} ||_| |5| dddn #1swxYwY|j r||_ | |5| |dddn #1swxYwYd|_ | |5|dddn #1swxYwY||j rK|r9|jr|||jn&||n|j||d|_d}d|_|j|| |SS#d|_d}d|_wxYw#|j|| |wwxYw)N startTestRun stopTestRunrjFrkrnrz)rr6 startTestrrr'stopTestrrr/r0r rr6r8 doCleanupsr!r+r.r:)r"rr<r=rskip_whyroutcomes rrunz TestCase.runMs >++--F"6>4@@L!&->>K' K2  t';<FFM $DeLL v&&G % ' --d33&&OO%%%&&&&&&&&&&&&&&&?-0AG- 11$7799,,Z88899999999999999905G- 11$77--**,,,---------------!!!?0(0"2? 44VW=TUUUU 66v>>>>))$///+/'!%  FOD ! ! !& '+/'!% $$$$ FOD ! ! !& 'sA5J(,1J(J:E JEJ"E#&J F+ J+F//J2F/3JG3' J3G77J:G7;A*J%J(J%%J((Kc |jp t}|jrb|j\}}}||5|j|g|Ri|dddn #1swxYwY|jb|jS)zNExecute all cleanup functions. Normally called for you after tearDown.N)rrrr]r/r:r )r"rBrVrWrXs rr@zTestCase.doCleanupss--8::n =%)^%7%7%9%9 "HdF))$// = =!!(%> "HdF ?$)&)))) ? ? ?'..s|~~>>>>> ? ! ? ? ? ? ?s65A.-A.c|j|i|Sr0)rC)r"rWkwdss r__call__zTestCase.__call__stx&&&&rct||j}t|jddst|ddr6t|jddpt|dd}t||||||jr7|j\}}}|j |g|Ri||j5dSdS)z6Run the test without collecting errors in a TestResultrjFrkrnN) r6rrr r0r6r8rr]r:)r"rrArVrWrXs rdebugzTestCase.debugsT4#788 DN$7 ? ? % J 3U ; ; % 0GLLL":/FKK 8$$ $  Z((( n 9%)^%7%7%9%9 "HdF D h 8 8 8 8 8 8 8n 9 9 9 9 9rc t|)zSkip this test.re)r"r;s rskipTestzTestCase.skipTestsvrc,||)z)Fail immediately, with the given message.)r>)r"rs rfailz TestCase.fails##C(((rc|r;||dt|z}||dS)z#Check that the expression is false.z%s is not falseNrrr>r"exprrs r assertFalsezTestCase.assertFalsesI  -%%c+>.$??GGdGNNNNs+/cPt||}|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) assertWarnsrr)r"expected_warningrWrXr_s rrazTestCase.assertWarnss*8&&6==~~mT6:::rc,ddlm}||||dS)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_AssertLogsContextFno_logs_logrfr"loggerlevelrfs r assertLogszTestCase.assertLogs"s0* -,,,,,!!$uEEEErc,ddlm}||||dS)z Fail unless no log messages of level *level* or higher are emitted on *logger_name* or its children. This method must be used as a context manager. rreTrgrirks r assertNoLogszTestCase.assertNoLogs:s0 -,,,,,!!$tDDDDrct|t|urP|jt|}|'t|trt ||}|S|jS)aGet a detailed comparison function for the types of the two args. Returns: A callable accepting (first, second, msg=None) that will raise a failure exception if first != second with a useful human readable error message for those types. )rHrgetrgr(r6_baseAssertEqual)r"firstsecondasserters r_getAssertEqualityFunczTestCase._getAssertEqualityFuncCsl" ;;$v,, & &044T%[[AAH#h,,7&tX66H$$rc||ks>dt||z}|||}||dS)z:The default assertEqual implementation, not type specific.%s != %sN)r rr>)r"rtrurrs rrszTestCase._baseAssertEqual]sP$';E6'J'JJK%%c;77C'',, ,rcN|||}||||dS)z[Fail if the two objects are unequal as determined by the '==' operator. )rN)rw)r"rtrurassertion_funcs r assertEqualzTestCase.assertEqualds644UFCCuf#......rc||ksJ||t|dt|}||dS)zYFail if the two objects are equal as determined by the '!=' operator.  == NrR)r"rtrurs rassertNotEqualzTestCase.assertNotEqualkse%%c59I9I9I9I:CF:K:K:K,MNNC'',, ,rc ||krdS||tdt||z }|K||krdSt|dt|dt|dt|d}nO|d}t||dkrdSt|dt|d|d t|d}|||}||) a'Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). If the two objects compare equal then they will automatically compare almost equal. N specify delta or places not bothz !=  within  delta ( difference)rz places (rLabsrroundrr>r"rtruplacesrdeltadiffrs rassertAlmostEqualzTestCase.assertAlmostEqualts, F?? F  !3>?? ?56>""  u}}%    &!!!!%    $ !KK ~T6""a''%    &!!!!$ !K !!#{33##C(((rc ||tdt||z }|Q||ks||krdSt|dt|dt|dt|d}nE|d}||kst||dkrdSt|dt|d|d }|||}||) aFail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). Objects that are equal automatically fail. Nrr~rrrrrz placesrrs rassertNotAlmostEqualzTestCase.assertNotAlmostEquals  !3>?? ?56>""  VOO%    &!!!!%    $ !KK ~VOOtV)<)<)A)A9B59I9I9I9I9B69J9J9J9J9?AK!!#{33##C(((rc |x|j}t||s(|d|dt|t||s(|d|dt|nd}d} t |}n#t t f$rd|z}YnwxYw|- t |}n#t t f$rd|z}YnwxYw|||krdSd|ft||zz}tt||D]} || } n(#t tt f$r|d | |fzz }YnwxYw || } n(#t tt f$r|d | |fzz }YnQwxYw| | kr|d | ft| | zzz }n+||kr$|"t|t|krdS||krS|d |||z fzz } |d |t||fzz }n#t tt f$r |d||fzz }Yn]wxYw||krS|d|||z fzz } |d |t||fzz }n'#t tt f$r |d||fzz }YnwxYw|} dd tjt!j|t!j|z} || | } ||| }||dS)aAAn equality assertion for ordered sequences (like lists and tuples). For the purposes of this function, a valid ordered sequence type is one which can be indexed, has a length, and has an equality operator. Args: seq1: The first sequence to compare. seq2: The second sequence to compare. seq_type: The expected datatype of the sequences, or None if no datatype should be enforced. msg: Optional message to use on failure instead of a list of differences. NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r )r rgr>rlenrLNotImplementedError capitalizer rangemin IndexErrorrHjoindifflibndiffpprintpformat splitlines_truncateMessagerrP)r"seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualzTestCase.assertSequenceEquals  $-MdH-- L++++8==)D///-KLLLdH-- L++++8==)D///-KLLL L'M  #t99DD./ # # #B!#III #   '4yy23 ' ' 'G%'  '  t||0"--//1(t4456I3tT??++   GEE!:/BC"N"#]!3#45IEE  GEE!:/BC"O"#]!3#45IEE E>>"K#$$)=eU)K)K"K#MNIE" DLLX%5JJ$t**,,Fd{{+.;TD[-IJK K"A#'4:)>)>"?#@AII!:/BCKKK#259=4I#JKIIIK+.;TD[-IJK L"A#'4:)>)>"?#@AII!:/BCLLL#36:M5J#KLIIIL  M&...99;; ...99;; = =>>>++KAA !!#{33 #slBB)(B)/B??CC/D88!EE!E**!FF3H!H54H5 I**!J Jcx|j}|t||kr||zS|tt|zzSr0)maxDiffr DIFF_OMITTED)r"rrmax_diffs rrzTestCase._truncateMessage's?<  s4yyH44T> !,T233rcB||||tdS)aA list-specific equality assertion. Args: list1: The first list to compare. list2: The second list to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r"list1list2rs rrzTestCase.assertListEqual-s'   sT BBBBBrcB||||tdS)aA tuple-specific equality assertion. Args: tuple1: The first tuple to compare. tuple2: The second tuple to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r"tuple1tuple2rs rrzTestCase.assertTupleEqual9s'   u EEEEErcJ ||}nY#t$r"}|d|zYd}~n2d}~wt$r"}|d|zYd}~nd}~wwxYw ||}nY#t$r"}|d|zYd}~n2d}~wt$r"}|d|zYd}~nd}~wwxYw|s|sdSg}|r<|d|D]$}|t |%|r<|d|D]$}|t |%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 ) differencerLrPrKrUreprrr) r"set1set2r difference1r. difference2linesitemrs rrzTestCase.assertSetEqualDs& P//$//KK M M M IIG!K L L L L L L L L P P P IIJQN O O O O O O O O P Q//$//KK M M M IIG!K L L L L L L L L Q Q Q IIKaO P P P P P P P P Q {  F  ) LLE F F F# ) ) T$ZZ((((  ) LLE F F F# ) ) T$ZZ((((ii&&  $%%c;7788888sB A.? A. A))A.2B CB// C<CCc||vrLt|dt|}||||dSdS)zDJust like self.assertTrue(a in b), but with a nicer default message. not found in NrrPrr"member containerrrs rassertInzTestCase.assertInosd  " "2;F2C2C2C2C2;I2F2F2FHK IId))#{;; < < < < < # "rc||vrLt|dt|}||||dSdS)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nrrs r assertNotInzTestCase.assertNotInvsd Y  ;DV;L;L;L;L8A)8L8L8LNK IId))#{;; < < < < <  rc||urLt|dt|}||||dSdS)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nrr"expr1expr2rrs rassertIszTestCase.assertIs}sc   ,5e,<,<,<,<-6u-=-=-=?K IId))#{;; < < < < <  rc||ur=dt|}||||dSdS)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nrrs r assertIsNotzTestCase.assertIsNotsO E>>>:CE:J:J:JLK IId))#{;; < < < < < >rc ||td||td||krdt||z}ddt jt j|t j|z}| ||}| | ||dSdS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryryr ) assertIsInstancerr rrrrrrrrPr)r"d1d2rrrs rrzTestCase.assertDictEquals b$(LMMM b$(MNNN 88$';B'C'CCK499W]!>"--88::!>"--88::&<&<===D// TBBK IId))#{;; < < < < < 8rc Htjdtg}g}|D]u\}}||vr|||||krJ|t |dt |dt ||v|s|sdSd}|r"ddd|Dz}|r"|r|d z }|d d|zz }||||dS) z2Checks whether dictionary is a superset of subset.z&assertDictContainsSubset is deprecatedz , expected: z , actual: Nrnz Missing: %s,c34K|]}t|VdSr0)r)r~rs rrz4TestCase.assertDictContainsSubset..s83=3=A9Q<<3=3=3=3=3=3=rz; zMismatched values: %s) r7r8r4itemsrUrrrPr) r"subset dictionaryrmissing mismatchedkeyvaluers rassertDictContainsSubsetz!TestCase.assertDictContainsSubsetsz >( * * *  ,,.. @ @JC*$$s####*S/))!!#,S>>>>9U3C3C3C3C#,Z_#=#=#=#?@@@ :  F  ='#((3=3=4;3=3=3=+=+==K  J $t# 2SXXj5I5II IK $%%c;7788888rct|t|}} tj|}tj|}||krdSt||}n #t$rt ||}YnwxYw|rfd}d|D}d|} ||| }|||}| |dSdS)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: cg|]}d|zS)z First has %d, Second has %d: %rr)r~rs r z-TestCase.assertCountEqual..sWWW47$>WWWrr ) r collectionsCounterrrLrrrrrP) r"rtrur first_seq second_seq differencesrrrs rassertCountEqualzTestCase.assertCountEquals!%U T&\\:  F' 22E (44F .y*EEKK  I I I1)ZHHKKK I  =A>c||td||td||kr*t||jkst||jkr|||||d}|d}t|dkr%|d|kr |dzg}|dzg}dt||z}dd tj ||z}| ||}| | ||d Sd S) z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringT)keependsrz r ryrnN)rr(r_diffThresholdrsrr r rrrrrPr)r"rtrur firstlines secondlinesrrs rrzTestCase.assertMultiLineEqualsa eS*JKKK fc+LMMM F??E T000F d111%%eVS999))4)88J ++T+::K:!## F(;(;u(D(D#dl^ %}o $';E6'J'JJK"'''- K"H"HIIID// TBBK IId))#{;; < < < < < ?rc||ksLt|dt|}||||dSdS)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nrr"abrrs r assertLesszTestCase.assertLesssV1uu3 b), but with a nicer default message.z not greater than Nrrs r assertGreaterzTestCase.assertGreatersV1uu6?llllIaLLLQK IId))#{;; < < < < <urc||ksLt|dt|}||||dSdS)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to Nrrs rassertGreaterEqualzTestCase.assertGreaterEquals[AvvBKA,,,,PYZ[P\P\P\]K IId))#{;; < < < < <vrc|=t|d}||||dSdS)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Nonerr"rCrrs r assertIsNonezTestCase.assertIsNonesH ?.7nnnn>K IId))#{;; < < < < < ?rcd|-d}||||dSdS)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rPrrs rassertIsNotNonezTestCase.assertIsNotNones; ;-K IId))#{;; < < < < < ;rct||s?t|d|}||||dSdS)zTSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.z is not an instance of NrgrrPrr"rCrOrrs rrzTestCase.assertIsInstance s^#s## =;DS>>>>33OK IId))#{;; < < < < < = =rct||r?t|d|}||||dSdS)z,Included for symmetry with assertIsInstance.z is an instance of Nrrs rassertNotIsInstancezTestCase.assertNotIsInstances\ c3   =7@~~~~ssKK IId))#{;; < < < < < = =rcRt|||}|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])r"r^rrWrXr_s rrzTestCase.assertRaisesRegexs-''94PP~~14@@@rcRt|||}|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. assertWarnsRegexrb)r"rcrrWrXr_s rrzTestCase.assertWarnsRegex(s- &&6nMM~~0$???rct|ttfrtj|}||s8d|jd|}|||}||dS)z=Fail the test unless the text matches the regular expression.zRegex didn't match: rN) rgr(bytesrrrrrr>)r"textrrrs r assertRegexzTestCase.assertRegex;s nsEl 3 3 8Z77N$$T** - -&&&.K%%c;77C'',, ,  - -rcbt|ttfrtj|}||}|rgd|||d|jd|}| ||}| |dS)z9Fail the test if the text matches the regular expression.zRegex matched: z matches z in N) rgr(rrrrstartendrrr>)r"runexpected_regexrmatchrs rassertNotRegexzTestCase.assertNotRegexGs &e 5 5 <!z*:;;  ''--  - -U[[]]UYY[[0111 (((K %%c;77C'',, , - -rcfd}|S)Ncztjdjtd|i|S)NzPlease use {0} instead.r5)r7r8rr r4)rWrX original_funcs rdeprecated_funcz,TestCase._deprecate..deprecated_funcWsG M)001GHH"A ' ' '!=$1&11 1rr)rrs` r _deprecatezTestCase._deprecateVs$ 2 2 2 2 2 r)rr0)NNNNN)er rrrAssertionErrorr>rYrrrr#rrrrrrrrrrrrrrrrrr!r1r2_subtest_msg_sentinelr,r+r.r0r6r8r:rCr@rGrJrLrNrPrUrWrr\rarnrprwrsr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrfailUnlessEqual assertEquals failIfEqualassertNotEqualsfailUnlessAlmostEqualassertAlmostEqualsfailIfAlmostEqualassertNotAlmostEquals failUnlessassert_failUnlessRaisesfailIfassertRaisesRegexpassertRegexpMatchesassertNotRegexpMatches __classcell__rs@rrrXs@&KGN33333 >>>>@ 6 6 6888333==[= 77[7      VV[Vaa[a###CCCJJJ=== 888eee@@@/####</// ' ' 'UUU """====~    ? ?[ ?'''999"))))---- ---- III*B;;;>FFFF0EEEE%%%4----////----AE $+)+)+)+)ZDH#'!)!)!)!)FaaaaF444 C C C C F F F F)9)9)9)9V================ = = = =9999:@====(==== ==== ==== ==== ==== ==== ======== AAA @@@& - - - - - - - -&0Z %<%<$>>K/1;)r"r%rr#rs rr#z_SubTest.__init__s?  " ) :rc td)Nzsubtests cannot be run directly)rrs rrz_SubTest.runTests!"CDDDrctg}|jtur-|d|j|jr^dd|jD}|d|d|pdS)Nz[{}]z, c3HK|]\}}d||VdS)z{}={!r}N)r)r~rrs rrz+_SubTest._subDescription..sJ$3$3Q  A&&$3$3$3$3$3$3rz({}) z ())r<rrUrr#rr)r"parts params_descs r_subDescriptionz_SubTest._subDescriptions = 5 5 5 LLt}55 6 6 6 ; 5))$3$3"k//11$3$3$333K LL{33 4 4 4xx/-/rcd|j|SNz{} {})rr%rrCrs rrz _SubTest.ids0~~dn//1143G3G3I3IJJJrc4|jS)zlReturns a one-line description of the subtest, or None if no description has been provided. )r%rrs rrz_SubTest.shortDescriptions~..000rc\d|j|SrE)rr%rCrs rrz_SubTest.__str__s$~~dnd.B.B.D.DEEEr) r rrr#rrCrrrr&r's@rr%r%s;;;;;EEE 0 0 0KKK111 FFFFFFFrr%)2rr)rhrrrr7rr1rrornrutilrrrrr __unittestobjectrrr^r rrrr'r+rDrRrTrYr[rarqrvrxr!r}rrrrChainMaprrr)r%rrrrLs   ?????????????? 7 y)  &8&8&8&8&8v&8&8&8R%%%,,,   666 000    (III 33333333'''''3'''T$8$8$8$8$83$8$8$8N1D1D1D1D1D21D1D1Dh{+P8P8P8P8P8vP8P8P8h 7:7:7:7:7:x7:7:7:t!F!F!F!F!Fx!F!F!F!F!FrPK!|EAA'__pycache__/suite.cpython-311.opt-2.pycnu[ 0i4 ddlZddlmZddlmZdZdZGddeZGd d eZGd d eZ d Z GddeZ dS)N)case)utilTc>t||d}|dS)NcdSNr 5/opt/alt/python311/lib64/python3.11/unittest/suite.pyz!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s$ 64 . .DDFFFFFr cXeZdZ dZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdS) BaseTestSuiteTr cLg|_d|_||dSNr)_tests_removed_testsaddTests)selftestss r __init__zBaseTestSuite.__init__s)  er c\dtj|jdt|dS)N)rstrclass __class__listrs r __repr__zBaseTestSuite.__repr__s+"&-"?"?"?"?dLLr czt||jstSt|t|kSr) isinstancer NotImplementedr!)rothers r __eq__zBaseTestSuite.__eq__s3%00 "! !DzzT%[[((r c*t|jSr)iterrr"s r __iter__zBaseTestSuite.__iter__"sDK   r cP|j}|D]}|r||z }|Sr)rcountTestCases)rcasestests r r-zBaseTestSuite.countTestCases%s=# / /D /,,... r c@t|s/tdt|t |t r0t |tjtfrtd|j |dS)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr%type issubclassrTestCase TestSuiterappendrr/s r addTestzBaseTestSuite.addTest,s~~ E077T CCDD D dD ! ! @j26-1K'M'M @?@@ @ 4     r ct|trtd|D]}||dS)Nz0tests must be an iterable of tests, not a string)r%strr2r;)rrr/s r rzBaseTestSuite.addTests6sR eS ! ! PNOO O  D LL      r ct|D]5\}}|jrn(|||jr||6|Sr) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr/s r runzBaseTestSuite.run<s\$T?? / /KE4   DLLL} /''... r c |j|}t|dr"|xj|z c_d|j|<dS#t$rYdSwxYw)Nr-)rhasattrrr-r2)rrDr/s r rBz BaseTestSuite._removeTestAtIndexEs@ &;u%Dt-.. =##t':':'<'<<##!%DK       DD s A AAc|j|i|SrrE)rargskwdss r __call__zBaseTestSuite.__call__Sstx&&&&r c: |D]}|dSr)debugr:s r rNzBaseTestSuite.debugVs-E  D JJLLLL  r N)r )__name__ __module__ __qualname__rArr#r(r+r-r;rrErBrLrNr r r rrsH MMM))) !!!!!!  & & &'''r rcPeZdZ d dZdZdZdZdZ d dZ d d Z d Z d Z dS)r8Fcld}t|dddur dx|_}t|D]\}}|jrnt |rv||||||||||j|_ t|jddst|ddr|s ||n| |j r| ||r2|d|| |d|_|S)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)r rTr?r@ _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr _previousTestClassrNrArB_handleModuleTearDown)rrCrNtopLevelrDr/s r rEz TestSuite.runfsb 6,e 4 4 = =04 4F "X$T?? / /KE4  4   ++D&999))$777&&tV444,0N)DN,?GGF$8%@@ V  } /''...  +  ' 'f 5 5 5  & &v . . .%*F " r cP t}||ddS)NT) _DebugResultrE)rrNs r rNzTestSuite.debugs(E r ct|dd}|j}||krdS|jrdSt|ddrdSd} d|_n#t$rYnwxYwt|dd}t|dd}|t |d |nt#t $rg}t|trd} d|_n#t$rYnwxYwtj |} | ||d| Yd}~nd}~wwxYw|r6|4||j D]"} | || dd| | #t |d dS#t |d wxYwdS) Nr[__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) r r rVrUr2r Exceptionr%r_rr"_createClassOrModuleLevelExceptiontearDown_exceptions) rr/rC previousClass currentClassfailedrbrce classNameexc_infos r rZzTestSuite._handleClassSetUps8(> !,0A4HH  ! FN 3 3 3 : GJLLLL G G G!&,77!F9= 66$ $ l ; ;I;;FAd}t|dd}||j}|S)Nr[)r rP)rrCpreviousModulerks r _get_previous_modulezTestSuite._get_previous_modules-(> * * * * * -s|~~66666t,,,,,r c|||}|dS|jrdS tj|}n#t$rYdSwxYwt |d t |dd}|Q |nE#t$r8}t|tr| ||d|Yd}~nd}~wwxYw tj nE#t$r8}t|tr| ||d|Yd}~nd}~wwxYwt |ddS#t |dwxYw)NrdtearDownModulerg) rsrVrvrwrxrr rhr%r_rirry)rrCrrr{rrns r r\zTestSuite._handleModuleTearDowns226::  ! F  $  F [0FF    FF  /// 6$V-=tDDN)L"N$$$$ LLL!&,77;;FACD) D.D D)DD))D;ct|dd}|j}||ks|dSt|ddrdSt|ddrdSt|ddrdSt|dd}t|dd}||dSt|d |e |nY#t$rL}t |t rt j|}|||d|Yd}~nd}~wwxYw|e||j D]S} t |t r| d t j|}||| d d|| Tt|d dS#t|d wxYw) Nr[rUFrVra tearDownClassrcrdrrerg) r r rrhr%r_rrrirj) rr/rCrkrlrrcrnrorps r rXz TestSuite._tearDownPreviousClasss%(E T tt 5s  !!ceZdZ dZdZdZdS)r_NF)rOrPrQr[rVr@r r r r_r_ws"IJJJr r_) rvrr __unittestrobjectrr8rrWr_r r r rs      IIIIIFIIIXi6i6i6i6i6 i6i6i6X$$$$$6$$$L6r PK!~9*__pycache__/__main__.cpython-311.opt-1.pycnu[ 0idZddlZejddr1ddlZejejZedzejd<[dZ ddl m Z e ddS) zMain entry pointNz __main__.pyz -m unittestT)main)module) __doc__sysargvendswithos.pathospathbasename executable __unittestr8/opt/alt/python311/lib64/python3.11/unittest/__main__.pyrs 8A; && NNN !!#.11J~-CHQK  DrPK!ykk"__pycache__/loader.cpython-311.pycnu[ 0iXldZddlZddlZddlZddlZddlZddlZddlZddlmZm Z ddl m Z m Z m Z dZejdejZGdd e jZd Zd Zd Zd ZdZGddeZeZddZe jdfdZde je jfdZ de je jfdZ!dS)zLoading unittests.N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c,eZdZdZfdZfdZxZS) _FailedTestNcf||_tt||dSN) _exceptionsuperr __init__)self method_name exception __class__s 6/opt/alt/python311/lib64/python3.11/unittest/loader.pyrz_FailedTest.__init__s.# k4  ))+66666cz|jkr(tt|Sfd}|S)Ncjr )r rsr testFailurez,_FailedTest.__getattr__..testFailure!s / !r)_testMethodNamerr __getattr__)rnamerrs` rrz_FailedTest.__getattr__sO 4' ' 'd++77== = " " " " "r)__name__ __module__ __qualname__rrr __classcell__rs@rr r sVO77777rr crd|dtj}t|t|||S)NzFailed to import test module:  ) traceback format_exc_make_failed_test ImportError)r suiteClassmessages r_make_failed_import_testr*&s< i"$$$&G T;w#7#7W M MMrcRdtj}t||||S)NzFailed to call load_tests: )r$r%r&)rrr(r)s r_make_failed_load_testsr,+s32;2F2H2H2HJG  iW . ..rc>t||}||f|fSr )r ) methodnamerr(r)tests rr&r&0s( z9 - -D :tg   ''rctjt|d}||i}tdtjf|}|||fS)NcdSr rs r testSkippedz'_make_skipped_test..testSkipped5s r ModuleSkipped)rskipstrtypeTestCase)r.rr(r3attrs TestClasss r_make_skipped_testr;4si Ys9~~    %E_t}&6>>I :yy,,. / //rc|dr |ddStj|dS)Nz $py.classir)lowerendswithospathsplitext)r@s r_jython_aware_splitextrB<sI zz||[))CRCy 7  D ! !! $$rceZdZdZdZeejZdZ e j Z dZ fdZdZdddZddZdd Zd Zdd Zd ZdZdZdZdZdZxZS) TestLoaderz This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite r/Nctt|g|_t |_dSr )rrDrerrorsset_loading_packages)rrs rrzTestLoader.__init__Ms: j$((*** "%rc,t|tjrtd|tjtjfvrg}n*||}|st|drdg}| 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 TypeErrorrr8FunctionTestCasegetTestCaseNameshasattrr(map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCasez TestLoader.loadTestsFromTestCaseTs mU_ 5 5 )()) ) T]D,AB B BMM 11-@@M  ,W]I%F%F ,!* s=-'H'HII rpatternct|dksd|vr0tjdt|ddt|dkr4t|dz}t d|t|dkr7t|d}t d|g}t|D]}t||}t|tr\t|tjrB|tjtjfvr(|||t|dd} ||}| _ | |||S#t&$rD} t)|j| |j\} } |j| | cYd} ~ Sd} ~ wwxYw|S) z>Return a suite of all test cases contained in the given moduleruse_load_testsz(use_load_tests is deprecated and ignoredNrzCloadTestsFromModule() takes 1 positional argument but {} were givenz=loadTestsFromModule() got an unexpected keyword argument '{}' load_tests)lenwarningswarnDeprecationWarningpoprMformatsorteddirgetattr isinstancer7rKrr8rNappendrUr( Exceptionr,rrF) rmodulerWargskws complainttestsrobjrZe error_case error_messages rloadTestsFromModulezTestLoader.loadTestsFromModulefs t99q==,33 MD, . . . GG$d + + + t99q==D A Iahhirsstt t s88q== s AI[bbclmmnn nKK > >D&$''C3%% >sDM22 > t/DEEE T77<<===V\488 &&  ! "!z$w777 " " ",COQ-9-9) M ""=111!!!!!!!  "  s F$$ G2.9G-'G2-G2c v|d}d\}}||dd}|r d|}t|}n^#t$rO|}t ||j\}}|s|j||cYSYnwxYw||dd}|} |D]} | t| | } } #t$r} t| dd%|#|j||cYd} ~ cSt| | |jdtj \}}|j||cYd} ~ cSd} ~ wwxYwt| tjr|| St| t$rIt'| t(jr/| t(jt(jfvr|| St| tjrt| t$rlt'| t(jrR|d}| |} tt| |tjs|| gSnt| t2jr| St7| rl| }t|t2jr|St|t(jr||gSt9d| d |d t9d | z) 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'r_r*r(rFrercAttributeErrorr&r$r%rdtypes ModuleTyperpr7rKrr8rNrU FunctionTyperrLcallablerM)rrrgpartsrnro parts_copy module_namenext_attributerlpartparentrminstr/s rloadTestsFromNamezTestLoader.loadTestsFromNames 3$.! M >qqqJ * *"%((:"6"6K' 44F"***%/^^%5%5N0H&1919-J %* **=999))))** *  *!""IE & &D &!73#5#5! & & &CT22>". K&&}555%%%%%%%%%1Ba%022251616-J K&&}555%%%%%%%%%% &( c5+ , , ++C00 0 sD ! ! 3 .. DM4+@AAA--c22 2e011 && // 9D6$<C E'.E" E'A E"E'"E'cNfd|D}|S)zReturn a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. c<g|]}|Sr2)r).0rrgrs r z1TestLoader.loadTestsFromNames..s)III4$((v66IIIr)r()rnamesrgsuitess` ` rloadTestsFromNameszTestLoader.loadTestsFromNamess5JIIII5IIIv&&&rcfd}tt|t}jr-|t jj|S)zLReturn a sorted sequence of method names found within testCaseClass c|jsdSt|}t|sdSdjj|fzjduptfdjDS)NFz%s.%s.%sc38K|]}t|VdSr )r)rrWfullNames r zKTestLoader.getTestCaseNames..shouldIncludeMethod..s-XXwK'22XXXXXXr) startswithtestMethodPrefixrcr}rrtestNamePatternsany)attrnametestFuncrrrRs @rshouldIncludeMethodz8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<== u}h77HH%% u"(-*Dh&H(D0YXXXX$BWXXXXX Yr)key)listfilterrbsortTestMethodsUsingsort functools cmp_to_key)rrRr testFnNamess`` rrOzTestLoader.getTestCaseNamess Y Y Y Y Y Y6"5s=7I7IJJKK  $ R   !5d6O!P!P  Q Q Qrtest*.pycd}||j|j}n|d}|}tj|}|tjvr tjd|||_d}tjtj|retj|}||kr>tjtj|d }n t|tj |}| dd} tjtj |j }nD#t$r7|jtjvrt#ddt#d|dwxYw|r9|||_tj|n#t($rd}YnwxYw|rt)d |zt+|||}||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__.pyrrz2Can 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@abspathsysinsertisdirisfilerwrxmodulesrvdirname__file__ryrbuiltin_module_namesrM _get_directory_containing_moduleremover'r _find_testsr() r start_dirrW top_level_dirset_implicit_topis_not_importable the_moduletop_partrks rdiscoverzTestLoader.discoverse8!  T%8%D /MM  "# %M 66 (( HOOA} - - -+! 7==33 4 4 3 22IM))(*rw||I}7]7](^(^$^! 39%%%![3 $??3//2 ( ")<>>!@!@II%(((!*c.FFF')ABBGKL(MzMM#'( ($3*.*O*OPX*Y*YD'HOOM222) ) ) )$(!!! ),  SE QRR RT%%i99::u%%%s HAFAG H H ctj|}tj|j}tj|dr> > 7??9-- -rc||jkrdSttj|}tj||j}tj|r Jd|dr Jd|tjj d}|S)NrrzPath must be within the projectz..) rrBr?r@normpathrelpathisabsrreplacesep)rr@_relpathrs r_get_name_from_pathzTestLoader._get_name_from_path]s 4& & &3%bg&6&6t&<&<==7??4)<==7==**MM,MMM*&&t,,OO.OOO, S11 rcDt|tj|Sr )rxrr)rrs r_get_module_from_namez TestLoader._get_module_from_nameis4{4  rc"t||Sr )r)rr@rrWs r _match_pathzTestLoader._match_pathmstW%%%rc#rK||}|dkr,||jvr#|||\}}||V|sdStt j|}|D]}tj||}|||\}}||V|r||}|j| | ||Ed{V|j |#|j |wxYwdS)z/Used by discovery. Yields test suites it loads.rrN) rrH_find_test_pathrar?listdirr@rwaddrdiscard) rrrWrrkshould_recursepathsr@rs rrzTestLoader._find_testsqsv'' 22 3;;4t'===%)$8$8G$L$L !E>  ! rz),,-- 9 9D Y55I$($8$8G$L$L !E>   9// ::&**40009#// 7CCCCCCCCC*2248888D*2248888 9 9 9s DD3ctj|}tj|rt|sdS||||sdS||} ||}tj t|d|}ttj |}ttj |}| | krtj|} ttj|} tj|} d} t| | | | fz|||dfS#t"j$r"} t'|| |jdfcYd} ~ Sd} ~ wt+||j\}}|j||dfcYSxYwtj|rztjtj|dsdSd}d}||} ||}t|dd}|j| |||}||df|j|S|d f|j|S#|j|wxYw#t"j$r"} t'|| |jdfcYd} ~ Sd} ~ wt+||j\}}|j||dfcYSxYwdS) 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?rVFNrrZT)r?r@rrVALID_MODULE_NAMEmatchrrrrrcrBrealpathr=rr'rprSkipTestr;r(r*rFrerrwrHrr)rrrWrrrgmod_filerfullpath_noext module_dirmod_name expected_dirmsgrmrnrorZrkpackages rrzTestLoader._find_test_paths7##I.. 7>>) $ $? $**844 #"{##HiAA #"{++I66D P33D997??FJ ::<<1G$$X..00!7G$$Y//"1"1>>##~';';'='===!#!:!:J5((33 5 5H#%7??9#=#=LDC%x\BBDDD///HH%OO/= K K K)$4?CCUJJJJJJJ ),T4?CC* M ""=111!5(((($W]]9 % % 7>>"',,y-"H"HII #"{JE++I66D 944T::%WlDAA &**40009 44Wg4NNE!-$e|*2248888!$;*2248888D*2248888%= K K K)$4?CCUJJJJJJJ ),T4?CC* M ""=111!5((((;sN G**I9HI;INM%M%%NO-N0*O-0;O-r )rN)rrr__doc__r staticmethodr three_way_cmprrrrLr(rrrUrprrrOrrrrrrrr r!s@rrDrDBsX'<(:;;JN'''''$:>*****XPJPJPJPJd''''&Q&Q&Q&Q&f . . .   !!!&&&999@HHHHHHHrrDc^t}||_||_||_|r||_|Sr )rDrrrr()prefix sortUsingr(rloaders r _makeLoaderrs8 \\F"+F$F.F'& Mrcddl}|jdtdt||||S)Nrzunittest.getTestCaseNames() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.getTestCaseNames() instead. stacklevel)r)r\r]r^rrO)rRrrrr\s rrOrOsXOOOHM Eq vy;K L L L ] ]^k l llrr/cddl}|jdtdt||||S)Nrzunittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.rr)r\r]r^rrU)rRrrr(r\s r makeSuitersZOOOHM Jq vy* 5 5 K K  rcddl}|jdtdt||||S)Nrzunittest.findTestCases() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromModule() instead.rr)r\r]r^rrp)rgrrr(r\s r findTestCasesrsZOOOHM Hq vy* 5 5 I I  rrs)"rr?rerr$rzrr\rrrrr __unittestcompile IGNORECASErr8r r*r,r&r;rBobjectrDdefaultTestLoaderrrrOrLrrr2rrrs  ((((((((  BJ0"-@@     $-   NNN ... (((000%%% WWWWWWWWt JLL 7;6H[_mmmm%+d6H    "(43E"_      rPK!ʋBB(__pycache__/runner.cpython-313.opt-1.pycnu[ Li(SrSSKrSSKrSSKrSSKJr SSKJr SSKJ r Sr "SS \ 5r "S S \R5r"S S \ 5rg)z Running testsN)result)_SubTest)registerResultTc.\rSrSrSrSrSrSSjrSrg) _WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodcXlgNstream)selfr s 6/opt/alt/python313/lib64/python3.13/unittest/runner.py__init___WritelnDecorator.__init__s cPUS;a [U5e[URU5$)N)r __getstate__)AttributeErrorgetattrr )rattrs r __getattr___WritelnDecorator.__getattr__s' - - & &t{{4((rNcVU(aURU5 URS5 gN )write)rargs rwriteln_WritelnDecorator.writelns  JJsO 4rr r ) __name__ __module__ __qualname____firstlineno____doc__rrr__static_attributes__rrrrsJ) rrc^\rSrSrSrSrSrSS.U4SjjrSrU4S jr S r U4S jr U4S jr U4S jr U4SjrU4SjrU4SjrU4SjrSrSrSrU=r$)TextTestResultz`A test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------N durationsc>[[U] XU5 XlUS:UlUS:HUlX lSUlX@lg)zoConstruct a TextTestResult. Subclasses should accept **kwargs to ensure compatibility as the interface changes.rTN) superr)rr showAlldots descriptions_newliner,)rr r1 verbosityr, __class__s rrTextTestResult.__init__&sC nd,V9M  1} N ( "rcUR5nUR(a#U(aSR[U5U45$[U5$r)shortDescriptionr1joinstr)rtestdoc_first_lines rgetDescriptionTextTestResult.getDescription1s=..0   99c$i89 9t9 rc>[[U] U5 UR(agURR UR U55 URR S5 URR5 SUlgg)N ... F) r.r) startTestr/r rr<flushr2rr:r4s rr@TextTestResult.startTest8sd nd-d3 << KK  d11$7 8 KK  g & KK   !DM rc[U[5nU(dUR(aUR(dURR 5 U(aURR S5 URR UR U55 URR S5 URR U5 URR5 SUlg)Nz r?T) isinstancerr2r rrr<rA)rr:status is_subtests r _write_statusTextTestResult._write_status@sh/ == ##% !!$' KK  d11$7 8 KK  g & F#  rc>UbUR(aD[USUR5(aURUS5 OURUS5 OUR(ao[USUR5(aUR R S5 OUR R S5 UR R5 [[U]+XU5 g)NrFAILERRORFE) r/ issubclassfailureExceptionrHr0r rrAr.r) addSubTest)rr:subtesterrr4s rrQTextTestResult.addSubTestMs ?||c!fg&>&>??&&w7&&w8c!fg&>&>??KK%%c*KK%%c* !!# nd.tcBrc>[[U] U5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)Nok.) r.r) addSuccessr/rHr0r rrArBs rrXTextTestResult.addSuccess\sW nd.t4 <<   tT * YY KK  c " KK   rc>[[U] X5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)NrLrN) r.r)addErrorr/rHr0r rrArr:rSr4s rr[TextTestResult.addErrordsW nd,T7 <<   tW - YY KK  c " KK   rc>[[U] X5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)NrKrM) r.r) addFailurer/rHr0r rrAr\s rr_TextTestResult.addFailurelsW nd.t9 <<   tV , YY KK  c " KK   rc >[[U] X5 UR(a"UR USR U55 gUR (a6URRS5 URR5 gg)Nz skipped {0!r}s) r.r)addSkipr/rHformatr0r rrA)rr:reasonr4s rrcTextTestResult.addSkiptsb nd+D9 <<   t_%;%;F%C D YY KK  c " KK   rcH>[[U] X5 UR(a6URR S5 URR 5 gUR(a6URRS5 URR 5 gg)Nzexpected failurex) r.r)addExpectedFailurer/r rrAr0rr\s rri!TextTestResult.addExpectedFailure|sj nd6tA << KK   2 3 KK    YY KK  c " KK   rcH>[[U] U5 UR(a6URR S5 URR 5 gUR(a6URRS5 URR 5 gg)Nzunexpected successu) r.r)addUnexpectedSuccessr/r rrAr0rrBs rrm#TextTestResult.addUnexpectedSuccesssj nd8> << KK   4 5 KK    YY KK  c " KK   rc4UR(dUR(a4URR5 URR 5 UR SUR 5 UR SUR5 [USS5nU(avURRUR5 UH0nURRSURU535 M2 URR 5 gg)NrLrKunexpectedSuccessesr'zUNEXPECTED SUCCESS: ) r0r/r rrAprintErrorListerrorsfailuresr separator1r<)rrpr:s r printErrorsTextTestResult.printErrorss 99 KK   ! KK    GT[[1 FDMM2%d,A2F  KK   0+ ##&:4;N;Nt;T:U$VW, KK    rcUHup4URRUR5 URRU<SURU5<35 URRUR5 URRSU-5 URR 5 M g)Nz: z%s)r rrtr< separator2rA)rflavourrrr:rSs rrqTextTestResult.printErrorListsID KK   0 KK  GD4G4G4M N O KK   0 KK  s + KK     r)r2r1r0r,r/r )r!r"r#r$r%rtrxrr<r@rHrQrXr[r_rcrirmrurqr& __classcell__)r4s@rr)r)scJJEI # #"  C          rr)cF\rSrSrSr\rS SSS.SjjrSrSr S r S r g) TextTestRunnerzA test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. NF) tb_localsr,cUc[Rn[U5UlX lX0lX@lXPlXlXl Xpl UbX`l gg)zqConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysstderrrr r1r3failfastbufferrr,warnings resultclass) rr r1r3rrrrrr,s rrTextTestRunner.__init__sS >ZZF'/ ("  ""  "*  #rcURURURURURS9$![ a4 URURURUR5s$f=f)Nr+)rr r1r3r, TypeError)rs r _makeResultTextTestRunner._makeResultss 4##DKK1B1B$(NNdnn$N N 4##DKK1B1B$(NN4 4 4s9<;A:9A:cJUR(dg[URSSS9nURS:aUSURnURR S5 [ US5(a%URR UR 5 SnUHEupEURS:a US :aSnMURR S U-<S S U<35 MG U(aURR S 5 gURR S5 g)Nc US$)Nrr')rhs r0TextTestRunner._printDurations..sQqTrT)keyreverserzSlowest test durationsrxFgMbP?z%.3fs10 zA (durations < 0.001s were hidden; use -v to show these durations))collectedDurationssortedr,r rhasattrrxr3)rrlshiddenr:elapseds r_printDurationsTextTestRunner._printDurationss((  F--> " >>A OT^^$B 45 6< ( ( KK   1 1 2MD~~!go KK  g.? F G   KK  !B C KK   #rcUR5n[U5 URUlURUlURUl[ R "5 UR (a [ R"UR 5 [R"5n[USS5nUbU"5 U"U5 [USS5nUbU"5 [R"5nSSS5 WW- nUR"5 URbURU5 [US5(a%URR!UR"5 UR$nURR!SXS:g=(a S=(d SU4-5 URR!5 S =n =p['[(UR*UR,UR.45n U upn /n UR2"5(d{URR5S 5 [)UR65[)UR85pU(aU R;S U-5 U(aU R;S U-5 ODUS :Xa#U (dURR5S 5 OURR5S5 U (aU R;SU -5 U (aU R;SU -5 U (aU R;SU -5 U (a0URR!SSR=U 5<S35 OURR5S5 URR?5 U$![USS5nUbU"5 ff=f!,(df  GN=f![0a GNf=f)z&Run the given test case or test suite. startTestRunN stopTestRunrxzRan %d test%s in %.3fsrrbrrFAILEDz failures=%dz errors=%dz NO TESTS RANOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rrrrrrcatch_warnings simplefiltertime perf_counterrrur,rrr rrxtestsRunmaplenexpectedFailuresrpskippedr wasSuccessfulrrsrrappendr8rA)rr:r startTimerrstopTime timeTakenrun expectedFailsrprresultsinfosfailederroreds rrTextTestRunner.runs!!#v--  >>  $ $ &}}%%dmm4))+I"6>4@L' "V %fmTB *M((*H'y(  >> %   ( 6< ( ( KK   1 1 2oo 4 ("2s"8b)DE F 899 9+ B# 7 7 & : : & 01G ;B 7M##%% KK  h '!&//2C 4FG ]V34 [723 AXg KK  n - KK  d #  LL/ 0  LL/-? @  LL25HH I  KK  499U+; = > KK  d #  e&fmTB *M+' &B   s7$AN3N ,N3 1ON00N33 O OO) rr1r,rrr rr3r)NTrFFNN) r!r"r#r$r%r)rrrrrr&r'rrr}r}s3 !KABJN+#t+*4$,Drr})r%rrrrrcasersignalsr __unittestobjectr TestResultr)r}r'rrrsN #     C V&&C L@V@rPK!7_&__pycache__/case.cpython-313.opt-2.pycnu[ MiSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r SSK J r SSK JrJrJrJrJr Sr\"5rSr"SS\5r"S S \5r"S S \5r"S S\5rSrSrSrSr/r Sr!Sr"Sr#Sr$Sr%Sr&Sr'Sr("SS5r)"SS\)5r*"SS \*5r+"S!S"\*5r,"S#S$\,5r-"S%S&\R\5r/"S'S(\5r0"S)S*\05r1"S+S,\05r2g)-N)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\rSrSrSrg)SkipTestN__name__ __module__ __qualname____firstlineno____static_attributes__r 4/opt/alt/python313/lib64/python3.13/unittest/case.pyr r rr c\rSrSrSrg) _ShouldStop"r Nrr rrrr"rrrc\rSrSrSrg)_UnexpectedSuccess'r Nrr rrrr'rrrcF\rSrSrSSjr\R SSj5rSrg)_Outcome-Nc\SUlXl[US5UlSUlSUlg)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init___Outcome.__init__.s-!& (/ (E% #rc## URnSUlSv U(a8UR(a'URRURUS5 UR=(a UUlg![a e[ a1nSUl[ URU[U55 SnAN[SnAf[a Nj [R"5nUR(aXPl OKSUlU(a'URRURX5 O[URX5 SnN=f!UR=(a UUlf=f7f)NTF)r%rr! test_caseKeyboardInterruptr _addSkipstrrsysexc_infor"r& _addError)r'r+subTest old_successer0s rtestPartExecutor_Outcome.testPartExecutor5sll   8 ,4<< &&y':':ItL<<7KDL1!   5 DL T[[)SV 4 4   ||~H%%'/$$ KK**9+>+> Tdkk9?H  <<7KDLsLE#A5?EE#5E 'B50E5 EEA;E?EE  E#)r&r"rr$r%N)F) rrrrr( contextlibcontextmanagerr5rr rrrr-s!$88rrc[USS5nUb U"X5 g[R"S[S5 UR"U5 g)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr+reasonr;s rr-r-Vs@fi.G " L$a ))$rcUbHUbD[USUR5(aUR"X5 gUR"X5 gggNr) issubclassfailureException addFailureaddError)rtestr0s rr1r1_sF h2 hqk4#8#8 9 9   d - OOD + 3rcU$r7r )objs r_idrLfs Jrc[U5nURnURnU"U5nU"X@SSS5 U$![a( [ SUR SUR S35Sef=f)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrZjs r(CO ||2YFttT* M O!CNN+1S-=-=,>?CDEJN OOs :2A,c2[RXU45 gr7)_module_cleanupsappend)functionargskwargss raddModuleCleanuprazsXV45rc"[U[5$r7)rZra)rUs renterModuleContextrcs ". //rc/n[(a-[R5upnU"U0UD6 [(aM-U(aUSeg![anURU5 SnAN:SnAff=frD)r\pop Exceptionr]) exceptionsr^r_r`excs rdoModuleCleanupsrisuJ  !1!5!5!7 # d %f %   m #   c " " #sA A-A((A-cj^U4Sjn[T[R5(a TnSmU"U5$U$)Nc>[U[5(d![R"U5U4Sj5nUnSUlTUlU$)Nc>[T5er7r )r_r`rBs r skip_wrapper-skip..decorator..skip_wrappersv&&rT) isinstancerP functoolswraps__unittest_skip____unittest_skip_why__) test_itemrnrBs r decoratorskip..decoratorsF)T** __Y ' '( '$I&* #*0 'r)rptypes FunctionType)rBrvrus` rskipr{s8 &%,,-- ## rc2U(a [U5$[$r7r{rL conditionrBs rskipIfrsF| Jrc2U(d [U5$[$r7r}r~s r skipUnlessrs F| JrcSUlU$)NT)__unittest_expecting_failure__)rus rr&r&s/3I, rc^[U[5(a[U4SjU55$[U[5=(a [ UT5$)Nc3<># UHn[UT5v M g7fr7) _is_subtype).0r4basetypes r _is_subtype..s>X;q(++Xs)rptupleallrPrE)expectedrs `rrrs:(E"">X>>> h % H*Xx*HHrc \rSrSrSrSrSrg)_BaseTestCaseContextcXlgr7r+)r'r+s rr(_BaseTestCaseContext.__init__s"rcURRURU5nURRU5er7)r+_formatMessagemsgrF)r' standardMsgrs r _raiseFailure"_BaseTestCaseContext._raiseFailures1nn++DHHkBnn--c22rrN)rrrrr(rrr rrrrs #3rrc$\rSrSrSSjrSrSrg)_AssertRaisesBaseContextNc[RX5 XlX lUb[R "U5nX0lSUlSUlgr7) rr(rr+recompileexpected_regexobj_namer)r'rr+rs rr(!_AssertRaisesBaseContext.__init__sB%%d6 "  %ZZ7N, rc[URUR5(d[U<SUR<35eU(dCUR SS5UlU(a![[[U55<S35eUSn$UtpBURUl U U"U0UD6 SSS5 Sng![a [U5Ul N2f=f!,(df  N1=f!Snf=f)Nz() arg 1 must be rz1 is an invalid keyword argument for this function) rr _base_typerT_base_type_strrernextiterrrrSr.)r'namer_r` callable_objs rhandle_AssertRaisesBaseContext.handles t}}doo>>!%t':':!<==!::eT2#7;DL7I%LMMD#' L 2 , 5 5 d-f-D " 2 #L 1  2DsNBC) C)B8"C)$ C-C)8CC)CC) C&"C))C-)rrrrr+r7)rrrrr(rrr rrrrs rrcL\rSrSr\rSrSrSr\ "\ R5r Sr g)_AssertRaisesContextz-an exception type or tuple of exception typescU$r7r r's rrQ_AssertRaisesContext.__enter__s rcUcuURRnUR(a,UR SR UUR55 O7UR SR U55 O[R"U5 [XR5(dgURS5Ul URcgURnUR[U55(d4UR SR UR[U555 g![a [UR5nGN5f=f)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rrrSr.rrformat traceback clear_framesrEwith_traceback exceptionrsearchpattern)r'exc_type exc_valuetbexc_namers rrR_AssertRaisesContext.__exit__s   .==11}}""#8#?#?@D $OP""?#9#9(#CD  " "2 &(MM22"11$7    &,,$$S^44   9@@#++S^ = >+" .t}}- .sD..EE)rN)rrrr BaseExceptionrrrQrR classmethodry GenericAlias__class_getitem__rr rrrrs+JDN6$E$6$67rrc(\rSrSr\rSrSrSrSr g)_AssertWarnsContextiz(a warning type or tuple of warning typescJ[[RR55Hn[ USS5(dM0UlM [ R"SS9UlURR5Ul[ R"SUR5 U$)N__warningregistry__T)recordalways) listr/modulesvaluesr=rr>catch_warningswarnings_managerrQ simplefilterr)r'vs rrQ_AssertWarnsContext.__enter__!s|ckk((*+Aq/66(*%,!) 7 7t D--779 h 6 rc>URRXU5 UbgURRnSnUR HnURn[XpR5(dM+UcUnURb+URR[ U55(dMhXpl URUl URUl g Ub>URSRURR [ U555 UR"(a,URSRUUR"55 gURSRU55 g![a [ UR5nGNcf=f)Nrz{} not triggered by {}z{} not triggered)rrRrrrSr.r>messagerprrwarningfilenamelinenorrrr)r'rrrrfirst_matchingmws rrR_AssertWarnsContext.__exit__,s] &&xB?    *}}--HA Aa//%!"##/''..s1v66LJJDM((DK   %   9@@((00#n2E G H ==   7>>x?C}} N O   188B C3 *4==)H *sE99FF)rrrr>rN) rrrrWarningrrrQrRrr rrrrsJ?N  Drrc\rSrSrSrSrg)_AssertNotWarnsContextiOcZURRXU5 UbgURRnUR H?nURn[X`R5(dM+URUS35 MA g![a [ UR5nNqf=f)Nz triggered) rrRrrrSr.r>rrpr)r'rrrrrrs rrR_AssertNotWarnsContext.__exit__Qs &&xB?    *}}--HA A!]]++""hZz#:; *4==)H *sBB*)B*r N)rrrrrRrr rrrrOs SOS7jr?SOS8jr@SOS9jrASOS:jrBSOS;jrCSOS<jrDSOS=jrESOS>jrFSOS?jrGSOS@jrHSOSAjrISOSBjrJSOSCjrKSOSDjrLSOSEjrMSOSFjrNSOSGjrOSOSHjrPSIrQSJrRSOSKjrSSOSLjrTSMrUU=rV$)RTestCaseijTiicB>SUl/Ul[TU] "U0UD6 g)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rWr_r` __class__s rrTestCase.__init_subclass__s% %  !4262rcXlSUlSUl[X5nURUl/UlSUl 0Ul UR[S5 UR[S5 UR[S5 UR[S5 UR[ S5 UR["S 5 g![ a& US:wa[ SUR<SU<35eNf=f) NzNo testrunTestzno such test method in : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr=__doc__rS ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr.)r' methodName testMethods rr(TestCase.__init__s * ' 5 2J#-"4"4D  %'!   '89   '89   (:;   &67   ,<=   &<=) 4Y&!~~z"344' 4s C -C<;C<c X RU'gr7)r)r'typeobjr^s rrTestCase.addTypeEqualityFuncs.6!!'*rc>URRXU45 gr7)rr]r'r^r_r`s r addCleanupTestCase.addCleanups xv67rc,[XR5$r7)rZr)r'rUs r enterContextTestCase.enterContexts b//22rc>URRXU45 gr7)rr]rWr^r_r`s raddClassCleanupTestCase.addClassCleanups ""HF#;>2D4H4HIIrcn[U5[U5La[$URUR:H$r7)rPNotImplementedrr'others r__eq__TestCase.__eq__ s/ :T%[ (! !##u'<'<<r<rs r__repr__TestCase.__repr__s"($*>*>@ @rc+v# URbURR(dSv gURnUc [U5nOURR U5n[ XU5UlURRURSS9 Sv SSS5 URR(d1URRnUbUR(a[eO!URR(a[eX0lg!,(df  N=f!X0lf=f7f)NT)r2) rr$rrparams new_child_SubTestr5r%rfailfastrr&)r'rrTparent params_maprs rr2TestCase.subTests ==  (N(N   >)&1J008J J7  #// t/LM==((--%&//%%.."!"MML#Ms7A5D98$D.D!A5D.D9 D+'D..D66D9cURnU"X5 g![a0 [R"S[5 UR "U5 gf=f)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerSr>r?r@rA)r'rr0r\s r_addExpectedFailureTestCase._addExpectedFailure8sN /!'!:!:  t .  $ MM\( *   d # $s 7AAcURnU"U5 g![a[ [R"S[5 [ Se![ a* UR "U[R"55 gf=ff=f)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrSr>r?r@rrGr/r0)r'rr`s r_addUnexpectedSuccessTestCase._addUnexpectedSuccessBsr '#)#>#>  ! & 8 MM_( * 8(d2% 8!!$ 7 8 8s& %A<A0A84A<7A88A<cURnU"X5 g![a [R"S[5 gf=f)Nz$TestResult has no addDuration method) addDurationrSr>r?r@)r'relapsedrds r _addDurationTestCase._addDurationQs? ' ,,K  &  * MM@( * *s %??c$UR5 gr7)rrs r _callSetUpTestCase._callSetUpZs  rcRU"5b[R"SUS3[SS9 gg)NzFIt is deprecated to return a value that is not None from a test case (rK) stacklevel)r>r?DeprecationWarning)r'methods r_callTestMethodTestCase._callTestMethod]s3 8  MM((.xq23ERS U rc$UR5 gr7)r!rs r _callTearDownTestCase._callTearDownbs  rcU"U0UD6 gr7r rs r _callCleanupTestCase._callCleanupes$!&!rcUc5UR5n[USS5n[USS5nUbU"5 OSnUR"U5 [XR5n[URSS5(d[USS5(aV[URSS5=(d [USS5n[ XU5 UUR "U5 UbU"5 $$[USS5=(d [USS5n[U5n[R"5nXpl URU5 UR5 SSS5 UR(abXglURU5 URU5 SSS5 SUlURU5 UR!5 SSS5 UR#5 UR%U[R"5U- 5 UR(aXU(a?UR&(aUR)XR&5 O$UR+U5 OUR,"U5 USUlSnSUl UR "U5 UbU"5 $$!,(df  GNR=f!,(df  GN"=f!,(df  GN=f!SUlSnSUl f=f!UR "U5 UbU"5 ff=f)N startTestRun stopTestRunrsFrtrxr)r0r= startTestrrr-stopTestrtime perf_counterrr5rir%r"rprs doCleanupsrfr&r]rarA) r'rryrzr skip_whyr"outcome start_times rrun TestCase.runhs >++-F"6>4@L!&->K'K4  ';';FM $DeL v&G**,J % ' --d3OO%4??0A- 11$7,,Z8805G- 11$7**,8!!!&4+<+<+>+KM??("22 44V=T=TU 66v>))$/+/'!%  OOD !& 'A438787"+/'!%  OOD !& 'suA;K''AK')KJ0KJ. K3KB*K.K' J+&K. J=8K K KK$$K''LcXUR=(d [5nUR(a`URR5up#nUR U5 UR "U/UQ70UD6 SSS5 UR(aM`UR $!,(df  N-=fr7)rrrrer5rvr%)r'rr^r_r`s rrTestCase.doCleanupss}---8:nn%)^^%7%7%9 "HF))$/!!( "HF ?$)&)!!! ?''..s||~> ?sA8BBc&UR"U0UD6$r7)r)r'r_kwdss r__call__TestCase.__call__sxx&&&rc[XR5n[URSS5(d[USS5(a6[URSS5=(d [USS5n[U5eUR 5 UR U5 UR 5 UR(aGURR5up4nUR"U/UQ70UD6 UR(aMFgg)NrsFrtrx) r=rrr rirprsrrerv)r'r rr^r_r`s rdebugTestCase.debugsT#7#78 DNN$7 ? ? J 3U ; ;0GLL":/FK 8$ $  Z( nn%)^^%7%7%9 "HF   h 8 8 8nnnrc[U5er7rm)r'rBs rskipTestTestCase.skipTests vrc$URU5er7)rF)r'rs rfail TestCase.fails##C((rcpU(a/URUS[U5-5nURU5eg)Nz%s is not falserrrFr'exprrs r assertFalseTestCase.assertFalses7 %%c+>.$?GdGs!%c<[X5nURSX#5$)N assertWarnsrrr'expected_warningr_r`rs rrTestCase.assertWarns s 8&&6=~~mT::rc<[X5nURSX#5$)N_assertNotWarns)rrrs rrTestCase._assertNotWarns?s()9@~~/>>rcSSKJn U"XUSS9$)Nr_AssertLogsContextFno_logs_logrr'loggerlevelrs r assertLogsTestCase.assertLogsDs* -!$uEErcSSKJn U"XUSS9$)NrrTrrrs r assertNoLogsTestCase.assertNoLogs\s -!$tDDrc[U5[U5LaIURR[U55nUb"[U[5(a [ X5nU$UR $r7)rPrgetrpr.r=_baseAssertEqual)r'firstsecondasserters r_getAssertEqualityFuncTestCase._getAssertEqualityFunces\" ;$v, &0044T%[AH#h,,&t6H$$$rcnX:Xd0S[X5-nURX45nURU5eg)N%s != %s)r rrF)r'rrrrs rrTestCase._baseAssertEquals=$';E'JJK%%c7C'', ,rc4URX5nU"XUS9 g)N)r)r)r'rrrassertion_funcs r assertEqualTestCase.assertEquals44UCu#.rcX:wd<URU[U5<S[U5<35nURU5eg)N == r)r'rrrs rassertNotEqualTestCase.assertNotEqualsG%%c59I:CF:K,MNC'', ,rc X:XagUbUb [S5e[X- 5nUb=Xe::ag[U5<S[U5<S[U5<S[U5<S3nOBUcSn[Xc5S:Xag[U5<S[U5<SU<S[U5<S3nUR XG5nUR U5e) N specify delta or places not bothz !=  within  delta ( difference)rz places (rTabsrroundrrFr'rrplacesrdeltadiffrs rassertAlmostEqualTestCase.assertAlmostEquals ?   !3>? ?5>"  }% &!% $ !K ~T"a'% &!$ !K !!#3##C((rc UbUb [S5e[X- 5nUbBX:XdXe:ag[U5<S[U5<S[U5<S[U5<S3nO:UcSnX:Xd[Xc5S:wag[U5<S[U5<SU<S3nUR XG5nUR U5e) Nrrrrrrrz placesrrs rassertNotAlmostEqualTestCase.assertNotAlmostEquals  !3>? ?5>"  O% &!% $ !K ~Ot)<)A9B59I9B69J9?AK!!#3##C((rc UbqURn[X5(d"URSU<S[U5<35e[X$5(d"URSU<S[U5<35eOSnSn[ U5nUc [ U5nUcX:XagSUR54[X5--n[[WW55H)n Xn X)n X:wdMUS U 4[X5--- n O# Xx:XaUc[U5[U5:wagXx:a#US XWU- 4-- nUS U[X54-- nO'Xx:a"USXXU- 4-- nUS U[X'54-- nUn SSR[R"[ R""U5R%5[ R""U5R%555-n UR'X5n UR)X<5nUR+U5 g![ [ 4a SU-nGNf=f![ [ 4a SU-nGNf=f![ [[ 4a USX4-- n GMMf=f![ [[ 4a US X4-- n GMtf=f![ [[ 4a US X4-- nGNJf=f![ [[ 4a USXu4-- nGNof=f)NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r4)rrprFrlenrTNotImplementedError capitalizer rangemin IndexErrorrPjoindifflibndiffpprintpformat splitlines_truncateMessagerr)r'seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualTestCase.assertSequenceEquals  $--Md--+++8)D/-KLLd--+++8)D/-KLL.'M  #t9D   '4y  |0"--/1(456I3tT?+ GE  GE >"K#$$)=e)K"K#MNI%,(LX%5J$t*,{+.;D[-IJK K"A#'4:)>"?#@AI +.;D[-IJK L"A#'4:)>"?#@AI   MM&...99; ...99; =>>++KA !!#3 #K./ #B!#I #23 'G%'  '":/BC"N"#!3#45I":/BC"O"#!3#45I*":/BCK#2594I#JKIK":/BCL#36:5J#KLILsl: H H.I I12JJ=H+*H+.II I.-I.1JJJ:9J:=KKcpURnUb[U5U::aX-$U[[U5--$r7)maxDiffr DIFF_OMITTED)r'rrmax_diffs rrTestCase._truncateMessageIs8<<  s4yH4> !,T233rc.URXU[S9 gN)r)rr)r'list1list2rs rrTestCase.assertListEqualOs   sT Brc.URXU[S9 gr )rr)r'tuple1tuple2rs rrTestCase.assertTupleEqual[s   u ErcURU5nURU5nW(dW(dg/nU(a4UR S5 UHnUR [ U55 M W(a4UR S5 UHnUR [ U55 M SR U5n URURX955 g![anURSU-5 SnANSnAf[anURSU-5 SnAGNSnAff=f![anURSU-5 SnAGN/SnAf[anURSU-5 SnAGNVSnAff=f)Nz/invalid type when attempting set difference: %sz2first 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:r4) differencerTrrSr]reprrr) r'set1set2r difference1r4 difference2linesitemrs rrTestCase.assertSetEqualfsC P//$/K  Q//$/K {   LLE F# T$Z($  LLE F# T$Z($ii&  $%%c785 M IIG!K L L P IIJQN O O P  M IIG!K L L Q IIKaO P P QsFCD0 D-(D D-D((D-0 F:E F!E;;FcX;a<[U5<S[U5<3nURURX455 gg)N not found in rrrr'member containerrrs rassertInTestCase.assertIns<  "2;F2C2;I2FHK IId))#; < #rcX;a<[U5<S[U5<3nURURX455 gg)Nz unexpectedly found in rrs r assertNotInTestCase.assertNotIns<  ;DV;L8A)8LNK IId))#; < rcXLa<[U5<S[U5<3nURURX455 gg)Nz is not rr'expr1expr2rrs rassertIsTestCase.assertIss;  ,5e,<-6u-=?K IId))#; < rclXLa0S[U5<3nURURX455 gg)Nzunexpectedly identical: rr(s r assertIsNotTestCase.assertIsNots0 >:CE:JLK IId))#; < rc URU[S5 URU[S5 X:waS[X5-nSSR[R "[ R"U5R5[ R"U5R555-nURXE5nURURX455 gg)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr4) assertIsInstancerr rrrrrrrrr)r'd1d2rrrs rrTestCase.assertDictEquals b$(LM b$(MN 8$';B'CCK499W]]!>>"-88:!>>"-88:&<==D// BK IId))#; < rc[U5[U5pT[R"U5n[R"U5nX:Xag[XE5nU(a\SnUVs/sHnSU-PM n nSR U 5n URXz5nURX75nURU5 gg![a [ XE5nN{f=fs snf)NzElement counts were not equal: z First has %d, Second has %d: %rr4) r collectionsCounterrrTrrrrr) r'rrr first_seq second_seq differencesrrrrs rassertCountEqualTestCase.assertCountEquals!%U T&\: F'' 2E ((4F .yEK ;EWii&G// EK%%c7C IIcN  I1)HK IXs,B8!C8CCcURU[S5 URU[S5 X:wGa$[U5UR:d[U5UR:aUR XU5 UnUnU(a$U(aUSS:wd USS:wa US- nUS- nO+U(aUSS:waUS- nOU(aUSS:waUS- nUR SS9nUR SS9nS[ X5-nSSR[R"Xg55-n URX5nURURX855 gg) NzFirst argument is not a stringzSecond argument is not a stringr4T)keependsrrx) r1r.r_diffThresholdrrr rrrrrr) r'rrrfirst_presplitsecond_presplit firstlines secondlinesrrs rrTestCase.assertMultiLineEqualsN eS*JK fc+LM ?E T000F d111%%eS9 #N$O9$r d(:"d*N#t+OF2J$.4'59,$&'22D2AJ)44d4CK%';E'JJK"'''-- "HIID// BK IId))#; <9 rcX:d<[U5<S[U5<3nURURX455 gg)Nz not less than rr'abrrs r assertLessTestCase.assertLesss5u3K IId))#; < rcPUc#SnURURX#55 gg)Nzunexpectedly None)rrrVs rassertIsNotNoneTestCase.assertIsNotNones( ;-K IId))#; < rc[X5(d3[U5<SU<3nURURX455 gg)Nz is not an instance of rprrrr'rKrWrrs rr1TestCase.assertIsInstances9###;DS>3OK IId))#; <$rc[X5(a3[U5<SU<3nURURX455 gg)Nz is an instance of r]r^s rassertNotIsInstanceTestCase.assertNotIsInstance&s7 c  7@~sKK IId))#; < rc>[XU5nURSX45$)NassertRaisesRegexr)r'rrr_r`rs rrdTestCase.assertRaisesRegex,s#''9P~~14@@rc>[XU5nURSX45$)NassertWarnsRegexr)r'rrr_r`rs rrgTestCase.assertWarnsRegex<s# &&6nM~~0$??rc[U[[45(a[R"U5nUR U5(d6SUR <SU<3nURX45nURU5eg)NzRegex didn't match: r) rpr.bytesrrrrrrF)r'textrrrs r assertRegexTestCase.assertRegexOsl nsEl 3 3ZZ7N$$T**&&.K%%c7C'', , +rcF[U[[45(a[R"U5nUR U5nU(aXSXR 5UR5<SUR<SU<3nURX55nURU5eg)NzRegex matched: z matches z in ) rpr.rjrrrstartendrrrF)r'rkunexpected_regexrmatchrs rassertNotRegexTestCase.assertNotRegex[s &e 5 5!zz*:;  ''- [[]UYY[1 ((K %%c7C'', , r)rrrrrr)rr7)NNNNN)WrrrrAssertionErrorrFrrr@rr(rrrrrrrr!r%r)r,r0r9r=rCrGrLrQr8r9_subtest_msg_sentinelr2r]rarfrirprsrvrrrrrrrrrrrrrrrrrrrrrrrrrrr"r%r+r.rr;rrJrMrPrSrWrZr1rardrgrlrsr __classcell__rs@rrrjsB&KGN3 >@ 683== 77  VVaa#CJ= 8e@/##</ ''U "?B  ? ?'9")- - I*B;>? F0E%4-/-AE $+)ZDH#'!)FaF4 C F)9V==== =@!=F= = = = = = == A @& - - -rrcb^\rSrSrS U4SjjrSrSrSrSrSr Sr S r S r S r S rU=r$)FunctionTestCaseikcZ>[[U] 5 X lX0lXlX@lgr7)rr{r( _setUpFunc _tearDownFunc _testFunc _description)r'testFuncrr! descriptionrs rr(FunctionTestCase.__init__ts' .0%!'rc@URbUR5 ggr7)r}rs rrFunctionTestCase.setUp{s ?? & OO  'rc@URbUR5 ggr7)r~rs rr!FunctionTestCase.tearDowns    )     *rc$UR5 gr7)rrs rrFunctionTestCase.runTests  rc.URR$r7)rrrs rr=FunctionTestCase.ids~~&&&rc4[XR5(d[$URUR:H=(aY URUR:H=(a9 UR UR :H=(a UR UR :H$r7)rprr@r}r~rrrAs rrCFunctionTestCase.__eq__sw%00! !%"2"227!!U%8%887~~07  E$6$66 7rc[[U5URURURUR 45$r7)rFrPr}r~rrrs rrGFunctionTestCase.__hash__s7T$Z$2D2D^^T%6%689 9rcd[UR5<SURR<S3$)NrJrK)rrrrrs rrLFunctionTestCase.__str__s%$T^^4 NN335 5rcRS[UR5<SUR<S3$)NrOz tec=rP)rrrrs rrQFunctionTestCase.__repr__s ( 8%)^^5 5rcURb UR$URRnU=(a" URS5SR 5=(d S$r3)rrrr6r5r7s rr9!FunctionTestCase.shortDescriptionsO    ($$ $nn$$1syyq)//19T9r)rr}r~rru)rrrrr(rr!rr=rCrGrLrQr9rrxrys@rr{r{ks:(!'7955::rr{cF^\rSrSrU4SjrSrSrSrSrSr Sr U=r $) rVich>[TU]5 X lXlX0lUR Ulgr7)rr(_messager+rTrF)r'r+rrTrs rr(_SubTest.__init__s+  " ) : :rc[S5e)Nzsubtests cannot be run directly)rrs rr_SubTest.runTests!"CDDrcv/nUR[La*URSRUR55 UR(aPSR SURR 555nURSRU55 SR U5=(d S$)Nz[{}]z, c3H# UHupSRX5v M g7f)z{}={!r}N)r)rrrs rr+_SubTest._subDescription..s'$31FQ  &&1s "z({}) z ())rrwr]rrTritems)r'parts params_descs r_subDescription_SubTest._subDescriptions == 5 5 LLt}}5 6 ;;))$3"kk//1$33K LL{3 4xx/-/rcrSRURR5UR55$Nz{} {})rr+r=rrs rr= _SubTest.ids)~~dnn//143G3G3IJJrc6URR5$r7)r+r9rs rr9_SubTest.shortDescriptions~~..00rcVSRURUR55$r)rr+rrs rrL_SubTest.__str__s ~~dnnd.B.B.DEEr)rrFrTr+) rrrrr(rrr=r9rLrrxrys@rrVrVs*;E 0K1 FFrrV)3r/rqrrrr>r6r8rr}ryrxrutilrrrrr __unittestobjectrwrrfr rrrr-r1rLrZr\rarcrir{rrr&rrrrrrChainMaprrr{rVr rrrs@   ?? 7 y)  &8v&8R%, 6 0  (I 33'3'T$83$8N1D21Dh<0<"{++}-v}-B 7:x7:t!Fx!FrPK!6A __pycache__/_log.cpython-313.pycnu[ Mi SSKrSSKrSSKJr \R"SSS/5r"SS\R 5r"S S \5rg) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc*\rSrSrSrSrSrSrSrg)_CapturingHandler zE A logging handler capturing all (raw and formatted) logging output. cd[RRU5 [//5UlgN)loggingHandler__init__rwatcherselfs 4/opt/alt/python313/lib64/python3.13/unittest/_log.pyr_CapturingHandler.__init__s"  &&r2. cgr rs rflush_CapturingHandler.flushs rcURRRU5 URU5nURRRU5 gr )rrappendformatr)rrecordmsgs remit_CapturingHandler.emits@ ##F+kk&! ""3'r)rN) __name__ __module__ __qualname____firstlineno____doc__rrr__static_attributes__rrrr r s/ (rr c.\rSrSrSrSrSrSrSrSr g) _AssertLogsContextz6A context manager for assertLogs() and assertNoLogs() z"%(levelname)s:%(name)s:%(message)sc[R"X5 X lU(a%[RR X35UlO[RUlSUlX@l gr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser+r.r0s rr_AssertLogsContext.__init__!sH%%d6&  --11%?DJ DJ rc[UR[R5(aUR=olO&[R "UR5=ol[R "UR5n[5nURUR5 URU5 URUl URSSUlURUlUR UlU/Ul URUR5 SUlUR$(agUR$)NF) isinstancer+r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr. setFormatterrhandlers old_handlers old_level propagate old_propagater0)rr6 formatterhandlers r __enter___AssertLogsContext.__enter__+s d&& 7 7#'#3#3 3F[#*#4#4T5E5E#F FF[%%d&9&9: #%$Y' "OOA.#--") #  << rcURURlURURlURR UR 5 UbgUR(aY[URR5S:a5URSRURR55 gg[URR5S:XaTURSR[R"UR 5URR"55 gg)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r=r6r<r@r?r:r>r0lenrr _raiseFailurerrr getLevelNamer.name)rexc_type exc_valuetbs r__exit___AssertLogsContext.__exit__?s#00  $ 2 2  T^^,   <<4<<''(1,""188 ++-4<<''(A-""CVG00N>NOQ.r) r.r6r+rr0r=r>r@rN) r!r"r#r$r%r9rrCrMr&rrrr(r(s@9N(Qrr() r collectionscaser namedtuplerrr r(rrrrRsK&(():*3X)>@(($:Q-:QrPK!22(__pycache__/result.cpython-313.opt-1.pycnu[ Li#`SrSSKrSSKrSSKrSSKJr SSKJr SrSr Sr S r "S S \ 5r g) zTest result objectN)utilwrapsTc0^[T5U4Sj5nU$)Nc`>[USS5(aUR5 T"U/UQ70UD6$)NfailfastF)getattrstop)selfargskwmethods 6/opt/alt/python313/lib64/python3.13/unittest/result.pyinnerfailfast..inner s0 4U + + IIKd(T(R((r)rrs` rr r s  6])) Lrz Stdout: %sz Stderr: %sc\rSrSrSrSrSrSrSSjrSr Sr Sr S r S r S rS r\S 5r\S5rSrSrSrSr\S5rSrSrSrSrSrSrSrSrSr g) TestResultaHolder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. NFcSUl/Ul/UlSUl/Ul/Ul/Ul/UlSUlSUl SUl SUl SUl [RUl[R UlSUlg)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccessescollectedDurations shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__TestResult.__init__&s     "#% "$ "" #  # "rcg)z#Called by TestRunner after test runNr s r printErrorsTestResult.printErrors8rc\U=RS- slSUlUR5 g)z-Called when the given test is about to be runrFN)rr) _setupStdoutr tests r startTestTestResult.startTest;s$  " rcUR(alURc4[R"5Ul[R"5UlUR[ lUR[ lgg)N)r r#ioStringIOr"r$r%r'r1s rr6TestResult._setupStdoutAsP ;;""*&(kkm#&(kkm#,,CJ,,CJ rcg)z`Called once before any tests are executed. See startTest for a method called before each test. Nr0r1s r startTestRunTestResult.startTestRunIr4rc2UR5 SUlg)z'Called when the given test has been runFN)_restoreStdoutr)r7s rstopTestTestResult.stopTestOs "rcUR(GajUR(a[RR 5n[R R 5nU(a=UR S5(dUS- nURR[U-5 U(a=UR S5(dUS- nURR[U-5 UR[lUR[lURRS5 URR5 URRS5 URR5 gg)N r)r r)r$r%getvaluer'endswithr&write STDOUT_LINEr( STDERR_LINEr"seektruncater#)r outputerrors rrCTestResult._restoreStdoutTs  ;;;!!,,. ++-!??400$))// f0DE >>$// ))// e0CD..CJ..CJ    $ $Q '    ( ( *    $ $Q '    ( ( *% rcg)z]Called once after all tests are executed. See stopTest for a method called after each test. Nr0r1s r stopTestRunTestResult.stopTestRunir4rchURRXRX!545 SUlg)z]Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). TN)rappend_exc_info_to_stringr)r r8errs raddErrorTestResult.addErroros, D":":3"EFG!rchURRXRX!545 SUlg)z\Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)rrVrWr)rXs r addFailureTestResult.addFailurews, d$<$Converts a sys.exc_info()-style tuple of values into a string.T)capture_localscompactrG)_clean_tracebacks tracebackTracebackExceptionr!listformatr r$r%rHr'rIrVrKrLjoin) r rYr8exctypevaluetbtb_emsgLinesrOrPs rrWTestResult._exc_info_to_strings   # #GB =++ B>>49 & ;;ZZ((*FJJ'')Et,,dNF f 45~~d++TME e 34wwx  rc\SnSnXU4/n[U51nU(GaUR5upnU(aAURU5(a+URnU(aURU5(aM+XRLaUR U5 U(aUnSnOX2lUbuURUR4HYn U cM[U 5U;dMUR[U 5XR 45 UR[U 55 M[ U(aGMU$)NTF) idpop_is_relevant_tb_leveltb_nextra_remove_unittest_tb_frames __traceback__ __cause__ __context__rVtypeadd) r rrrr8retfirstexcsseencs rrTestResult._clean_tracebackss$%5 {#'88: WR33B77ZZ33B77/////3&(# //5+<+<=A}Ad): T!Wa$ABA>#d* rc4SURR;$)N __unittest)tb_frame f_globals)r rs rr TestResult._is_relevant_tb_levelsr{{4444rcSnU(aCURU5(d-UnURnU(aURU5(dM-UbSUlgg)zTruncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified. N)rr)r rprevs rr%TestResult._remove_unittest_tb_framessS33B77DB33B77  DL rcS[R"UR5UR[ UR 5[ UR 54-$)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rryrrr1s r__repr__TestResult.__repr__sA3 dnn-t}}c$++>NDMM"$$ %r)r)r(r&r#r"r rrrr rrrr!rr)NNN)!__name__ __module__ __qualname____firstlineno____doc___previousTestClass_testRunEntered_moduleSetUpFailedr-r2r9r6r@rDrCrSr rZr]rcrfrjrmrprvrzr rWrrrr__static_attributes__r0rrrrs O#$. - # +* """" &" ,9 .. A6!,85  %rr)rr<r$rrr functoolsrrr rKrLobjectrr0rrrs;     h%h%rPK!;뇆U>U>!__pycache__/suite.cpython-313.pycnu[ Li4SrSSKrSSKJr SSKJr SrSr"SS \5r"S S\5r "S S \5r S r "SS\5r g) TestSuiteN)case)utilTc,[XS5nU"5 g)NcgNr 5/opt/alt/python313/lib64/python3.13/unittest/suite.py!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s 6 .DFr cb\rSrSrSrSrSSjrSrSrSr Sr S r S r S r S rS rSrSrg) BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. TcB/UlSUlURU5 gNr)_tests_removed_testsaddTests)selftestss r __init__BaseTestSuite.__init__s  er cfS[R"UR5<S[U5<S3$)N)rstrclass __class__listrs r __repr__BaseTestSuite.__repr__s"&--"?dLLr cp[XR5(d[$[U5[U5:H$r ) isinstancer$NotImplementedr%)rothers r __eq__BaseTestSuite.__eq__s*%00! !DzT%[((r c,[UR5$r )iterrr&s r __iter__BaseTestSuite.__iter__"sDKK  r cfURnUHnU(dM XR5- nM U$r )rcountTestCases)rcasestests r r4BaseTestSuite.countTestCases%s4##Dt,,.. r c*[U5(d#[SR[U555e[ U[ 5(a0[ U[R[45(a [S5eURRU5 g)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr*type issubclassrTestCaserrappendrr6s r addTestBaseTestSuite.addTest,su~~077T CD D dD ! !j26--1K'M'M?@ @ 4 r cx[U[5(a [S5eUHnURU5 M g)Nz0tests must be an iterable of tests, not a string)r*strr:rB)rrr6s r rBaseTestSuite.addTests6s1 eS ! !NO OD LL r c[U5HEup#UR(a U$U"U5 UR(dM4URU5 MG U$r ) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr6s r runBaseTestSuite.run<sL$T?KE    L}}}''. +  r cURUn[US5(a#U=RUR5- slSURU'g![a gf=f)z2Stop holding a reference to the TestCase at index.r4N)rhasattrrr4r:)rrMr6s r rK BaseTestSuite._removeTestAtIndexEsa &;;u%Dt-..##t':':'<<#!%DKK    sA A"!A"c&UR"U0UD6$r rN)rargskwdss r __call__BaseTestSuite.__call__Ssxx&&&r c6UHnUR5 M g)7Run the tests without collecting errors in a TestResultN)debugrAs r r[BaseTestSuite.debugVsD JJLr )rrN)r )__name__ __module__ __qualname____firstlineno____doc__rJrr'r-r1r4rBrrNrKrWr[__static_attributes__r r r rrsDH M) !!  &'r rc^\rSrSrSrSSjrSrSrSrSr SS jr SS jr S r S r S rg)r\aA test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. c|Sn[USS5SLa S=Uln[U5HupEUR(a O[ U5(atUR XQ5 UR XQ5 URXQ5 URUl [URSS5(d[USS5(aMU(d U"U5 OUR5 UR(dMURU5 M U(a*UR SU5 URU5 SUlU$)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrfrHrI _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr$_previousTestClassr[rJrK_handleModuleTearDown)rrLr[topLevelrMr6s r rN TestSuite.runfs 6,e 4 =04 4F "X$T?KE  4  ++D9))$7&&t4,0NN)DNN,?GGF$8%@@V  }}}''.)+,   ' 'f 5  & &v .%*F " r c<[5nURUS5 g)rZTN) _DebugResultrN)rr[s r r[TestSuite.debugs r c [USS5nURnXC:XagUR(ag[USS5(agSnSUl[USS5n[USS5nUb[[ US5 U"5 U(a2Ub/U"5 URHn URX*SSW U S 9 M [ US 5 gg![a Nf=f![ adn[U[5(aeSnSUlO![a Of=f[R"U5n URX(SU 5 SnANSnAff=f![ US 5 f=f) Nrm__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) rr$rhrgr:r Exceptionr*rrrr#"_createClassOrModuleLevelExceptiontearDown_exceptions) rr6rL previousClass currentClassfailedrvrwe classNameexc_infos r rlTestSuite._handleClassSetUps~( !,0A4H  ! FN 3 : GLo9#%$0$D$D?? & \9%-@/%E  (891 "   ! G!&,77!F9= 6$ $ l ;I;;FD5DD5 D2D-(D5-D22D55ENc8USUS3nURXXe5 g)Nz ())_addClassOrModuleLevelException)rrLexc method_namerrz errorNames r r},TestSuite._createClassOrModuleLevelExceptions$"m2fXQ/  ,,V)Jr c[U5n[USS5nUb2[U[R5(aU"U[ U55 gU(d&UR U[R"55 gUR XT5 g)NaddSkip) _ErrorHolderrr*rSkipTestrEaddErrorrr)rrL exceptionrrzerrorrs r r)TestSuite._addClassOrModuleLevelExceptionsaY'&)T2  :i#G#G E3y> *s||~6,r cJURU5nUcgUR(ag[RUn[ US5 [ USS5nUbU"5 [R"5 [ US5 g![a gf=f![a3n[U[5(aeURXSU5 SnANkSnAff=f![a3n[U[5(aeURXSU5 SnANSnAff=f![ US5 f=f)NrxtearDownModuler{) rrhrrrrrr|r*rrr}rr)rrLrrrrs r rnTestSuite._handleModuleTearDowns-226:  !   $ $  [[0F / 6$V-=tDN)L"$ H%%' F$4 51   !L!&,77;;FrsW    IFIXi6 i6X$6$L6r PK!V&__pycache__/case.cpython-313.opt-1.pycnu[ MiSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r SSK r SSK J r SSKJrJrJrJrJr Sr\"5rSr"SS \5r"S S \5r"S S \5r"SS\5rSrSrSrSr /r!Sr"Sr#Sr$Sr%Sr&Sr'Sr(Sr)"SS5r*"SS\*5r+"S S!\+5r,"S"S#\+5r-"S$S%\-5r."S&S'\R^5r0"S(S)\5r1"S*S+\15r2"S,S-\15r3g).zTest 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\rSrSrSrSrg)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____firstlineno____doc____static_attributes__r 4/opt/alt/python313/lib64/python3.13/unittest/case.pyr r srr c\rSrSrSrSrg) _ShouldStop"z The test should stop. r Nrr rrrr"rrc\rSrSrSrSrg)_UnexpectedSuccess'z/ The test was supposed to fail, but it didn't! r Nrr rrrr'rrrcF\rSrSrSSjr\R SSj5rSrg)_Outcome-Nc\SUlXl[US5UlSUlSUlg)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init___Outcome.__init__.s-!& (/ (E% #rc## URnSUlSv U(a8UR(a'URRURUS5 UR=(a UUlg![a e[ a1nSUl[ URU[U55 SnAN[SnAf[a Nj [R"5nUR(aXPl OKSUlU(a'URRURX5 O[URX5 SnN=f!UR=(a UUlf=f7f)NTF)r&rr" test_caseKeyboardInterruptr _addSkipstrrsysexc_infor#r' _addError)r(r,subTest old_successer1s rtestPartExecutor_Outcome.testPartExecutor5sll   8 ,4<< &&y':':ItL<<7KDL1!   5 DL T[[)SV 4 4   ||~H%%'/$$ KK**9+>+> Tdkk9?H  <<7KDLsLE#A5?EE#5E 'B50E5 EEA;E?EE  E#)r'r#rr%r&N)F) rrrrr) contextlibcontextmanagerr6rr rrrr-s!$88rrc[USS5nUb U"X5 g[R"S[S5 UR"U5 g)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr,reasonr<s rr.r.Vs@fi.G " L$a ))$rcUbHUbD[USUR5(aUR"X5 gUR"X5 ggg)Nr) issubclassfailureException addFailureaddError)rtestr1s rr2r2_sF h2 hqk4#8#8 9 9   d - OOD + 3rcU$r8r )objs r_idrLfs Jrc[U5nURnURnU"U5nU"X@SSS5 U$![a( [ SUR SUR S35Sef=f)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrZjs r(CO ||2YFttT* M O!CNN+1S-=-=,>?CDEJN OOs :2A,c2[RXU45 g)zjSame as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).N)_module_cleanupsappend)functionargskwargss raddModuleCleanuprazsXV45rc"[U[5$)z&Same as enterContext, but module-wide.)rZra)rUs renterModuleContextrcs ". //rc/n[(a-[R5upnU"U0UD6 [(aM-U(aUSeg![anURU5 SnAN:SnAff=f)zSExecute all module cleanup functions. Normally called for you after tearDownModule.Nr)r\pop Exceptionr]) exceptionsr^r_r`excs rdoModuleCleanupsrisuJ  !1!5!5!7 # d %f %   m #   c " " #sA A-A((A-cj^U4Sjn[T[R5(a TnSmU"U5$U$)z Unconditionally skip a test. c>[U[5(d![R"U5U4Sj5nUnSUlTUlU$)Nc>[T5er8r )r_r`rCs r skip_wrapper-skip..decorator..skip_wrappersv&&rT) isinstancerP functoolswraps__unittest_skip____unittest_skip_why__) test_itemrnrCs r decoratorskip..decoratorsF)T** __Y ' '( '$I&* #*0 'r)rptypes FunctionType)rCrvrus` rskipr{s8 &%,,-- ## rc2U(a [U5$[$)z' Skip a test if the condition is true. r{rL conditionrCs rskipIfrsF| Jrc2U(d [U5$[$)z+ Skip a test unless the condition is true. r}r~s r skipUnlessrs F| JrcSUlU$)NT)__unittest_expecting_failure__)rus rr'r's/3I, rc^[U[5(a[U4SjU55$[U[5=(a [ UT5$)Nc3<># UHn[UT5v M g7fr8) _is_subtype).0r5basetypes r _is_subtype..s>X;q(++Xs)rptupleallrPrE)expectedrs `rrrs:(E"">X>>> h % H*Xx*HHrc \rSrSrSrSrSrg)_BaseTestCaseContextcXlgr8r,)r(r,s rr)_BaseTestCaseContext.__init__s"rcURRURU5nURRU5er8)r,_formatMessagemsgrF)r( standardMsgrs r _raiseFailure"_BaseTestCaseContext._raiseFailures1nn++DHHkBnn--c22rrN)rrrrr)rrr rrrrs #3rrc$\rSrSrSSjrSrSrg)_AssertRaisesBaseContextNc[RX5 XlX lUb[R "U5nX0lSUlSUlgr8) rr)rr,recompileexpected_regexobj_namer)r(rr,rs rr)!_AssertRaisesBaseContext.__init__sB%%d6 "  %ZZ7N, rc[URUR5(d[U<SUR<35eU(dCUR SS5UlU(a![[[U55<S35eUSn$UtpBURUl U U"U0UD6 SSS5 Sng![a [U5Ul N2f=f!,(df  N1=f!Snf=f)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. z() arg 1 must be rNz1 is an invalid keyword argument for this function) rr _base_typerT_base_type_strrernextiterrrrSr/)r(namer_r` callable_objs rhandle_AssertRaisesBaseContext.handles t}}doo>>!%t':':!<==!::eT2#7;DL7I%LMMD#' L 2 , 5 5 d-f-D " 2 #L 1  2DsNBC) C)B8"C)$ C-C)8CC)CC) C&"C))C-)rrrrr,r8)rrrrr)rrr rrrrs rrcP\rSrSrSr\rSrSrSr \ "\ R5r Srg)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typescU$r8r r(s rrQ_AssertRaisesContext.__enter__s rcUcuURRnUR(a,UR SR UUR55 O7UR SR U55 O[R"U5 [XR5(dgURS5Ul URcgURnUR[U55(d4UR SR UR[U555 g![a [UR5nGN5f=f)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rrrSr/rrformat traceback clear_framesrEwith_traceback exceptionrsearchpattern)r(exc_type exc_valuetbexc_namers rrR_AssertRaisesContext.__exit__s   .==11}}""#8#?#?@D $OP""?#9#9(#CD  " "2 &(MM22"11$7    &,,$$S^44   9@@#++S^ = >+" .t}}- .sD..EE)rN)rrrrr BaseExceptionrrrQrR classmethodry GenericAlias__class_getitem__rr rrrrs,MJDN6$E$6$67rrc,\rSrSrSr\rSrSrSr Sr g)_AssertWarnsContextizBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typescJ[[RR55Hn[ USS5(dM0UlM [ R"SS9UlURR5Ul[ R"SUR5 U$)N__warningregistry__T)recordalways) listr0modulesvaluesr>rr?catch_warningswarnings_managerrQ simplefilterr)r(vs rrQ_AssertWarnsContext.__enter__!s|ckk((*+Aq/66(*%,!) 7 7t D--779 h 6 rc>URRXU5 UbgURRnSnUR HnURn[XpR5(dM+UcUnURb+URR[ U55(dMhXpl URUl URUl g Ub>URSRURR [ U555 UR"(a,URSRUUR"55 gURSRU55 g![a [ UR5nGNcf=f)Nrz{} not triggered by {}z{} not triggered)rrRrrrSr/r?messagerprrwarningfilenamelinenorrrr)r(rrrrfirst_matchingmws rrR_AssertWarnsContext.__exit__,s] &&xB?    *}}--HA Aa//%!"##/''..s1v66LJJDM((DK   %   9@@((00#n2E G H ==   7>>x?C}} N O   188B C3 *4==)H *sE99FF)rrrr?rN) rrrrrWarningrrrQrRrr rrrrsLJ?N  Drrc\rSrSrSrSrg)_AssertNotWarnsContextiOcZURRXU5 UbgURRnUR H?nURn[X`R5(dM+URUS35 MA g![a [ UR5nNqf=f)Nz triggered) rrRrrrSr/r?rrpr)r(rrrrrrs rrR_AssertNotWarnsContext.__exit__Qs &&xB?    *}}--HA A!]]++""hZz#:; *4==)H *sBB*)B*r N)rrrrrRrr rrrrOs \ 4Sj5r!Sr"Sr#Sr$Sr%Sr&Sr'S r(SPS!jr)S"r*\S#5r+S$r,S%r-S&r.SPS'jr/SPS(jr0SPS)jr1S*r2S+r3S,r4S-r5SQS.jr6SQS/jr7S0r8SPS1jr9SPS2jr:SPS3jr;SRS4jr<SRS5jr=SQS6jr>S7r?SPS8jr@SPS9jrASPS:jrBSPS;jrCSPS<jrDSPS=jrESPS>jrFSPS?jrGSPS@jrHSPSAjrISPSBjrJSPSCjrKSPSDjrLSPSEjrMSPSFjrNSPSGjrOSPSHjrPSPSIjrQSJrRSKrSSPSLjrTSPSMjrUSNrVU=rW$)STestCaseijaA 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. TiicB>SUl/Ul[TU] "U0UD6 g)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rWr_r` __class__s rrTestCase.__init_subclass__s% %  !4262rcXlSUlSUl[X5nURUl/UlSUl 0Ul UR[S5 UR[S5 UR[S5 UR[S 5 UR[ S 5 UR["S 5 g![ a& US:wa[ SUR<SU<35eNf=f) 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 testrunTestzno such test method in : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr>rrS ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr/)r( methodName testMethods rr)TestCase.__init__s * ' 5 2J#-"4"4D  %'!   '89   '89   (:;   &67   ,<=   &<=) 4Y&!~~z"344' 4s C -C<;C<c X RU'g)aAdd 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)r(typeobjr^s rrTestCase.addTypeEqualityFuncs.6!!'*rc>URRXU45 g)zAdd 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).N)rr]r(r^r_r`s r addCleanupTestCase.addCleanups xv67rc,[XR5$)zEnters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method. )rZr)r(rUs r enterContextTestCase.enterContexts b//22rc>URRXU45 g)zhSame as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).N)rr]rWr^r_r`s raddClassCleanupTestCase.addClassCleanups ""HF#;>2D4H4HIIrcn[U5[U5La[$URUR:H$r8)rPNotImplementedrr(others r__eq__TestCase.__eq__ s/ :T%[ (! !##u'<'<<r:rs r__repr__TestCase.__repr__s"($*>*>@ @rc+v# URbURR(dSv gURnUc [U5nOURR U5n[ XU5UlURRURSS9 Sv SSS5 URR(d1URRnUbUR(a[eO!URR(a[eX0lg!,(df  N=f!X0lf=f7f)a(Return 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. NT)r3) rr%rrparams new_child_SubTestr6r&rfailfastrr')r(rrRparent params_maprs rr3TestCase.subTests ==  (N(N   >)&1J008J J7  #// t/LM==((--%&//%%.."!"MML#Ms7A5D98$D.D!A5D.D9 D+'D..D66D9cURnU"X5 g![a0 [R"S[5 UR "U5 gf=f)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerSr?r@rArB)r(rr1rZs r_addExpectedFailureTestCase._addExpectedFailure8sN /!'!:!:  t .  $ MM\( *   d # $s 7AAcURnU"U5 g![a[ [R"S[5 [ Se![ a* UR "U[R"55 gf=ff=f)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrSr?r@rArrGr0r1)r(rr^s r_addUnexpectedSuccessTestCase._addUnexpectedSuccessBsr '#)#>#>  ! & 8 MM_( * 8(d2% 8!!$ 7 8 8s& %A<A0A84A<7A88A<cURnU"X5 g![a [R"S[5 gf=f)Nz$TestResult has no addDuration method) addDurationrSr?r@rA)r(relapsedrbs r _addDurationTestCase._addDurationQs? ' ,,K  &  * MM@( * *s %??c$UR5 gr8)rrs r _callSetUpTestCase._callSetUpZs  rcRU"5b[R"SUS3[SS9 gg)NzFIt is deprecated to return a value that is not None from a test case (rI) stacklevel)r?r@DeprecationWarning)r(methods r_callTestMethodTestCase._callTestMethod]s3 8  MM((.xq23ERS U rc$UR5 gr8)r rs r _callTearDownTestCase._callTearDownbs  rcU"U0UD6 gr8r rs r _callCleanupTestCase._callCleanupes$!&!rcUc5UR5n[USS5n[USS5nUbU"5 OSnUR"U5 [XR5n[URSS5(d[USS5(aV[URSS5=(d [USS5n[ XU5 UUR "U5 UbU"5 $$[USS5=(d [USS5n[U5n[R"5nXpl URU5 UR5 SSS5 UR(abXglURU5 URU5 SSS5 SUlURU5 UR!5 SSS5 UR#5 UR%U[R"5U- 5 UR(aXU(a?UR&(aUR)XR&5 O$UR+U5 OUR,"U5 USUlSnSUl UR "U5 UbU"5 $$!,(df  GNR=f!,(df  GN"=f!,(df  GN=f!SUlSnSUl f=f!UR "U5 UbU"5 ff=f)N startTestRun stopTestRunrsFrtrxr)r/r> startTestrrr.stopTestrtime perf_counterrr6rgr&r#rnrq doCleanupsrdr'r[r_rB) r(rrwrxrskip_whyr#outcome start_times rrun TestCase.runhs >++-F"6>4@L!&->K'K4  ';';FM $DeL v&G**,J % ' --d3OO%4??0A- 11$7,,Z8805G- 11$7**,8!!!&4+<+<+>+KM??("22 44V=T=TU 66v>))$/+/'!%  OOD !& 'A438787"+/'!%  OOD !& 'suA;K''AK')KJ0KJ. K3KB*K.K' J+&K. J=8K K KK$$K''LcXUR=(d [5nUR(a`URR5up#nUR U5 UR "U/UQ70UD6 SSS5 UR(aM`UR $!,(df  N-=f)zFExecute all cleanup functions. Normally called for you after tearDown.N)rrrrer6rtr&)r(rr^r_r`s rr}TestCase.doCleanupss}---8:nn%)^^%7%7%9 "HF))$/!!( "HF ?$)&)!!! ?''..s||~> ?sA8BBc&UR"U0UD6$r8)r)r(r_kwdss r__call__TestCase.__call__sxx&&&rc[XR5n[URSS5(d[USS5(a6[URSS5=(d [USS5n[U5eUR 5 UR U5 UR 5 UR(aGURR5up4nUR"U/UQ70UD6 UR(aMFgg)z6Run the test without collecting errors in a TestResultrsFrtrxN) r>rrr rgrnrqrrert)r(rr~r^r_r`s rdebugTestCase.debugsT#7#78 DNN$7 ? ? J 3U ; ;0GLL":/FK 8$ $  Z( nn%)^^%7%7%9 "HF   h 8 8 8nnnrc[U5e)zSkip this test.rm)r(rCs rskipTestTestCase.skipTests vrc$URU5e)z)Fail immediately, with the given message.)rF)r(rs rfail TestCase.fails##C((rcpU(a/URUS[U5-5nURU5eg)z#Check that the expression is false.z%s is not falseNrrrFr(exprrs r assertFalseTestCase.assertFalses7 %%c+>.$?GdGs!%c<[X5nURSX#5$)a Fail 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) assertWarnsrrr(expected_warningr_r`rs rrTestCase.assertWarns s 8&&6=~~mT::rc<[X5nURSX#5$)z7The opposite of assertWarns. Private due to low demand._assertNotWarns)rrrs rrTestCase._assertNotWarns?s()9@~~/>>rcSSKJn U"XUSS9$)a&Fail 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_AssertLogsContextFno_logs_logrr(loggerlevelrs r assertLogsTestCase.assertLogsDs* -!$uEErcSSKJn U"XUSS9$)zFail unless no log messages of level *level* or higher are emitted on *logger_name* or its children. This method must be used as a context manager. rrTrrrs r assertNoLogsTestCase.assertNoLogs\s -!$tDDrc[U5[U5LaIURR[U55nUb"[U[5(a [ X5nU$UR $)zGet a detailed comparison function for the types of the two args. Returns: A callable accepting (first, second, msg=None) that will raise a failure exception if first != second with a useful human readable error message for those types. )rPrgetrpr/r>_baseAssertEqual)r(firstsecondasserters r_getAssertEqualityFuncTestCase._getAssertEqualityFunces\" ;$v, &0044T%[AH#h,,&t6H$$$rcnX:Xd0S[X5-nURX45nURU5eg)z:The default assertEqual implementation, not type specific.%s != %sN)r rrF)r(rrrrs rrTestCase._baseAssertEquals=$';E'JJK%%c7C'', ,rc4URX5nU"XUS9 g)zHFail if the two objects are unequal as determined by the '==' operator. )rN)r)r(rrrassertion_funcs r assertEqualTestCase.assertEquals44UCu#.rcX:wd<URU[U5<S[U5<35nURU5eg)zFFail if the two objects are equal as determined by the '!=' operator.  == Nr)r(rrrs rassertNotEqualTestCase.assertNotEqualsG%%c59I:CF:K,MNC'', ,rc X:XagUbUb [S5e[X- 5nUb=Xe::ag[U5<S[U5<S[U5<S[U5<S3nOBUcSn[Xc5S:Xag[U5<S[U5<SU<S [U5<S3nUR XG5nUR U5e) aFail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). If the two objects compare equal then they will automatically compare almost equal. N specify delta or places not bothz !=  within  delta ( difference)rz places (rTabsrroundrrFr(rrplacesrdeltadiffrs rassertAlmostEqualTestCase.assertAlmostEquals ?   !3>? ?5>"  }% &!% $ !K ~T"a'% &!$ !K !!#3##C((rc UbUb [S5e[X- 5nUbBX:XdXe:ag[U5<S[U5<S[U5<S[U5<S3nO:UcSnX:Xd[Xc5S:wag[U5<S[U5<SU<S 3nUR XG5nUR U5e) aFail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). Objects that are equal automatically fail. Nrrrrrrrz placesrrs rassertNotAlmostEqualTestCase.assertNotAlmostEquals  !3>? ?5>"  O% &!% $ !K ~Ot)<)A9B59I9B69J9?AK!!#3##C((rc UbqURn[X5(d"URSU<S[U5<35e[X$5(d"URSU<S[U5<35eOSnSn[ U5nUc [ U5nUcX:XagSUR54[X5--n[[WW55H)n Xn X)n X:wdMUS U 4[X5--- n O# Xx:XaUc[U5[U5:wagXx:a#US XWU- 4-- nUS U[X54-- nO'Xx:a"USXXU- 4-- nUS U[X'54-- nUn SSR[R"[ R""U5R%5[ R""U5R%555-n UR'X5n UR)X<5nUR+U5 g![ [ 4a SU-nGNf=f![ [ 4a SU-nGNf=f![ [[ 4a US X4-- n GMMf=f![ [[ 4a US X4-- n GMtf=f![ [[ 4a USX4-- nGNJf=f![ [[ 4a USXu4-- nGNof=f)aAn equality assertion for ordered sequences (like lists and tuples). For the purposes of this function, a valid ordered sequence type is one which can be indexed, has a length, and has an equality operator. Args: seq1: The first sequence to compare. seq2: The second sequence to compare. seq_type: The expected datatype of the sequences, or None if no datatype should be enforced. msg: Optional message to use on failure instead of a list of differences. NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r2)rrprFrlenrTNotImplementedError capitalizer rangemin IndexErrorrPjoindifflibndiffpprintpformat splitlines_truncateMessagerr)r(seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualTestCase.assertSequenceEquals  $--Md--+++8)D/-KLLd--+++8)D/-KLL.'M  #t9D   '4y  |0"--/1(456I3tT?+ GE  GE >"K#$$)=e)K"K#MNI%,(LX%5J$t*,{+.;D[-IJK K"A#'4:)>"?#@AI +.;D[-IJK L"A#'4:)>"?#@AI   MM&...99; ...99; =>>++KA !!#3 #K./ #B!#I #23 'G%'  '":/BC"N"#!3#45I":/BC"O"#!3#45I*":/BCK#2594I#JKIK":/BCL#36:5J#KLILsl: H H.I I12JJ=H+*H+.II I.-I.1JJJ:9J:=KKcpURnUb[U5U::aX-$U[[U5--$r8)maxDiffr DIFF_OMITTED)r(rrmax_diffs rrTestCase._truncateMessageIs8<<  s4yH4> !,T233rc.URXU[S9 g)zA list-specific equality assertion. Args: list1: The first list to compare. list2: The second list to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r(list1list2rs rrTestCase.assertListEqualOs   sT Brc.URXU[S9 g)zA tuple-specific equality assertion. Args: tuple1: The first tuple to compare. tuple2: The second tuple to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r(tuple1tuple2rs rrTestCase.assertTupleEqual[s   u ErcURU5nURU5nW(dW(dg/nU(a4UR S5 UHnUR [ U55 M W(a4UR S5 UHnUR [ U55 M SR U5n URURX955 g![anURSU-5 SnANSnAf[anURSU-5 SnAGNSnAff=f![anURSU-5 SnAGN/SnAf[anURSU-5 SnAGNVSnAff=f)agA 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:r2) differencerTrrSr]reprrr) r(set1set2r difference1r5 difference2linesitemrs rrTestCase.assertSetEqualfsC P//$/K  Q//$/K {   LLE F# T$Z($  LLE F# T$Z($ii&  $%%c785 M IIG!K L L P IIJQN O O P  M IIG!K L L Q IIKaO P P QsFCD0 D-(D D-D((D-0 F:E F!E;;FcX;a<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a in b), but with a nicer default message. not found in Nrrrr(member containerrrs rassertInTestCase.assertIns<  "2;F2C2;I2FHK IId))#; < #rcX;a<[U5<S[U5<3nURURX455 gg)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nrrs r assertNotInTestCase.assertNotIns<  ;DV;L8A)8LNK IId))#; < rcXLa<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nrr(expr1expr2rrs rassertIsTestCase.assertIss;  ,5e,<-6u-=?K IId))#; < rclXLa0S[U5<3nURURX455 gg)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nrr&s r assertIsNotTestCase.assertIsNots0 >:CE:JLK IId))#; < rc URU[S5 URU[S5 X:waS[X5-nSSR[R "[ R"U5R5[ R"U5R555-nURXE5nURURX455 gg)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr2) assertIsInstancerr rrrrrrrrr)r(d1d2rrrs rrTestCase.assertDictEquals b$(LM b$(MN 8$';B'CCK499W]]!>>"-88:!>>"-88:&<==D// BK IId))#; < rc[U5[U5pT[R"U5n[R"U5nX:Xag[XE5nU(a\SnUVs/sHnSU-PM n nSR U 5n URXz5nURX75nURU5 gg![a [ XE5nN{f=fs snf)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: z First has %d, Second has %d: %rr2) r collectionsCounterrrTrrrrr) r(rrr first_seq second_seq differencesrrrrs rassertCountEqualTestCase.assertCountEquals!%U T&\: F'' 2E ((4F .yEK ;EWii&G// EK%%c7C IIcN  I1)HK IXs,B8!C8CCcURU[S5 URU[S5 X:wGa$[U5UR:d[U5UR:aUR XU5 UnUnU(a$U(aUSS:wd USS:wa US- nUS- nO+U(aUSS:waUS- nOU(aUSS:waUS- nUR SS9nUR SS9nS[ X5-nSSR[R"Xg55-n URX5nURURX855 g g ) z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringr2T)keependsrrxN) r/r/r_diffThresholdrrr rrrrrr) r(rrrfirst_presplitsecond_presplit firstlines secondlinesrrs rrTestCase.assertMultiLineEqualsN eS*JK fc+LM ?E T000F d111%%eS9 #N$O9$r d(:"d*N#t+OF2J$.4'59,$&'22D2AJ)44d4CK%';E'JJK"'''-- "HIID// BK IId))#; <9 rcX:d<[U5<S[U5<3nURURX455 gg)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nrr(abrrs r assertLessTestCase.assertLesss5u3 b), but with a nicer default message.z not greater than NrrEs r assertGreaterTestCase.assertGreaters5u6?lIaLQK IId))#; <rcX:d<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to NrrEs rassertGreaterEqualTestCase.assertGreaterEqual s8vBKA,PYZ[P\]K IId))#; <rcjUb0[U5<S3nURURX#55 gg)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Nonerr(rKrrs r assertIsNoneTestCase.assertIsNones/ ?.7n>K IId))#; < rcPUc#SnURURX#55 gg)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rrrTs rassertIsNotNoneTestCase.assertIsNotNones( ;-K IId))#; < rc[X5(d3[U5<SU<3nURURX455 gg)zLSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.z is not an instance of Nrprrrr(rKrWrrs rr/TestCase.assertIsInstances9###;DS>3OK IId))#; <$rc[X5(a3[U5<SU<3nURURX455 gg)z,Included for symmetry with assertIsInstance.z is an instance of Nr[r\s rassertNotIsInstanceTestCase.assertNotIsInstance&s7 c  7@~sKK IId))#; < rc>[XU5nURSX45$)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)r(rrr_r`rs rrbTestCase.assertRaisesRegex,s#''9P~~14@@rc>[XU5nURSX45$)arAsserts 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)r(rrr_r`rs rreTestCase.assertWarnsRegex<s# &&6nM~~0$??rc[U[[45(a[R"U5nUR U5(d6SUR <SU<3nURX45nURU5eg)z=Fail the test unless the text matches the regular expression.zRegex didn't match: rN) rpr/bytesrrrrrrF)r(textrrrs r assertRegexTestCase.assertRegexOsl nsEl 3 3ZZ7N$$T**&&.K%%c7C'', , +rcF[U[[45(a[R"U5nUR U5nU(aXSXR 5UR5<SUR<SU<3nURX55nURU5eg)z9Fail the test if the text matches the regular expression.zRegex matched: z matches z in N) rpr/rhrrrstartendrrrF)r(riunexpected_regexrmatchrs rassertNotRegexTestCase.assertNotRegex[s &e 5 5!zz*:;  ''- [[]UYY[1 ((K %%c7C'', , r)rrrrrr)rr8)NNNNN)XrrrrrAssertionErrorrFrrr>rr)rrrrrrrr r$r(r+r/r7r;rArErJrOr9r:_subtest_msg_sentinelr3r[r_rdrgrnrqrtrr}rrrrrrrrrrrrrrrrrrrrrrrrr r#r)r,rr9rrHrKrNrQrUrXr/r_rbrerjrqr __classcell__rs@rrrjs @&KGN3 >@ 683== 77  VVaa#CJ= 8e@/##</ ''U "?B  ? ?'9")- - I*B;>? F0E%4-/-AE $+)ZDH#'!)FaF4 C F)9V==== =@!=F= = = = = = == A @& - - -rrcf^\rSrSrSrSU4SjjrSrSrSrSr Sr S r S r S r S rS rU=r$)FunctionTestCaseika5A 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. cZ>[[U] 5 X lX0lXlX@lgr8)rryr) _setUpFunc _tearDownFunc _testFunc _description)r(testFuncrr  descriptionrs rr)FunctionTestCase.__init__ts' .0%!'rc@URbUR5 ggr8)r{rs rrFunctionTestCase.setUp{s ?? & OO  'rc@URbUR5 ggr8)r|rs rr FunctionTestCase.tearDowns    )     *rc$UR5 gr8)r}rs rrFunctionTestCase.runTests  rc.URR$r8)r}rrs rr;FunctionTestCase.ids~~&&&rc4[XR5(d[$URUR:H=(aY URUR:H=(a9 UR UR :H=(a UR UR :H$r8)rprr>r{r|r}r~r?s rrAFunctionTestCase.__eq__sw%00! !%"2"227!!U%8%887~~07  E$6$66 7rc[[U5URURURUR 45$r8)rDrPr{r|r}r~rs rrEFunctionTestCase.__hash__s7T$Z$2D2D^^T%6%689 9rcd[UR5<SURR<S3$)NrHrI)rrr}rrs rrJFunctionTestCase.__str__s%$T^^4 NN335 5rcRS[UR5<SUR<S3$)NrMz tec=rN)rrr}rs rrOFunctionTestCase.__repr__s ( 8%)^^5 5rcURb UR$URRnU=(a" URS5SR 5=(d S$)Nr2r)r~r}rr4r3r5s rr7!FunctionTestCase.shortDescriptionsO    ($$ $nn$$1syyq)//19T9r)r~r{r|r}rs)rrrrrr)rr rr;rArErJrOr7rrvrws@rryryks?(!'7955::rrycF^\rSrSrU4SjrSrSrSrSrSr Sr U=r $) rTich>[TU]5 X lXlX0lUR Ulgr8)rr)_messager,rRrF)r(r,rrRrs rr)_SubTest.__init__s+  " ) : :rc[S5e)Nzsubtests cannot be run directly)rrs rr_SubTest.runTests!"CDDrcv/nUR[La*URSRUR55 UR(aPSR SURR 555nURSRU55 SR U5=(d S$)Nz[{}]z, c3H# UHupSRX5v M g7f)z{}={!r}N)r)rrrs rr+_SubTest._subDescription..s'$31FQ  &&1s "z({}) z ())rrur]rrRritems)r(parts params_descs r_subDescription_SubTest._subDescriptions == 5 5 LLt}}5 6 ;;))$3"kk//1$33K LL{3 4xx/-/rcrSRURR5UR55$Nz{} {})rr,r;rrs rr; _SubTest.ids)~~dnn//143G3G3IJJrc6URR5$)z\Returns a one-line description of the subtest, or None if no description has been provided. )r,r7rs rr7_SubTest.shortDescriptions~~..00rcVSRURUR55$r)rr,rrs rrJ_SubTest.__str__s ~~dnnd.B.B.DEEr)rrFrRr,) rrrrr)rrr;r7rJrrvrws@rrTrTs*;E 0K1 FFrrT)4rr0rqrrrr?r4r9rr{ryrxrutilrrrrr __unittestobjectrurrfr rrrr.r2rLrZr\rarcrir{rrr'rrrrrrChainMaprrryrTr rrrsA   ?? 7 y)  &8v&8R%, 6 0  (I 33'3'T$83$8N1D21Dh<0<"{++}-v}-B 7:x7:t!Fx!FrPK!RN+N+(__pycache__/result.cpython-313.opt-2.pycnu[ Li#\SSKrSSKrSSKrSSKJr SSKJr SrSrSr Sr "S S \ 5r g) N)utilwrapsTc0^[T5U4Sj5nU$)Nc`>[USS5(aUR5 T"U/UQ70UD6$)NfailfastF)getattrstop)selfargskwmethods 6/opt/alt/python313/lib64/python3.13/unittest/result.pyinnerfailfast..inner s0 4U + + IIKd(T(R((r)rrs` rr r s  6])) Lrz Stdout: %sz Stderr: %sc\rSrSrSrSrSrSSjrSrSr Sr Sr S r S r S r\S 5r\S 5rSrSrSrSr\S5rSrSrSrSrSrSrSrSrSrg) TestResultNFcSUl/Ul/UlSUl/Ul/Ul/Ul/UlSUlSUl SUl SUl SUl [RUl[R UlSUlg)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccessescollectedDurations shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__TestResult.__init__&s     "#% "$ "" #  # "rcgNr s r printErrorsTestResult.printErrors8rc\U=RS- slSUlUR5 g)NrF)rr) _setupStdoutr tests r startTestTestResult.startTest;s$  " rcUR(alURc4[R"5Ul[R"5UlUR[ lUR[ lggr0)r r#ioStringIOr"r$r%r'r2s rr7TestResult._setupStdoutAsP ;;""*&(kkm#&(kkm#,,CJ,,CJ rcgr0r1r2s r startTestRunTestResult.startTestRunIr5rc2UR5 SUlg)NF)_restoreStdoutr)r8s rstopTestTestResult.stopTestOs "rcUR(GajUR(a[RR 5n[R R 5nU(a=UR S5(dUS- nURR[U-5 U(a=UR S5(dUS- nURR[U-5 UR[lUR[lURRS5 URR5 URRS5 URR5 gg)N r)r r)r$r%getvaluer'endswithr&write STDOUT_LINEr( STDERR_LINEr"seektruncater#)r outputerrors rrDTestResult._restoreStdoutTs  ;;;!!,,. ++-!??400$))// f0DE >>$// ))// e0CD..CJ..CJ    $ $Q '    ( ( *    $ $Q '    ( ( *% rcgr0r1r2s r stopTestRunTestResult.stopTestRunir5rchURRXRX!545 SUlgNT)rappend_exc_info_to_stringr)r r9errs raddErrorTestResult.addErroros, D":":3"EFG!rchURRXRX!545 SUlgrW)rrXrYr)rZs r addFailureTestResult.addFailurews, d$<$>49 & ;;ZZ((*FJJ'')Et,,dNF f 45~~d++TME e 34wwx  rc\SnSnXU4/n[U51nU(GaUR5upnU(aAURU5(a+URnU(aURU5(aM+XRLaUR U5 U(aUnSnOX2lUbuURUR4HYn U cM[U 5U;dMUR[U 5XR 45 UR[U 55 M[ U(aGMU$)NTF) idpop_is_relevant_tb_leveltb_nextrc_remove_unittest_tb_frames __traceback__ __cause__ __context__rXtypeadd) r rrrr9retfirstexcsseencs rrTestResult._clean_tracebackss$%5 {#'88: WR33B77ZZ33B77/////3&(# //5+<+<=A}Ad): T!Wa$ABA>#d* rc4SURR;$)N __unittest)tb_frame f_globals)r rs rr TestResult._is_relevant_tb_levelsr{{4444rcSnU(aCURU5(d-UnURnU(aURU5(dM-UbSUlggr0)rr)r rprevs rr%TestResult._remove_unittest_tb_framessS33B77DB33B77  DL rcS[R"UR5UR[ UR 5[ UR 54-$)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rr{rrr2s r__repr__TestResult.__repr__sA3 dnn-t}}c$++>NDMM"$$ %r)r)r(r&r#r"r rrrr rrrr!rr)NNN) __name__ __module__ __qualname____firstlineno___previousTestClass_testRunEntered_moduleSetUpFailedr-r3r:r7rArErDrTr r\r_rerhrlrorrrxr|r rYrrrr__static_attributes__r1rrrrsO#$. - # +* """" &" ,9 .. A6!,85  %rr) r=r$rrr functoolsrrr rLrMobjectrr1rrrs:     h%h%rPK!bvv&__pycache__/util.cpython-313.opt-1.pycnu[ Li_SrSSKJrJr SSKJr SrSrSrSr Sr Sr \\ \-\ -\-\ -- r Sr S rSS jrS rS rS rSr\"SS5rSrSrg)zVarious utility functions.) namedtupleCounter) commonprefixTP cn[U5U- U- nU[:aSUSUX0[U5U- S4-nU$)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips 4/opt/alt/python313/lib64/python3.13/unittest/util.py_shortenrsI q6I  )D  *9 ts1v 7I7J5KL L Hc^^[[[U55n[[[U55nU[ ::aU$[ U5m[ T5m[ UT- [-[-- nU[:a'[T[U5m[UU4SjU55$[T[[5m[UU4SjU55$)Nc34># UH nTUTS-v M g7fN.0r prefixr s r '_common_shorten_repr..'s:TVa m+Tsc3Z># UH nT[UTS[[5-v M" g7fr)r _MIN_DIFF_LEN _MIN_END_LENrs rrr*s, Q(1YZ=-NNs(+) tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr)s Y% &D S$ F  $ FF I9$~58HHJJO#&.*=:T::: fno >F     rc[U5nU(a[ U5[ :aU$US[ S-$![a [RU5nNIf=f)Nz [truncated]...)repr Exceptionobject__repr__r r#)objshortresults rr!r!-sW&c CK+- ,; "3 33 &%&s 5AAc<UR<SUR<3$)N.) __module__ __qualname__)clss rstrclassr76snnc&6&6 77rcS=p#/n/nXnXnXg:a.URU5 US- nXU:XaUS- nXU:XaMOlXg:a.URU5 US- nXU:XaUS- nXU:XaMO9US- nXU:XaUS- nXU:XaMUS- nXU:XaUS- nXU:XaMM!US- nXU:XaUS- nXU:XaMff=f![a+ URXS5 URXS5 XE4$f=f)a^Finds elements in only one or the other of two, sorted input lists. Returns a two-element tuple of lists. The first list contains those elements in the "expected" list but not in the "actual" list, and the second contains those elements in the "actual" list but not in the "expected" list. Duplicate elements in either input list are ignored. rN)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerE9sa IAGJ   A Auq!QkQ&FAkQ&!!!$Qi1nFAi1nQ"+*Q#+*FA )q.Q!)q.+ (FA )q.Q!)q.  NN8B< (   fRj )     s;8C0C8C>B3C3CCC0D  D c/nU(a+UR5nURU5 U(aM+X!4$![a URU5 N)f=f)zSame behavior as sorted_list_difference but for lists of unorderable items (like dicts). As it does a linear search per item (remove) it has O(n*n) performance.)popremove ValueErrorr:)r=r>rAitems runorderable_list_differencerKbsV G ||~ ! MM$  ( ?  ! NN4  !s8AAcX:X:- $)z.Return -1 if x < y, 0 if x == y and 1 if x > yr)xys r three_way_cmprOss Eae rMismatchzactual expected valuecB[U5[U5p2[U5[U5pT[5n/n[U5H{upXLaM S=p[ X5Hn X,U :XdM U S- n XbU 'M [U5HupX:XdM U S- n XcU 'M X:wdM^[ XU 5nUR U5 M} [U5HOupXLaM Sn [ X5Hn X<U :XdM U S- n XcU 'M [ SX5nUR U5 MQ U$)HReturns list of (cnt_act, cnt_exp, elem) triples where the counts differrr9)listr r- enumeraterange _Mismatchr:)r>r=r tmnNULLr1r?elemcnt_scnt_tr@ other_elemdiffs r_count_diff_all_purposer`ys# <hq q63q6q 8D FQ< < qAtt| !'q\MA! !* >U40D MM$  Q< < qAtt| !E( d  MrcL[U5[U5p2/nUR5H;upVURUS5nXg:wdM[XgU5nUR U5 M= UR5H)upWXR;dM [SXu5nUR U5 M+ U$)rRr)ritemsgetrVr:) r>r=r rWr1r[r\r]r_s r_count_diff_hashablerds 6?GH-q Fwwy dA >U40D MM$  ! wwy  =Q,D MM$ ! MrN)F)__doc__ collectionsrros.pathr __unittestr#r r$rr%rrr)r!r7rErKrOrVr`rdrrrris +    !11OC !#/01   *48&R" z#: ; !FrPK!RaRR&__pycache__/_log.cpython-313.opt-2.pycnu[ Mi SSKrSSKrSSKJr \R"SSS/5r"SS\R 5r"S S \5rg) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc&\rSrSrSrSrSrSrg)_CapturingHandler cd[RRU5 [//5UlgN)loggingHandler__init__rwatcherselfs 4/opt/alt/python313/lib64/python3.13/unittest/_log.pyr_CapturingHandler.__init__s"  &&r2. cgr rs rflush_CapturingHandler.flushs rcURRRU5 URU5nURRRU5 gr )rrappendformatr)rrecordmsgs remit_CapturingHandler.emits@ ##F+kk&! ""3'r)rN)__name__ __module__ __qualname____firstlineno__rrr__static_attributes__rrrr r s / (rr c*\rSrSrSrSrSrSrSrg)_AssertLogsContextz"%(levelname)s:%(name)s:%(message)sc[R"X5 X lU(a%[RR X35UlO[RUlSUlX@l gr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser*r-r/s rr_AssertLogsContext.__init__!sH%%d6&  --11%?DJ DJ rc[UR[R5(aUR=olO&[R "UR5=ol[R "UR5n[5nURUR5 URU5 URUl URSSUlURUlUR UlU/Ul URUR5 SUlUR$(agUR$)NF) isinstancer*r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr- setFormatterrhandlers old_handlers old_level propagate old_propagater/)rr5 formatterhandlers r __enter___AssertLogsContext.__enter__+s d&& 7 7#'#3#3 3F[#*#4#4T5E5E#F FF[%%d&9&9: #%$Y' "OOA.#--") #  << rcURURlURURlURR UR 5 UbgUR(aY[URR5S:a5URSRURR55 gg[URR5S:XaTURSR[R"UR 5URR"55 gg)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r<r5r;r?r>r9r=r/lenrr _raiseFailurerrr getLevelNamer-name)rexc_type exc_valuetbs r__exit___AssertLogsContext.__exit__?s#00  $ 2 2  T^^,   <<4<<''(1,""188 ++-4<<''(A-""CVG00N>NOQ.r) r-r5r*rr/r<r=r?rN) r!r"r#r$r8rrBrLr%rrrr'r's:N(Qrr') r collectionscaser namedtuplerrr r'rrrrQsK&(():*3X)>@(($:Q-:QrPK!4XU~:~:'__pycache__/suite.cpython-313.opt-2.pycnu[ Li4SSKrSSKJr SSKJr SrSr"SS\5r"S S \5r"S S \5r S r "SS\5r g)N)case)utilTc,[XS5nU"5 g)NcgNr 5/opt/alt/python313/lib64/python3.13/unittest/suite.py!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s 6 .DFr c^\rSrSrSrSSjrSrSrSrSr Sr S r S r S r S rS rSrg) BaseTestSuiteTcB/UlSUlURU5 gNr)_tests_removed_testsaddTests)selftestss r __init__BaseTestSuite.__init__s  er cfS[R"UR5<S[U5<S3$)N)rstrclass __class__listrs r __repr__BaseTestSuite.__repr__s"&--"?dLLr cp[XR5(d[$[U5[U5:H$r) isinstancer#NotImplementedr$)rothers r __eq__BaseTestSuite.__eq__s*%00! !DzT%[((r c,[UR5$r)iterrr%s r __iter__BaseTestSuite.__iter__"sDKK  r cfURnUHnU(dM XR5- nM U$r)rcountTestCases)rcasestests r r3BaseTestSuite.countTestCases%s4##Dt,,.. r c*[U5(d#[SR[U555e[ U[ 5(a0[ U[R[45(a [S5eURRU5 g)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr)type issubclassrTestCase TestSuiterappendrr5s r addTestBaseTestSuite.addTest,su~~077T CD D dD ! !j26--1K'M'M?@ @ 4 r cx[U[5(a [S5eUHnURU5 M g)Nz0tests must be an iterable of tests, not a string)r)strr9rB)rrr5s r rBaseTestSuite.addTests6s1 eS ! !NO OD LL r c[U5HEup#UR(a U$U"U5 UR(dM4URU5 MG U$r) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr5s r runBaseTestSuite.run<sL$T?KE    L}}}''. +  r cURUn[US5(a#U=RUR5- slSURU'g![a gf=f)Nr3)rhasattrrr3r9)rrMr5s r rK BaseTestSuite._removeTestAtIndexEsa &;;u%Dt-..##t':':'<<#!%DKK    sA A"!A"c&UR"U0UD6$rrN)rargskwdss r __call__BaseTestSuite.__call__Ssxx&&&r c6UHnUR5 M gr)debugrAs r rZBaseTestSuite.debugVsD JJLr )rrN)r )__name__ __module__ __qualname____firstlineno__rJrr&r,r0r3rBrrNrKrWrZ__static_attributes__r r r rrsAH M) !!  &'r rcZ\rSrSrS SjrSrSrSrSrSSjr SS jr S r S r S r g)r?\c|Sn[USS5SLa S=Uln[U5HupEUR(a O[ U5(atUR XQ5 UR XQ5 URXQ5 URUl [URSS5(d[USS5(aMU(d U"U5 OUR5 UR(dMURU5 M U(a*UR SU5 URU5 SUlU$)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrdrHrI _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr#_previousTestClassrZrJrK_handleModuleTearDown)rrLrZtopLevelrMr5s r rN TestSuite.runfs 6,e 4 =04 4F "X$T?KE  4  ++D9))$7&&t4,0NN)DNN,?GGF$8%@@V  }}}''.)+,   ' 'f 5  & &v .%*F " r c<[5nURUS5 g)NT) _DebugResultrN)rrZs r rZTestSuite.debugs r c [USS5nURnXC:XagUR(ag[USS5(agSnSUl[USS5n[USS5nUb[[ US5 U"5 U(a2Ub/U"5 URHn URX*SSW U S 9 M [ US 5 gg![a Nf=f![ adn[U[5(aeSnSUlO![a Of=f[R"U5n URX(SU 5 SnANSnAff=f![ US 5 f=f) Nrk__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) rr#rfrer9r Exceptionr)rprr""_createClassOrModuleLevelExceptiontearDown_exceptions) rr5rL previousClass currentClassfailedrtrue classNameexc_infos r rjTestSuite._handleClassSetUps~( !,0A4H  ! FN 3 : GLo9#%$0$D$D?? & \9%-@/%E  (891 "   ! G!&,77!F9= 6$ $ l ;I;;FD5DD5 D2D-(D5-D22D55ENc8USUS3nURXXe5 g)Nz ())_addClassOrModuleLevelException)rrLexc method_namerrx errorNames r r{,TestSuite._createClassOrModuleLevelExceptions$"m2fXQ/  ,,V)Jr c[U5n[USS5nUb2[U[R5(aU"U[ U55 gU(d&UR U[R"55 gUR XT5 g)NaddSkip) _ErrorHolderrr)rSkipTestrEaddErrorrr)rrL exceptionrrxerrorrs r r)TestSuite._addClassOrModuleLevelExceptionsaY'&)T2  :i#G#G E3y> *s||~6,r cJURU5nUcgUR(ag[RUn[ US5 [ USS5nUbU"5 [R"5 [ US5 g![a gf=f![a3n[U[5(aeURXSU5 SnANkSnAff=f![a3n[U[5(aeURXSU5 SnANSnAff=f![ US5 f=f)NrvtearDownModulery) rrfrrrrrrzr)rpr{rr)rrLrrrrs r rlTestSuite._handleModuleTearDowns-226:  !   $ $  [[0F / 6$V-=tDN)L"$ H%%' F$4 51   !L!&,77;;FB,:\#:L9=K .2 -!6F(6r r?cH\rSrSrSrSrSrSrSrSr Sr S r S r S r g) riHNcXlgr description)rrs r r_ErrorHolder.__init__Ts&r cUR$rrr%s r id_ErrorHolder.idWsr cgrr r%s r shortDescription_ErrorHolder.shortDescriptionZsr c$SUR<S3$)NzrsV    IFIXi6 i6X$6$L6r PK!ɤo&__pycache__/util.cpython-313.opt-2.pycnu[ Li_SSKJrJr SSKJr SrSrSrSrSr Sr \\\-\ -\-\ -- r Sr Sr SS jrS rS rS rS r\"SS5rSrSrg)) namedtupleCounter) commonprefixTP cn[U5U- U- nU[:aSUSUX0[U5U- S4-nU$)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips 4/opt/alt/python313/lib64/python3.13/unittest/util.py_shortenrsI q6I  )D  *9 ts1v 7I7J5KL L Hc^^[[[U55n[[[U55nU[ ::aU$[ U5m[ T5m[ UT- [-[-- nU[:a'[T[U5m[UU4SjU55$[T[[5m[UU4SjU55$)Nc34># UH nTUTS-v M g7fN.0r prefixr s r '_common_shorten_repr..'s:TVa m+Tsc3Z># UH nT[UTS[[5-v M" g7fr)r _MIN_DIFF_LEN _MIN_END_LENrs rrr*s, Q(1YZ=-NNs(+) tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr)s Y% &D S$ F  $ FF I9$~58HHJJO#&.*=:T::: fno >F     rc[U5nU(a[ U5[ :aU$US[ S-$![a [RU5nNIf=f)Nz [truncated]...)repr Exceptionobject__repr__r r#)objshortresults rr!r!-sW&c CK+- ,; "3 33 &%&s 5AAc<UR<SUR<3$)N.) __module__ __qualname__)clss rstrclassr76snnc&6&6 77rcS=p#/n/nXnXnXg:a.URU5 US- nXU:XaUS- nXU:XaMOlXg:a.URU5 US- nXU:XaUS- nXU:XaMO9US- nXU:XaUS- nXU:XaMUS- nXU:XaUS- nXU:XaMM!US- nXU:XaUS- nXU:XaMff=f![a+ URXS5 URXS5 XE4$f=fNr)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerF9sa IAGJ   A Auq!QkQ&FAkQ&!!!$Qi1nFAi1nQ"+*Q#+*FA )q.Q!)q.+ (FA )q.Q!)q.  NN8B< (   fRj )     s;8C0C8C>B3C3CCC0D  D c/nU(a+UR5nURU5 U(aM+X!4$![a URU5 N)f=fr)popremove ValueErrorr;)r>r?rBitems runorderable_list_differencerLbsV G ||~ ! MM$  ( ?  ! NN4  !s8AAcX:X:- $rr)xys r three_way_cmprPss Eae rMismatchzactual expected valuecB[U5[U5p2[U5[U5pT[5n/n[U5H{upXLaM S=p[ X5Hn X,U :XdM U S- n XbU 'M [U5HupX:XdM U S- n XcU 'M X:wdM^[ XU 5nUR U5 M} [U5HOupXLaM Sn [ X5Hn X<U :XdM U S- n XcU 'M [ SX5nUR U5 MQ U$r9)listr r- enumeraterange _Mismatchr;)r?r>r tmnNULLr1r@elemcnt_scnt_trA other_elemdiffs r_count_diff_all_purposer`ys# <hq q63q6q 8D FQ< < qAtt| !'q\MA! !* >U40D MM$  Q< < qAtt| !E( d  MrcL[U5[U5p2/nUR5H;upVURUS5nXg:wdM[XgU5nUR U5 M= UR5H)upWXR;dM [SXu5nUR U5 M+ U$)Nr)ritemsgetrVr;) r?r>r rWr1r[r\r]r_s r_count_diff_hashablerds 6?GH-q Fwwy dA >U40D MM$  ! wwy  =Q,D MM$ ! MrN)F) collectionsrros.pathr __unittestr#r r$rr%rrr)r!r7rFrLrPrVr`rdrrrrhs,    !11OC !#/01   *48&R" z#: ; !FrPK! Z*__pycache__/__main__.cpython-313.opt-1.pycnu[ MiSrSSKr\RSRS5(a<SSKr\R R\R5r\S-\RS'CSr SSK J r \ "SS9 g) zMain entry pointNz __main__.pyz -m unittestT)main)module) __doc__sysargvendswithos.pathospathbasename executable __unittestr8/opt/alt/python313/lib64/python3.13/unittest/__main__.pyrsf 88A; && !!#..1J~-CHHQK  DrPK! Z$__pycache__/__main__.cpython-313.pycnu[ MiSrSSKr\RSRS5(a<SSKr\R R\R5r\S-\RS'CSr SSK J r \ "SS9 g) zMain entry pointNz __main__.pyz -m unittestT)main)module) __doc__sysargvendswithos.pathospathbasename executable __unittestr8/opt/alt/python313/lib64/python3.13/unittest/__main__.pyrsf 88A; && !!#..1J~-CHHQK  DrPK!E%b6 $__pycache__/__init__.cpython-313.pycnu[ Li Sr/SQrSrSSKJr SSKJrJrJrJ r J r J r J r J r JrJr SSKJrJr SSKJrJr SSKJrJr SS KJrJr SS KJrJrJrJr S r S r!g )a Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework (used with permission). This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Simple usage: import unittest class IntegerArithmeticTestCase(unittest.TestCase): def testAdd(self): # test method names begin with 'test' self.assertEqual((1 + 2), 3) self.assertEqual(0 + 1, 1) def testMultiply(self): self.assertEqual((0 * 10), 0) self.assertEqual((5 * 8), 40) if __name__ == '__main__': unittest.main() Further information is available in the bundled documentation, and from http://docs.python.org/library/unittest.html Copyright (c) 1999-2003 Steve Purcell Copyright (c) 2003-2010 Python Software Foundation This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContextT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrrc:[5R5S1-$)Nr)globalskeys8/opt/alt/python313/lib64/python3.13/unittest/__init__.py__dir__r!Hs 9>> 89 99rcTUS:Xa SSKJq [$[S[<SU<35e)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r __getattr__r'Ks- ((7&& 78,.@I JJrN)"__doc____all__ __unittestresultrcaserrrr r r rrrrsuiterrloaderrr r rrunnerrrsignalsrrrrr!r'rrr r1sK,\ I ''',1#2PP:KrPK!;뇆U>U>'__pycache__/suite.cpython-313.opt-1.pycnu[ Li4SrSSKrSSKJr SSKJr SrSr"SS \5r"S S\5r "S S \5r S r "SS\5r g) TestSuiteN)case)utilTc,[XS5nU"5 g)NcgNr 5/opt/alt/python313/lib64/python3.13/unittest/suite.py!_call_if_exists.. sr )getattr)parentattrfuncs r _call_if_existsr s 6 .DFr cb\rSrSrSrSrSSjrSrSrSr Sr S r S r S r S rS rSrSrg) BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures. TcB/UlSUlURU5 gNr)_tests_removed_testsaddTests)selftestss r __init__BaseTestSuite.__init__s  er cfS[R"UR5<S[U5<S3$)N)rstrclass __class__listrs r __repr__BaseTestSuite.__repr__s"&--"?dLLr cp[XR5(d[$[U5[U5:H$r ) isinstancer$NotImplementedr%)rothers r __eq__BaseTestSuite.__eq__s*%00! !DzT%[((r c,[UR5$r )iterrr&s r __iter__BaseTestSuite.__iter__"sDKK  r cfURnUHnU(dM XR5- nM U$r )rcountTestCases)rcasestests r r4BaseTestSuite.countTestCases%s4##Dt,,.. r c*[U5(d#[SR[U555e[ U[ 5(a0[ U[R[45(a [S5eURRU5 g)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest()) callable TypeErrorformatreprr*type issubclassrTestCaserrappendrr6s r addTestBaseTestSuite.addTest,su~~077T CD D dD ! !j26--1K'M'M?@ @ 4 r cx[U[5(a [S5eUHnURU5 M g)Nz0tests must be an iterable of tests, not a string)r*strr:rB)rrr6s r rBaseTestSuite.addTests6s1 eS ! !NO OD LL r c[U5HEup#UR(a U$U"U5 UR(dM4URU5 MG U$r ) enumerate shouldStop_cleanup_removeTestAtIndex)rresultindexr6s r runBaseTestSuite.run<sL$T?KE    L}}}''. +  r cURUn[US5(a#U=RUR5- slSURU'g![a gf=f)z2Stop holding a reference to the TestCase at index.r4N)rhasattrrr4r:)rrMr6s r rK BaseTestSuite._removeTestAtIndexEsa &;;u%Dt-..##t':':'<<#!%DKK    sA A"!A"c&UR"U0UD6$r rN)rargskwdss r __call__BaseTestSuite.__call__Ssxx&&&r c6UHnUR5 M g)7Run the tests without collecting errors in a TestResultN)debugrAs r r[BaseTestSuite.debugVsD JJLr )rrN)r )__name__ __module__ __qualname____firstlineno____doc__rJrr'r-r1r4rBrrNrKrWr[__static_attributes__r r r rrsDH M) !!  &'r rc^\rSrSrSrSSjrSrSrSrSr SS jr SS jr S r S r S rg)r\aA test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. c|Sn[USS5SLa S=Uln[U5HupEUR(a O[ U5(atUR XQ5 UR XQ5 URXQ5 URUl [URSS5(d[USS5(aMU(d U"U5 OUR5 UR(dMURU5 M U(a*UR SU5 URU5 SUlU$)NF_testRunEnteredT_classSetupFailed_moduleSetUpFailed)rrfrHrI _isnotsuite_tearDownPreviousClass_handleModuleFixture_handleClassSetUpr$_previousTestClassr[rJrK_handleModuleTearDown)rrLr[topLevelrMr6s r rN TestSuite.runfs 6,e 4 =04 4F "X$T?KE  4  ++D9))$7&&t4,0NN)DNN,?GGF$8%@@V  }}}''.)+,   ' 'f 5  & &v .%*F " r c<[5nURUS5 g)rZTN) _DebugResultrN)rr[s r r[TestSuite.debugs r c [USS5nURnXC:XagUR(ag[USS5(agSnSUl[USS5n[USS5nUb[[ US5 U"5 U(a2Ub/U"5 URHn URX*SSW U S 9 M [ US 5 gg![a Nf=f![ adn[U[5(aeSnSUlO![a Of=f[R"U5n URX(SU 5 SnANSnAff=f![ US 5 f=f) Nrm__unittest_skip__F setUpClassdoClassCleanups _setupStdoutTrinfo_restoreStdout) rr$rhrgr:r Exceptionr*rrrr#"_createClassOrModuleLevelExceptiontearDown_exceptions) rr6rL previousClass currentClassfailedrvrwe classNameexc_infos r rlTestSuite._handleClassSetUps~( !,0A4H  ! FN 3 : GLo9#%$0$D$D?? & \9%-@/%E  (891 "   ! G!&,77!F9= 6$ $ l ;I;;FD5DD5 D2D-(D5-D22D55ENc8USUS3nURXXe5 g)Nz ())_addClassOrModuleLevelException)rrLexc method_namerrz errorNames r r},TestSuite._createClassOrModuleLevelExceptions$"m2fXQ/  ,,V)Jr c[U5n[USS5nUb2[U[R5(aU"U[ U55 gU(d&UR U[R"55 gUR XT5 g)NaddSkip) _ErrorHolderrr*rSkipTestrEaddErrorrr)rrL exceptionrrzerrorrs r r)TestSuite._addClassOrModuleLevelExceptionsaY'&)T2  :i#G#G E3y> *s||~6,r cJURU5nUcgUR(ag[RUn[ US5 [ USS5nUbU"5 [R"5 [ US5 g![a gf=f![a3n[U[5(aeURXSU5 SnANkSnAff=f![a3n[U[5(aeURXSU5 SnANSnAff=f![ US5 f=f)NrxtearDownModuler{) rrhrrrrrr|r*rrr}rr)rrLrrrrs r rnTestSuite._handleModuleTearDowns-226:  !   $ $  [[0F / 6$V-=tDN)L"$ H%%' F$4 51   !L!&,77;;FrsW    IFIXi6 i6X$6$L6r PK!I/3/3&__pycache__/main.cpython-313.opt-2.pycnu[ Lit-tSSKrSSKrSSKrSSKJrJr SSKJr SrSr Sr Sr S r S r S r"S S \5r\rg)N)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase cb[RRU5(Ga UR5R S5(a[RR U5(a[RR U[R"55n[RR U5(d$UR[R5(aU$Un[RRU5SSRSS5RSS5$U$)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths 4/opt/alt/python313/lib64/python3.13/unittest/main.py _convert_namers  ww~~d 5 5e < < 77==  wwtRYY[9Hww}}X&&(*=*=bii*H*H Dww%cr*224=EEc3OO KcDUVs/sHn[U5PM sn$s snfN)r)namesrs r_convert_namesr!.s,1 2EDM$ E 22 2scSU;aSU-nU$)N*z*%s*)patterns r_convert_select_patternr&2s '>7" Nrc \rSrSrSrSrS=r=r=r=r =r r Sr SSSS\ RSSSSSS4 SSS.SjjrS rS rSS jrS rS rSrSrSSjrSrSrg) TestProgram8Nr__main__TF) tb_locals durationsc B[U[5(aG[U5UlUR S5SSHn[ URU5UlM OXlUc[ RnX`lXl Xl Xpl Xl Xl XlU c[ R(dSUlOXlX lX@lXPl[(R*R-US5UlUR1U5 UR35 g)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr+r, warnoptionswarnings defaultTest testRunner testLoaderr rbasenameprogName parseArgsrunTests)selfr2r>r6r?r@r7r:r8r9r;r=r+r,parts r__init__TestProgram.__init__Bs fc " "$V,DK S)!"-%dkk48 .!K <88D  $" ""  COO&DM%M&$$((a1  t rcXURc\[URR55 [[SUR 0-5 UR R5 g[URR55 [[SUR 0-5 g)Nprog) r2print _main_parser format_help MAIN_EXAMPLESrB_discovery_parser print_helpMODULE_EXAMPLES)rEargskwargss r _print_helpTestProgram._print_helpjsx ;;  $##//1 2 -64=="99 :  " " - - / $##//1 2 /VT]]$;; r/r0list createTests)rEr6s rrCTestProgram.parseArgsss  ;; 4y1}aJ!>""48,    ( (ab4 8::""2&     ( (ab4 8 ::+DJJ7DN:%"    %!DN ((# . ."..0DN!$"2"23DN rcUR(aURURlU(aNUc UROU"5nUR"URURUR 5UlgURc+URRUR5UlgURRURUR5Ulgr) testNamePatternsr@rWstartr%toptestr^loadTestsFromModuler2loadTestsFromNames)rEfrom_discoveryLoaderrs rraTestProgram.createTestss  /3/D/DDOO , (.T__FHF DLL$((KDI ^^ #;;DKKHDI::4>>;?;;HDIrc|UR5nURU5UlURU5Ulgr)_getParentArgParser_getMainArgParserrL_getDiscoveryArgParserrO)rE parent_parsers rrYTestProgram._initArgParserss6002  22=A!%![+UR R,5S:Xa[&R""[.5 g[&R""S5 gg![a> URURURURURS9nGNf=f![a UR5nGN?f=f)N)r:r8r;r=r+r,)r:r8r;r=rr)r9rr?rTextTestRunnerr/r|r:r8r;r=r+r, TypeErrorrunrgresultr7 wasSuccessfulr5testsRunrZskipped_NO_TESTS_EXITCODE)rEr?s rrDTestProgram.runTestssf ??   ?? "$33DO doot , , / I!%4>>:>--8< :>--;?>>;?>> "1"KJ"J nnTYY/ 99;;,,.. %%*s4;;3F3F/G1/L+, !I!%4>>:>--8< :>--"1"IJI  /!__.  /s,AFAGGGGG<;G<)rOrLr;r9r>r,r7r8r2r%rBrrer+rgr@rdr^r?rfr:r=)FNr)r_ __module__ __qualname____firstlineno__r2r:r8r9r;rBr=rdrOrdefaultTestLoaderrGrTrCrarYrnrorpr[rD__static_attributes__r$rrr(r(8s FINRRHRzRFRXR;K(d#0H0HTd$&>C" &P=: HL $L * =!rr()r5rr rrsignalsr __unittestrrNrQrr!r&objectr(mainr$rrrsT  #    3 ]&]@rPK!E%b6 *__pycache__/__init__.cpython-313.opt-1.pycnu[ Li Sr/SQrSrSSKJr SSKJrJrJrJ r J r J r J r J r JrJr SSKJrJr SSKJrJr SSKJrJr SS KJrJr SS KJrJrJrJr S r S r!g )a Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework (used with permission). This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Simple usage: import unittest class IntegerArithmeticTestCase(unittest.TestCase): def testAdd(self): # test method names begin with 'test' self.assertEqual((1 + 2), 3) self.assertEqual(0 + 1, 1) def testMultiply(self): self.assertEqual((0 * 10), 0) self.assertEqual((5 * 8), 40) if __name__ == '__main__': unittest.main() Further information is available in the bundled documentation, and from http://docs.python.org/library/unittest.html Copyright (c) 1999-2003 Steve Purcell Copyright (c) 2003-2010 Python Software Foundation This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContextT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrrc:[5R5S1-$)Nr)globalskeys8/opt/alt/python313/lib64/python3.13/unittest/__init__.py__dir__r!Hs 9>> 89 99rcTUS:Xa SSKJq [$[S[<SU<35e)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r __getattr__r'Ks- ((7&& 78,.@I JJrN)"__doc____all__ __unittestresultrcaserrrr r r rrrrsuiterrloaderrr r rrunnerrrsignalsrrrrr!r'rrr r1sK,\ I ''',1#2PP:KrPK!__*__pycache__/__main__.cpython-313.opt-2.pycnu[ MiSSKr\RSRS5(a<SSKr\R R \R5r\S-\RS'CSrSSK J r \ "SS9 g)Nz __main__.pyz -m unittestT)main)module) sysargvendswithos.pathospathbasename executable __unittestr8/opt/alt/python313/lib64/python3.13/unittest/__main__.pyrse 88A; && !!#..1J~-CHHQK  DrPK!)PP __pycache__/mock.cpython-313.pycnu[ MiFSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ r SSK r SSK J r J r Jr SSKJr SSKJrJr SSK Jr "SS \5r\"\5Vs1sHoR1S 5(aMUiM snrS r\rS rS rSrSr Sr!Sr"S~Sjr#Sr$Sr%Sr&Sr'S~Sjr(SSjr)Sr*Sr+Sr,"SS\-5r."SS \-5r/\/"5r0\0Rbr1\0Rdr3\0Rhr51S!kr6S"r7"S#S$\85r9S%r:"S&S'\-5r;"S(S)\-5r<"S*S+\<5r=\>"\"\=5Vs1sH,nUR1S,5(dMURS,5iM. sn5r@"S-S.\85rAS/rB"S0S1\<5rC"S2S3\C\=5rDS4rE"S5S6\-5rFS7rG\1SSSSS4SS8.S9jjrHSS:jrI\1SSSSS4SS8.S;jjrJ"S<S=\-5rKS>rLS?rM\H\Jl-\K\JlN\I\JlO\M\JlPS@\JlQSArRSBrSSCRSD\SR555rVSCRSE\SR555rW1SFkrXSGrYSCR\R\S\V\W/5R5Vs1sHnSHU-iM snrZ1SIkr[SJ1r\\[\\-r]\Z\X-r^\^\]-r_1SKkr`SLSMSNSOSP.ra\b\b\b\bSQSSSSRSSS SQSST. rcSUrdSVreSWrfSXrg\d\e\f\gSY.rhSZri"S[S\\<5rj"S]S^\j\=5rk"S_S`\j5rl"SaSb\j\D5rm"ScSd\<5rn\R"\"\ RS55rq\"\ 5rr"SeSf\<5rt"SgSh\t\l\D5ru"SiSj\-5rv\v"5rwSkrx"SlSm\y5rz\z"SSn9r{SSS8.Sojjr|Spr}"SqSr\-5r~\"\|5\"\wGR54rSqSqSsrSStjr"SuSv\D5r\0GRr"SwSx\<5r"SySz\\j\D5rS{r"S|S}5rgs snfs snfs snf!\sa SrqNf=f))Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock ThreadingMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockc\rSrSrSrSrg)InvalidSpecError+z8Indicates that an invalid value was used as a mock spec.N__name__ __module__ __qualname____firstlineno____doc____static_attributes__r4/opt/alt/python313/lib64/python3.13/unittest/mock.pyrr+sBr&r_Tc[U5(a[U[5(dg[US5(a [ US5n[ U5=(d [ R"U5$)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r' _is_async_objr37sPji&@&@sJc:& s # ?w':':3'??r&c>[USS5(a [U5$g)N__code__F)r.r)funcs r'_is_async_funcr7?stZ&&"4((r&c4[[U5[5$N) issubclasstyper r1s r'r+r+Fs d3i 11r&c~[U[5=(d' [U[5=(a [U[5$r9)r, BaseExceptionr;r:r1s r' _is_exceptionr>Ls-3 & A3@*S-"@r&cj[U[5(a[US5(a UR$U$Nmock)r, FunctionTypesr-rAr1s r' _extract_mockrCSs+#}%%'#v*>*>xx r&c[U[5(aU(dURnSnOa[U[[45(a$[U[5(aSnUR nO"[U[ 5(d URnU(a [US5nOUnU[R"U54$![a gf=f![a gf=f)z Given an arbitrary, possibly callable object, try to create a suitable signature object. Return a (reduced func, signature) tuple, or None. TN) r,r;__init__ classmethod staticmethodr*rB__call__AttributeErrorrr/ signature ValueError)r6 as_instanceeat_selfsig_funcs r'_get_signature_objectrO\s $k}} D; 5 6 6 dK ( (H}} m , , ==D4&W&&x000   s$ B<$C < C C  CCFc^[XU5mTcgTunmU4Sjn[X5 U[U5lT[U5lg)Nc*>TR"U0UD6 gr9bind)selfargskwargssigs r'checksig"_check_signature..checksig $!&!r&)rO_copy_func_detailsr;_mock_check_sig __signature__)r6rA skipfirstinstancerXrWs @r'_check_signaturer`sE  :C {ID#"t&!)DJ"DJr&c dSHn[X[X55 M g![a M+f=f)N)r r$__text_signature__r! __defaults____kwdefaults__)setattrr.rI)r6funcopy attributes r'r[r[s6   G(@ A     s ! //c[U[5(ag[U[[[45(a[ UR 5$[USS5bgg)NTrHF)r,r;rGrFr _callabler*r.r1s r'ririsJ#t# k:>??&&sJ%1 r&c2[U5[[4;$r9)r;listtupler1s r'_is_listrms 9u %%r&c[U[5(d[USS5SL$U4UR-H!nURR S5cM! g g)zpGiven an object, return True if the object is callable. For classes, return True if instances would be callable.rHNTF)r,r;r.__mro____dict__get)r2bases r'_instance_callablerssY c4 sJ-T99$ ==  Z ( 4% r&c^ [U[5n[XU5nUcU$Uunm U 4Sjn[XV5 URnUR 5(dSnX`S.nSU-n [ X5 Xn [XT 5 U $)Nc*>TR"U0UD6 gr9rRrUrVrWs r'rX _set_signature..checksigrZr&rf _checksig_rAzYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r,r;rOr[r isidentifierexec _setup_func) rAoriginalr_r^resultr6rXnamecontextsrcrfrWs @r'_set_signaturers 8T*I "8y AF ~ ID#"t&   D     %4G $&* +C #mGs# Nr&c^ [U[5n[XU5unm U 4Sjn[XV5 URnX`S.nSU-n [ X5 Xn [ XT 5 [U 5 U $)Nc*>TR"U0UD6 gr9rRrvs r'rX&_set_async_signature..checksigrZr&rxzeasync def %s(*args, **kwargs): _checksig_(*args, **kwargs) return await mock(*args, **kwargs))r,r;rOr[r r{r|_setup_async_mock) rAr}r_ is_async_mockr^r6rXrrrrfrWs @r'_set_async_signaturersx 8T*I%h)DID#"t&   D%4G *,0 1C #mGs#g Nr&c^^TTlU4SjnU4SjnU4SjnU4SjnU4SjnU4SjnU4Sjn UU4Sjn S TlS TlSTl[ 5Tl[ 5Tl[ 5TlTRTlTRTl TRTl UTl UTl UTl U TlU TlUTlUTlUTlUTlTTlg) Nc(>TR"U0UD6$r9)assert_called_withrUrVrAs r'r'_setup_func..assert_called_with&&777r&c(>TR"U0UD6$r9) assert_calledrs r'r"_setup_func..assert_calleds!!42622r&c(>TR"U0UD6$r9)assert_not_calledrs r'r&_setup_func..assert_not_calleds%%t6v66r&c(>TR"U0UD6$r9)assert_called_oncers r'r'_setup_func..assert_called_oncerr&c(>TR"U0UD6$r9)assert_called_once_withrs r'r,_setup_func..assert_called_once_withs++TTR"U0UD6$r9)assert_has_callsrs r'r%_setup_func..assert_has_callss$$d5f55r&c(>TR"U0UD6$r9)assert_any_callrs r'r$_setup_func..assert_any_calls##T4V44r&c>[5Tl[5TlTR5 TRn[ U5(aUTLaUR5 gggr9) _CallList method_calls mock_calls reset_mock return_valuer+)retrfrAs r'r_setup_func..reset_mocksO({&[ "" S ! !#+ NN +6 !r&Fr)rAcalled call_count call_argsrcall_args_listrrr side_effect_mock_childrenrrrrrrrrr]_mock_delegate) rfrArWrrrrrrrrs `` r'r|r|sGL8378=65GNGG&[G$;G"G,,G**G!00G!3G&=G#/G-G#G)G 1G!3GG!Dr&c ^[RRTlSTlSTl[ 5TlU4SjnSHn[TU[X55 M g)Nrc<>[TRU5"U0UD6$r9)r.rA)attrrUrVrAs r'wrapper"_setup_async_mock..wrapper"styy$'888r&)assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listrer)rArrgs` r'rrsT ++99DDDO$;D 9,  i!<=,r&cSUSS-U:H$)N__%s__rrs r' _is_magicr4s d1Rj D ((r&c*\rSrSrSrSrSrSrSrg)_SentinelObjecti8z!A unique, named, sentinel object.cXlgr9rrTrs r'rE_SentinelObject.__init__:s r&c SUR-$Nz sentinel.%srrTs r'__repr___SentinelObject.__repr__=tyy((r&c SUR-$rrrs r' __reduce___SentinelObject.__reduce__@rr&rN) r r!r"r#r$rErrr%rr&r'rr8s'))r&rc*\rSrSrSrSrSrSrSrg) _SentineliDzAAccess attributes to return a named object, usable as a sentinel.c0Ulgr9 _sentinelsrs r'rE_Sentinel.__init__Fs r&cdUS:Xa[eURRU[U55$)N __bases__)rIr setdefaultrrs r' __getattr___Sentinel.__getattr__Is, ;  ))$0EFFr&cg)Nrrrs r'r_Sentinel.__reduce__Osr&rN) r r!r"r#r$rErrr%rr&r'rrDsKG r&r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecd[RU5 SU-nX4SjnX4Sjn[X#5$)N_mock_cLURnUc [X5$[X15$r9)rr.)rTr _the_namerWs r'_get"_delegating_property.._getds(!! ;4+ +s!!r&cXURnUcXRU'g[XBU5 gr9)rrpre)rTvaluerrrWs r'_set"_delegating_property.._setis(!! ;',MM) $ Cu %r&)_allowed_namesaddproperty)rrrrs r'_delegating_propertyras8t4I" $& D r&c \rSrSrSrSrSrg)ritc[U[5(d[RX5$[U5n[U5nX#:ag[ SX2- S-5HnXXB-nXQ:XdM g g)NFrT)r,rk __contains__lenrange)rTr len_valuelen_selfisub_lists r'r_CallList.__contains__vsn%&&$$T1 1J t9  q(.23Aak*H 4r&c@[R"[U55$r9)pprintpformatrkrs r'r_CallList.__repr__s~~d4j))r&rN)r r!r"r#rrr%rr&r'rrts  *r&rc8[U5n[U5(dgUR(d+UR(dURc UR bgUnUbXALagUR nUbMU(a XlX1lU(a XlX!lg)NFT)rCr+rrrr)parentrrnew_name_parents r'_check_and_set_parentr s % E U # #   U11    '    +G    **  !'' # r&c \rSrSrSrSrSrg) _MockIteric$[U5Ulgr9)iterr2)rTr2s r'rE_MockIter.__init__s 9r&c,[UR5$r9)nextr2rs r'__next___MockIter.__next__sDHH~r&r1N)r r!r"r#rErr%rr&r'r r s r&r c"\rSrSr\rSrSrSrg)BaseiNcgr9rrTrUrVs r'rE Base.__init__s r&r) r r!r"r#rrrrEr%rr&r'rrs  r&rc\rSrSrSr\"5rS.SjrS.SjrSr S/Sjr S0S jr S r S r S r\"\ \ \5r\S 5r\"S5r\"S5r\"S5r\"S5r\"S5rSrSr\"\\5rS1SSS.S\S\4SjjjrSrSrSrSr Sr!Sr"Sr#S r$S2S!jr%S"r&S#r'S$r(S%r)S&r*S'r+S(r,S/S)jr-S*r.S+r/S,r0S-r1g)3r iz A non-callable version of `Mock`NFc  U4n [U[5(d&U=(d UnUb[U5(a[U4n [URU SUR 05n[ [U5RU5nU$)Nr$) r:AsyncMockMixinr3r;r r$ _safe_superr __new__)clsspecrrspec_setr _spec_state _new_name _new_parent_spec_as_instance _eat_selfunsaferVbasesspec_argnewr_s r'rNonCallableMock.__new__ss#~..'4H# h(?(?'-3<<CKK(@A4<d..6&& D'C!$  r&cfURbXRlgXl[XSS5 g)NrR)rrrr )rTrs r'__set_return_value"NonCallableMock.__set_return_valueHs,    */4   ,&+ # !$tT :r&z1The value to be returned when the mock is called.cJURc [U5$UR$r9)rCr;rs r' __class__NonCallableMock.__class__Ts$    #: r&rrrrrcURnUc UR$URnUbF[U5(d6[ U[ 5(d![ U5(d[ U5nX!lU$r9)rrrcallabler,r r>)rT delegatedsfs r'__get_side_effect!NonCallableMock.__get_side_effectasb''  )) )  " " N8B<<"2y11-:K:K2B$& ! r&cR[U5nURnUcXlgXlgr9) _try_iterrrr)rTrr_s r'__set_side_effect!NonCallableMock.__set_side_effectls)% ''  %* "$) !r&rrrrc.Uc/n[U5U;agUR[U55 SUlSUlSUl[ 5Ul[ 5Ul[ 5UlU(a [Ul U(aSUl URR5H3n[U[5(d U[ LaM#UR#XUS9 M5 URn[%U5(aXPLaUR#U5 ggg)z-Restore the mock object to its initial state.NFrrg)idrKrrrrrrrrrrrvaluesr, _SpecState_deletedrr+)rTvisitedrrchildrs r'rNonCallableMock.reset_mockws ?G d8w  r$x  #+'k%K &-D # %)D "((//1E%,,0A   W[  Y2 %% S ! !co NN7 #'6 !r&c [UR5SS9HHup#URS5nUR5nUnUHn[ Xg5nM [ XeU5 MJ g)a2Set attributes on the mock through keyword arguments. Attributes plus return values and side effects can be set on child mocks using standard dot notation and unpacking a dictionary in the method call: >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError} >>> mock.configure_mock(**attrs)c*USRS5$)Nr.)count)entrys r'0NonCallableMock.configure_mock..sq1Dr&)keyrrN)sorteditemssplitpopr.re)rTrVargvalrUfinalr2rts r'r5NonCallableMock.configure_mocksbv||~$E FHC 99S>DHHJECc) C $Fr&c 6US;a [U5eURb(XR;d U[;a[SU-5eO[U5(a [U5eUR(dSUR(aXR;a3UR S5(d U[ ;a[U<SU<S35e[R URRU5nU[La [U5eUcESnURb[URU5nURXX1US9nX RU'Oe[U[ 5(aP[#UR$UR&UR(UR*UR,5nX RU'SSS5 U$![.a? UR0S=(d Un[/SU<S U<S U<S UR$<S 3 5ef=f!,(df  W$=f) N>r3rFzMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)rrrr"r#rCannot autospec attr from target , as it has already been mocked out. [target=, attr=rB)rIrF _all_magicsrr3 startswith_ATTRIB_DENY_LISTr _lockrrqrlr-r.rTr,rkr rr r_rrrrp)rTrr~r target_names r'rNonCallableMock.__getattr__s 4 4 & &    +---1D$%F%MNN2E t__ & &  $*<*<L^L^@^OPPTX\mTm$h''+h.KMNN " "((,,T2F!$T**##/$D$4$4d;E--% $..4##D)FJ// D, V__foo v{{F.4##D);#> (D"&-- "="EK*/x}&/*##'('&++CDDD/# "> s'B H $AF=%H =A HH  HcUR/nURnUnSnUS/:XaSnUbEUnURURU-5 SnURS:XaSnURnUbME[[ U55nUR =(d Sn[ U5S:aUSS;aUS- nXQS'SRU5$)NrrrRr8rAr)rRz().r)rrrKrkreversedrrjoin)rT _name_listr lastdot_firsts r'_extract_mock_name"NonCallableMock._extract_mock_names))* '' $ C!D   g44s: ;C%%-..G!(:./ *F z?Q !}M1# 1 wwz""r&cUR5nSnUS;aSU-nSnURb-SnUR(aSnX0RR-nS[ U5R<U<U<S[ U5<S3$) Nr8)rAzmock.z name=%rz spec=%rz spec_set=%r)rrCrDr r;ri)rTr name_string spec_strings r'rNonCallableMock.__repr__s&&( ( ($t+K    '$K~~, %(8(8(A(AAK J     tH   r&cL[(d[RU5$UR=(d /n[ [ U55n[ UR5nURR5VVs/sHupEU[LdMUPM nnnUVs/sHowRS5(aMUPM nnUVs/sH,owRS5(a[U5(dM*UPM. nn[[X-U-U-55$s snnfs snfs snf)z8Filter the output of `dir(mock)` to only useful members.r()r object__dir__rFrHr;rkrprryrlrrrxset)rTextras from_type from_dictm_namem_valuefrom_child_mockses r'rNonCallableMock.__dir__ sz>>$' '##)rT O ' *.*=*=*C*C*E(*Evh& *E (!*C 1c1BQ C )# 1c1B1Bq\ #c&,y8;KKLMM(D#s$<DDD9D)D!2D!c^^U[;a[RTX5$TR(a;TRb.UTR;aUTR ;a[ SU-5eU[;aSU-n[ U5eU[;aTRbUTR;a[ SU-5e[U5(d)[[T5U[X55 UmUU4SjnOb[TUSU5 [[T5X5 UTRU'O/US:XaUTlg[TX!U5(aUTRU'TR (a4[#TU5(d#TR%5SU3n[ SU35e['U[(5(aUTR U'g[RTX5$)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.c>T"T/UQ70UD6$r9r)rUkwr}rTs r'ru-NonCallableMock.__setattr__..1sHT,GD,GB,Gr&r[rrz Cannot set )rr __setattr__rDrFrprI_unsupported_magicsrr+rer; _get_methodr rrCr,r-rr,r)rTrrmsg mock_namer}s` @r'rNonCallableMock.__setattr__s > !%%dD8 8nn!3!3!? ** *  % !Dt!KL L ( (BTIC % % [ !!-$d>P>P2P$%H4%OPP$U++T D+d*BC G&dE4>T D0,1##D) [ $D  $T5==,1##D)   WT4%8%82245Qtf=I ;yk!:; ; e\ * *"'DMM$  !!$44r&cU[;a>U[U5R;a%[[U5U5 XR;agURR U[ 5nXR;a [[U5RU5 OU[La [U5eU[ La URU [URU'gr9) rr;rpdelattrrrq_missingrr __delattr__rlrI)rTrr2s r'rNonCallableMock.__delattr__Is ; 44:+>+>#> DJ %==(!!%%dH5 ==  . : :4 @ H_ & & h ##D)$,D!r&cDUR=(d Sn[X1U5$r@)r_format_call_signaturerTrUrVrs r'_format_mock_call_signature+NonCallableMock._format_mock_call_signature[s(&%d&99r&cjSnURX5nURnUR"U6nXCXW4-$)Nz0expected %s not found. Expected: %s Actual: %s)rr)rTrUrVactionmessageexpected_stringr actual_strings r'_format_mock_failure_message,NonCallableMock._format_mock_failure_message`s>F::4HNN 88)D /AAAr&c:U(d UR$SnURSS5RS5nURnUHRnUR U5nUb[ U[ 5(a U$[U5nURnURnMT U$)a * If call objects are asserted against a method/function like obj.meth1 then there could be no name for the call object to lookup. Hence just return the spec_signature of the method/function being asserted against. * If the name is not empty then remove () and split by '.' to get list of names to iterate through the children until a potential match is found. A child mock is created only during attribute access so if we get a _SpecState then no attributes of the spec were accessed and can be safely exited. NrRr8rr)rEreplacerzrrqr,rkrC)rTrrWnameschildrenrns r'_get_call_signature_from_name-NonCallableMock._get_call_signature_from_namehs'' ' T2&,,S1&&DLL&E} 5* = = &e, //++ r&c[U[5(a$[U5S:aURUS5nO URnUbN[U5S:XaSnUupEOUup4nUR "U0UD6n[ X6RUR5$U$![anURS5sSnA$SnAff=f)z Given a call (or simply an (args, kwargs) tuple), return a comparison key suitable for matching with other calls. This is a best effort method which relies on the spec's signature, if available, or falls back on the arguments themselves. rrNr8) r,rlrrrErSrrUrV TypeErrorwith_traceback)rT_callrWrrUrV bound_callrs r' _call_matcherNonCallableMock._call_matchers eU # #E Q44U1X>C&&C ?5zQ$ f%*"F . XXt6v6 D//:3D3DEEL .''-- .s%1B B>#B93B>9B>cURS:waDSUR=(d S<SUR<SUR5<3n[U5eg)z/assert that the mock was never called. r Expected 'rAz"' to not have been called. Called  times.Nrr _calls_reprAssertionErrorrTrs r'r!NonCallableMock.assert_not_calledsK ??a oo//oo&&(*C!% % r&cjURS:Xa#SUR=(d S-n[U5eg)z6assert that the mock was called at least once rz"Expected '%s' to have been called.rAN)rrrrs r'rNonCallableMock.assert_calleds6 ??a 7OO-v/C % % r&cURS:XdDSUR=(d S<SUR<SUR5<3n[U5eg)z3assert that the mock was called only once. rrrAz#' to have been called once. Called rNrrs r'r"NonCallableMock.assert_called_oncesK!#oo//oo&&(*C!% % $r&cP^^^TRc)TRTT5nSnSU<SU<3n[U5eUUU4SjnTR[ TT4SS95nTRTR5nXC:wa*[ U[ 5(aUOSn[U"55Ueg)zassert that the last call was made with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.Nz not called.z#expected call not found. Expected: Actual: c,>TRTT5nU$r9rrrUrVrTs r'_error_message:NonCallableMock.assert_called_with.._error_messages33D&ACJr&Ttwo)rrrr_Callr, Exception)rTrUrVexpectedactual error_messagercauses``` r'r"NonCallableMock.assert_called_withs >> !77fEH"F)M / / %%eT6N&EF##DNN3   *8Y ? ?HTE !12 = r&cURS:XdDSUR=(d S<SUR<SUR5<3n[U5eUR"U0UD6$)zaassert that the mock was called exactly once and that that call was with the specified arguments.rrrAz' to be called once. Called r)rrrrrrTrUrVrs r'r'NonCallableMock.assert_called_once_withs\!#oo//oo&&(*C!% %&&777r&c ^UVs/sHnTRU5PM nn[SU5S5n[U4SjTR55nU(duXF;aoUcSnO9SR UVs/sHn[ U[ 5(aUOSPM sn5n[US[U5S[TR535Ueg[U5n/n UHn URU 5 M U (a4[TR=(d S<S [U 5<S U<S 35Uegs snfs snf![a U RU 5 M}f=f) aWassert the mock has been called with the specified calls. The `mock_calls` list is checked for the calls. If `any_order` is False (the default) then the calls must be sequential. There can be extra calls before or after the specified calls. If `any_order` is True then the calls can be in any order, but they must all appear in `mock_calls`.c3T# UHn[U[5(dMUv M g7fr9r,r.0rs r' 3NonCallableMock.assert_has_calls..FAZ9-Eaa( (Nc3F># UHnTRU5v M g7fr9rrcrTs r'rrsM_d0033_!zCalls not found.z+Error processing expected calls. Errors: {} Expected: rrAz does not contain all of z in its call list, found z instead)rrrrformatr,rrrrkremoverKrKrrl) rTcalls any_orderrrr all_callsproblemr not_foundkalls ` r'r NonCallableMock.assert_has_callsss4995aD&&q)59FFMMT__MM (=0G ,-3V-5$7-5*4Ay)A)AAt$K-5$7.8%i !!*5!1 23!!*4??!; <>  O  D '  &  &*oo&?&?&+I&6 C   7:$7 '  & 'sD56#D:$D??EEc4UR[X4SS95n[U[5(aUOSnURVs/sHoPRU5PM nnU(dU[ U5;a UR X5n[SU-5Uegs snf)zassert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if the call is the most recent one.TrNz%s call not found)rrr,rr _AnyComparerrrrTrUrVrrrrrs r'rNonCallableMock.assert_any_calls %%eTN&EF&x;;151D1DE1DA$$Q'1DE HL$88">>tLO #o5 9FBc UR(a.SU;aSUS3OSnUR5U-n[U5eURS5nX@RS;a [ S0UD6$[ U5n[U[5(aU[;a[ nO[U[5(a8U[;d UR(aX@R;a[nOc[ nO\[U[5(d8[U[5(a[nO+[U[5(a[ nOUR"SnW"S0UD6$)a(Create the child mocks for attributes and return value. By default child mocks will be the same type as the parent. Subclasses of Mock may want to override this to customize the way child mocks are made. For non-callable mocks the callable variant will be used (rather than any custom subclass).rrrrRr"rGrr)r,rrIrqrpr r;r:r_async_method_magicsr_all_sync_magicsrF CallableMixinrr rro)rTrrgrr"_typeklasss r'rTNonCallableMock._get_child_mocks   ,2bL!BvJ<(dI//1I=I + +FF;'  n5 5?r? "T  eY ' 'I9M,ME ~ . .--&&98J8J+J!!E=11%!566!E?33MM!$E{r{r&cXUR(dgS[UR5S3$)zRenders self.mock_calls as a string. Example: " Calls: [call(1), call(2)]." If self.mock_calls is empty, an empty string is returned. The output will be truncated if very long. r8z Calls: rr)rrrs r'rNonCallableMock._calls_reprEs'9T__56a88r&) rrrCrrrrrrr) NNNNNNr8NFNFFFFr9)r)2r r!r"r#r$rrrrEr:r?r4"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr[rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrboolrr5rrrrrrrrrrrrrrrrrrTrr%rr&r'r r s`* GE=AEIBEI, 8*Z  #L 9r&r assert_c\rSrSrSrSrSrg)r iZzA list which checks if it contains a call which may have an argument of ANY, flipping the components of item and self from their traditional locations so that ANY is guaranteed to be on the left.c UHOn[U5[U5:Xde[[X5VVs/sH up4X4:HPM snn5(dMO g gs snnf)NTF)rallzip)rTitemrrrs r'r_AnyComparer.__contains___sdEt9E * **(+D(8(8$H"(8  sA rN)r r!r"r#r$rr%rr&r'r r Zs r&r cUcU$[U5(aU$[U5(aU$[U5$![a Us$f=fr9)r>rirrr1s r'rdrdjsO { S ~~ Cy  s 6 AAc P\rSrSrSS\SSSSSSS4 SjrSrSrSrSr S r S r g) riyNr8c vX0RS'[[U5R"XXVUXU 40U D6 X lg)Nr)rprrrEr) rTrrrrrr rr!r"r#rVs r'rECallableMixin.__init__{sB/; *+M4(11  K 39 'r&cgr9rrs r'r\CallableMixin._mock_check_sigs r&cnUR"U0UD6 UR"U0UD6 UR"U0UD6$r9)r\_increment_mock_call _mock_callrs r'rHCallableMixin.__call__s> d-f- !!4262///r&c&UR"U0UD6$r9)_execute_mock_callrs r'r.CallableMixin._mock_calls&&777r&cLSUl[R [X4SS9nX0lUR R U5 [UR 5UlSSS5 URSLnURnURnUS:HnURR [SX455 URnUbU(aMURR [XQU455 URSLnU(aURS-U-n[XaU45n URR U 5 UR(a-U(aSn OSn URS:HnURU -U-nURnUbMgg!,(df  GN<=f)NTrrRr8rr)rr rrrrrKrrrrrrrr) rTrUrVrdo_method_callsmethod_call_namemock_call_name is_a_callr#this_mock_callrs r'r-"CallableMixin._increment_mock_calls  " " 4.d3E"N    & &u -!$"5"56DO#++47??,,"d*  ub$%789++ %((//7Gv6V0WX"-":":$"F"'2'='='CFV'V$#N&#ABN  " " ) ). 9))CC'66$> !,!;!;c!AN!R&66K-%-# "s AF F#cURnUbS[U5(aUe[U5(d[U5n[U5(aUeOU"U0UD6nU[LaU$UR [La UR $UR(a)URR [La UR $URbUR"U0UD6$UR $r9) rr>rirrrrrr-)rTrUrVeffectr~s r'r1 CallableMixin._execute_mock_calls!!  V$$ v&&f (( L) 00W$  " "' 1$$ $   4#6#6#C#C7#R$$ $    '##T4V4 4   r&)rrrr) r r!r"r#rrEr\rHr.r-r1r%rr&r'rrys8 d$d!RT ' 0827h!r&rc\rSrSrSrSrg)ria Create a new `Mock` object. `Mock` takes several optional arguments that specify the behaviour of the Mock object: * `spec`: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an `AttributeError`. If `spec` is an object (rather than a list of strings) then `mock.__class__` returns the class of the spec object. This allows mocks to pass `isinstance` tests. * `spec_set`: A stricter variant of `spec`. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as `spec_set` will raise an `AttributeError`. * `side_effect`: A function to be called whenever the Mock is called. See the `side_effect` attribute. Useful for raising exceptions or dynamically changing return values. The function is called with the same arguments as the mock, and unless it returns `DEFAULT`, the return value of this function is used as the return value. If `side_effect` is an iterable then each call to the mock will return the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. * `unsafe`: By default, accessing any attribute whose name starts with *assert*, *assret*, *asert*, *aseert*, or *assrt* raises an AttributeError. Additionally, an AttributeError is raised when accessing attributes that match the name of an assertion method without the prefix `assert_`, e.g. accessing `called_once` instead of `assert_called_once`. Passing `unsafe=True` will allow access to these attributes. * `wraps`: Item for the mock object to wrap. If `wraps` is not None then calling the Mock will pass the call through to the wrapped object (returning the real result). Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist will raise an `AttributeError`). If the mock has an explicit `return_value` set then calls are not passed to the wrapped object and the `return_value` is returned instead. * `name`: If the mock has a name then it will be used in the repr of the mock. This can be useful for debugging. The name is propagated to child mocks. Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. rNrrr&r'rrs7r&rcBSnUHnX ;dM [U<S35e g)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r'_check_spec_arg_typosrF's/ 2E  "(OP r&c\rSrSrSr/rSS.SjrSrSrSr \ RS 5r S r S rS rS rSrSrSrSrg)_patchi0NFr&c Ub"U[La [S5eUb [S5eU (d [U 5 [U5(a[ SU<SU<S35e[U5(a[ SU<SU<S35eXlX lX0lXlX@l XPl SUl X`l Xpl Xl/UlSUlg)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=rBz? as the spec_set target has already been mocked out. [spec_set=F)rrKrFr+rgetterrgr) new_callablercreate has_localr autospecrVadditional_patchers is_started) rTrKrgr)rrMr rOrLrVr&s r'rE_patch.__init__5s  #'! B# G !& ) T " ""#I=166:XQ@A A X & &"#I=1AAI AOP P "(     #% r&c j[URURURURUR UR URURUR5 nURUl URVs/sHo"R5PM snUl U$s snfr9) rHrKrgr)rrMr rOrLrVattribute_namerPcopy)rTpatcherps r'rU _patch.copy[s KK499 KK MM4,,dkk  "&!4!4"66' 6FFH6' #' s B0c[U[5(aURU5$[R"U5(aUR U5$UR U5$r9r,r;decorate_classr/rdecorate_async_callabledecorate_callable)rTr6s r'rH_patch.__call__hsS dD ! !&&t, ,  & &t , ,//5 5%%d++r&c[U5HinUR[R5(dM)[ X5n[ US5(dMGUR 5n[XU"U55 Mk U$NrH)rHrr TEST_PREFIXr.r-rUre)rTrr attr_valuerVs r'r[_patch.decorate_classpscJD??5#4#455 -J:z22iikG E!4 5 r&c#h# /n[R"5nURHZnURU5nURbUR U5 M4UR [LdMIURU5 M\ U[U5- nX#4v SSS5 g!,(df  g=f7fr9) contextlib ExitStack patchings enter_contextrTupdater)rrKrl)rTpatchedrUkeywargs extra_args exit_stackpatchingr|s r'decoration_helper_patch.decoration_helper~s  ! ! #z#-- ..x8**6OOC(\\W,%%c* . E*% %D" "$ # #s#B2AB!0(B! B2! B/+B2c^^^[TS5(aTRRT5 T$[T5UUU4Sj5mT/TlT$)Nrgct>TRTUU5up#T"U0UD6sSSS5 $!,(df  g=fr9rorUrknewargs newkeywargsr6rjrTs r'rj)_patch.decorate_callable..patcheds;''(,(025KgW4 4222s ) 7r-rgrKrrTr6rjs``@r'r]_patch.decorate_callablesN 4 % % NN ! !$ 'K t 5  5 "Fr&c^^^[TS5(aTRRT5 T$[T5UUU4Sj5mT/TlT$)Nrgc># TRTUU5up#T"U0UD6IShvN sSSS5 $N !,(df  g=f7fr9rsrts r'rj/_patch.decorate_async_callable..patchedsJ''(,(025Kg!7:k::22;22s$A535 A5 AArxrys``@r'r\_patch.decorate_async_callablesN 4 % % NN ! !$ 'K t ;  ; "Fr&cdUR5nURn[nSnURUnSnU[;a[U[5(aSUl UR(dU[La[ U<SU<35eX44$![[ 4a [ X[5nNwf=f)NFTz does not have the attribute ) rKrgrrprIKeyErrorr. _builtinsr,rrM)rTtargetrr}locals r' get_original_patch.get_originals~~ t,HE 9 FJ!?!?DK{{x72 7=tD ) 6vW5H 6sB B/.B/c J UR(a [S5eURURURp2nUR UR pTURnUR5Ul USLaSnUSLaSnUSLaSnUbUb [S5eUcUbUS;a [S5eUR5upxU[LGaUGcSn USLa UnUSLaUnSnOUb USLaUnSnOUSLaUnUcUb+U[La [S5e[U[5(aSn UbUn OUc[U5(a[ n OeUcUbYUn UbUn [#U 5(aS U ;n O[%U 5(+n [U 5(a[ n OU (a[&n O [(n O[(n 0n UbX-S 'UbX=S '[U [5(a5[+U [,5(a UR.(aUR.U S 'U R1U5 U "S0U D6nU (a^[3U5(aNUn UbUn [#U 5(d[5U 5(d[&n U R7S 5 U "SUS S.U D6UlGOUbU[La [S5eU[La [S5e[;U5nUSLaUn[3UR5(a,[=SUR.<SUR<SU<S35e[3U5(aQ[?URSUR5n[=SUR.<SU<SUR<SU<S3 5e[AU4UUR.S.UD6nOU(a [S5eUnXpl!Xl"[FRH"5Ul%SUl[MURUR.U5 URNbz0nUR[LaUUURN'URPHDnURJRSU5nUR[LdM3UR1U5 MF U$U$! URT"[VRX"56(deg=f)zPerform the patch.zPatch is already startedFNzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerHrr rrRrSzBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=Truerz: as the patch target has already been mocked out. [target=rrBr rr)r _namez.Can't pass kwargs to a mock we aren't creatingr)-rQrBr)rr rOrVrLrKrrrrr,r;r3r rmr^rrr:r rgrir+rsr{rrrr.r temp_originalis_localrerf _exit_stackrerTrPrh__exit__sysexc_info)rTr)rr rOrVrLr}rinheritKlass this_spec not_callable_kwargsrnew_attrrlrnr|s r' __enter___patch.__enter__s ??9: :"hh 4==8==$++&(( kkm  5=D u H u H   4=> >  !5 L (TU U++- '>h.Gt|t#'HD!t##HDT!#8#7w&#$GHHh--"G'$-"9"9!!X%9 ' (II&&#-Y#>L'/ ':#:L ++%E!0E%E!G"&#&. #5$''5/22t~~"&.. NN6 ""'"C,S11! ' (I ++&y110E F##($4SD$4+2$4  !'!(7" GHHH~H4# --&+DNN+=>#{{oWXLCDD!**%dkk:t{{K &+DNN+=]"o&#{{oWXLCDD "(BX(,B:@BC LM M% %//1  DKK :"". 88w&7:Jt223 $ 8 8H**88BC||w."))#.!9"!J ==#,,.12s B Q6Q64Q66*R"c<UR(dgUR(a?UR[La,[ UR UR UR5 O[UR UR 5 UR(d`[UR UR 5(aUR S;a+[ UR UR UR5 U?U?U?URnU? SUlUR"U6$)zUndo the patch.N)r$r!rc__annotations__rdF) rQrrrrerrgrrMr-rr)rTrrms r'r_patch.__exit__as  ==T//w> DKK1C1C D DKK 0;; T^^(L(L+== T^^T5G5GH   M K%%  ""H--r&c\UR5nURRU5 U$z-Activate a patch, returning any created mock.)r_active_patchesrKrTr~s r'start _patch.startzs'! ##D) r&cURRU5 URSSS5$![a gf=fzStop an active patch.N)rrrKrrs r'stop _patch.stopsD   ' ' - }}T4..   s 0 ==)rrPrgrOrMrKrNrrQrVr)rLrr rr)r r!r"r#rTrrErUrHr[recontextmanagerror]r\rrrrrr%rr&r'rHrH0sgNOAF# L ,  # #""0Xt.2/r&rHcURSS5up[ [ R U5U4$![[[4a [SU<35ef=f)Nrrrz,Need a valid target to patch. You supplied: )rsplitrrKrIrpkgutil resolve_name)rrgs r' _get_targetrshG"MM#q1 7'' 0) ;; z> 2G:6* EG GGs 2%ArIc n^[T5[La[T<S35eU4Sjn [XX#UXVXyUS9 $)a patch the named member (`attribute`) on an object (`target`) with a mock object. `patch.object` can be used as a decorator, class decorator or a context manager. Arguments `new`, `spec`, `create`, `spec_set`, `autospec` and `new_callable` have the same meaning as for `patch`. Like `patch`, `patch.object` takes arbitrary keyword arguments for configuring the mock object it creates. When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. z3 must be the actual object to be patched, not a strc>T$r9rrsr'ru_patch_object..sVr&rI)r;strrrH) rrgr)rrMr rOrLr&rVrKs ` r' _patch_objectrsK$ F|sjK L  F 3fL r&c x^[T5[La[[RT5nOU4SjnU(d [ S5e[ UR55nUSup[XyXX#XE05 n Xl USSH5up[XyXX#XE05 n Xl U RRU 5 M7 U $)aPerform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the patches:: with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): ... Use `DEFAULT` as the value if you want `patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, and a dictionary is returned when `patch.multiple` is used as a context manager. `patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments `spec`, `spec_set`, `create`, `autospec` and `new_callable` have the same meaning as for `patch`. These arguments will be applied to *all* patches done by `patch.multiple`. When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX` for choosing which methods to wrap. c>T$r9rrsr'ru!_patch_multiple..sr&z=Must supply at least one keyword argument with patch.multiplerrN) r;rrrrrKrkryrHrTrPrK) rrrMr rOrLrVrKryrgr)rV this_patchers ` r'_patch_multiplers, F|s--v6  K    E1XNI3fG')  s& B '0###**<8 $ Nr&c 8[U5up[XXUXEXhUS9 $)aV `patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the `target` is patched with a `new` object. When the function/with statement exits the patch is undone. If `new` is omitted, then the target is replaced with an `AsyncMock if the patched object is an async function or a `MagicMock` otherwise. If `patch` is used as a decorator and `new` is omitted, the created mock is passed in as an extra argument to the decorated function. If `patch` is used as a context manager the created mock is returned by the context manager. `target` should be a string in the form `'package.module.ClassName'`. The `target` is imported and the specified object replaced with the `new` object, so the `target` must be importable from the environment you are calling `patch` from. The target is imported when the decorated function is executed, not at decoration time. The `spec` and `spec_set` keyword arguments are passed to the `MagicMock` if patch is creating one for you. In addition you can pass `spec=True` or `spec_set=True`, which causes patch to pass in the object being mocked as the spec/spec_set object. `new_callable` allows you to specify a different class, or callable object, that will be called to create the `new` object. By default `AsyncMock` is used for async functions and `MagicMock` for the rest. A more powerful form of `spec` is `autospec`. If you set `autospec=True` then the mock will be created with a spec from the object being replaced. All attributes of the mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise a `TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. Instead of `autospec=True` you can pass `autospec=some_object` to use an arbitrary object as the spec instead of the one being replaced. By default `patch` will fail to replace attributes that don't exist. If you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! Patch can be used as a `TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods share a common patchings set. `patch` finds tests by looking for method names that start with `patch.TEST_PREFIX`. By default this is `test`, which matches the way `unittest` finds tests. You can specify an alternative prefix by setting `patch.TEST_PREFIX`. Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use "as" then the patched object will be bound to the name after the "as"; very useful if `patch` is creating a mock object for you. Patch will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `patch` takes arbitrary keyword arguments. These will be passed to `AsyncMock` if the patched object is asynchronous, to `MagicMock` otherwise or to `new_callable` if specified. `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are available for alternate use-cases. rI)rrH) rr)rrMr rOrLr&rVrKrgs r'rrs-V$F+F 3fL r&c^\rSrSrSrSSjrSrSrSrSr Sr S r S r S r S rS rSrg) _patch_dicti6a Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test. `in_dict` can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys. `in_dict` can also be a string specifying the name of the dictionary, which will then be fetched by importing it. `values` can be a dictionary of values to set in the dictionary. `values` can also be an iterable of `(key, value)` pairs. If `clear` is True then the dictionary will be cleared before the new values are set. `patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary:: with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()): ... `patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator `patch.dict` honours `patch.TEST_PREFIX` for choosing which methods to wrap. c Xl[U5UlURRU5 X0lSUlgr9)in_dictdictrjriclear _original)rTrrjrrVs r'rE_patch_dict.__init__Ss0 6l  6" r&c[U[5(aURU5$[R"U5(aUR U5$UR U5$r9rZ)rTfs r'rH_patch_dict.__call__\sS a  &&q) )  & &q ) )//2 2%%a((r&c4^^[T5UU4Sj5nU$)Nc>TR5 T"U0UD6TR5 $!TR5 f=fr9r _unpatch_dictrUrrrTs r'_inner-_patch_dict.decorate_callable.._inneres8     %$~"~""$""$s+=rrTrrs`` r'r]_patch_dict.decorate_callabled q %  % r&c4^^[T5UU4Sj5nU$)Nc># TR5 T"U0UD6IShvN TR5 $N!TR5 f=f7fr9rrs r'r3_patch_dict.decorate_async_callable.._innerqsC     %^^+""$,""$s%A  757A 7A  A rrs`` r'r\#_patch_dict.decorate_async_callableprr&c0[U5Hn[X5nUR[R5(dM4[ US5(dMG[ URURUR5nU"U5n[XU5 M U$r`) rHr.rrrar-rrrjrre)rTrrrb decorator decorateds r'r[_patch_dict.decorate_class|sqJD -J 1 122Z00' dkk4::N %j1 Y/  r&c:UR5 UR$)zPatch the dict.)rrrs r'r_patch_dict.__enter__s ||r&cURn[UR[5(a%[R "UR5UlURnUR nUR5nX@l U(a [U5 URU5 g![a 0nUH nX%XE'M NHf=f![a UH nXX%'M gf=fr9) rjr,rrrrrrUrIr _clear_dictri)rTrjrrr}rws r'r_patch_dict._patch_dicts dllC ( ("// =DL,,  -||~H"    + NN6 " -H '    - +%{  +s$*B%C%CCC"!C"cURnURn[U5 URU5 g![a UH nX#X'M gf=fr9)rrrrirI)rTrr}rws r'r_patch_dict._unpatch_dictsO,,>>G - NN8 $ -'}   -s7AAc>URbUR5 g)zUnpatch the dict.F)rr)rTrUs r'r_patch_dict.__exit__s >> %    r&cdUR5n[RRU5 U$r)rrHrrKrs r'r_patch_dict.starts'!%%d+ r&c[RRU5 UR SSS5$![a gf=fr)rHrrrKrrs r'r_patch_dict.stopsD   " " ) )$ / }}T4..   s4 AA)rrrrjN)rF)r r!r"r#r$rErHr]r\r[rrrrrrr%rr&r'rr6s>8)   +8 -/r&rcrUR5 g![a [U5nUHnX M gf=fr9)rrIrk)rkeysrws r'rrs7  G}C s  66cd[[R5HnUR5 M g)z7Stop all active patches. LIFO to unroll nested patches.N)rrHrr)rs r'_patch_stopallrs &001 2r&testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c#,# UH nSU-v M g7f)zi%sNrrns r'rrs7&6519&6c#,# UH nSU-v M g7f)zr%sNrrs r'rrs5$4q$4r>r__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c ^U4SjnXlU$)z:Turns a callable object (like a mock) into a real functionc>T"U/UQ70UD6$r9r)rTrUrr6s r'method_get_method..method sD&4&2&&r&)r )rr6rs ` r'rrs'O Mr&r> __aexit__ __anext__ __aenter__ __aiter__>__del__rrEr __prepare__r__instancecheck____subclasscheck__c,[RU5$r9)r__hash__rs r'ruru%s V__T2r&c,[RU5$r9)r__str__rs r'ruru&s FNN40r&c,[RU5$r9)r __sizeof__rs r'ruru'sv006r&cj[U5RSUR5S[U53$)N/)r;r rrirs r'ruru(s3$t*"5"5!6a8O8O8Q7RRSTVW[T\S]^r&)rrr  __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r __complex__ __float____bool__ __index__rc^U4SjnU$)Nc^>TRRnU[LaU$TULag[$NT)__eq__rrNotImplemented)otherret_valrTs r'r_get_eq..__eq__=s/++00 ' !N 5=r&r)rTrs` r'_get_eqr <s Mr&c^U4SjnU$)Ncb>TRR[La[$TULag[$NF)__ne__rrr)rrTs r'r$_get_ne..__ne__Gs* ;; ) ) 8N 5=r&r)rTr$s` r'_get_ner&Fs Mr&c^U4SjnU$)Ncn>TRRnU[La [/5$[U5$r9)__iter__rrrrrTs r'r)_get_iter..__iter__Ps/--22 g 8OG}r&r)rTr)s` r' _get_iterr,Os Or&c^U4SjnU$)Nc>TRRnU[La[[ /55$[[ U55$r9)rrr_AsyncIteratorrr*s r'r"_get_async_iter..__aiter__Zs8..33 g !$r(+ +d7m,,r&r)rTrs` r'_get_async_iterr1Ys- r&)rr$r)rc[RU[5nU[LaX1lg[RU5nUbU"U5nXQlg[ RU5nUbU"U5Ulggr9)_return_valuesrqrr_calculate_return_value_side_effect_methodsr)rArrfixedreturn_calculatorr side_effectors r'_set_return_valuer9jsw   tW -E G#/33D9$(. *(,,T2M *40!r&c \rSrSrSrSrSrg) MagicMixini|cUR5 [[U5R"U0UD6 UR5 gr9)_mock_set_magicsrr;rE)rTrUrs r'rEMagicMixin.__init__}s4 J%..;; r&c [[-nUn[USS5bXURUR5n[ 5nX- nUH)nU[ U5R;dM[X5 M+ U[ [ U5R5- n[ U5nUHn[XT[X@55 M g)NrF) _magicsrr. intersectionrFrr;rprre MagicProxy)rT orig_magics these_magics remove_magicsrtrs r'r=MagicMixin._mock_set_magicss 44 " 4$ / ;&33D4F4FGLEM'6M&DJ///D(' $c$t**=*=&>> T !E E*U"9 :"r&rN)r r!r"r#rEr=r%rr&r'r;r;|s  ;r&r;c"\rSrSrSrSSjrSrg)riz-A version of `MagicMock` that isn't callable.cFURX5 UR5 gr=r4r=r>s r'r?"NonCallableMagicMock.mock_add_spec D+ r&rNr)r r!r"r#r$r?r%rr&r'rrs 7 r&rc\rSrSrSrg)AsyncMagicMixinirN)r r!r"r#r%rr&r'rMrMsr&rMcF^\rSrSrSrS SjrSS.S\4U4SjjjrSrU=r $) riah MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself. If you use the `spec` or `spec_set` arguments then *only* magic methods that exist in the spec will be created. Attributes and the return value of a `MagicMock` will also be `MagicMocks`. FcFURX5 UR5 gr=rIr>s r'r?MagicMock.mock_add_specrKr&)rrc>U(a-UR(a[UR5(aSn[5R"USU0UD6 g)NFr)rrsuperr)rTrrUrVr[s r'rMagicMock.reset_mocks= $//** !L DF|FvFr&rr) r r!r"r#r$r?rrr% __classcell__r[s@r'rrs&  9> G G Gr&rc*\rSrSrSrSrSSjrSrg)rBicXlX lgr9rr)rTrrs r'rEMagicProxy.__init__s   r&cURnURnURXUS9n[X!U5 [ X#U5 U$)N)rr"r#)rrrTrer9)rTrtrms r' create_mockMagicProxy.create_mocksG   " "/5 # 7q!&U+r&Nc"UR5$r9)r\)rTr2rs r'rMagicProxy.__get__s!!r&rXr9)r r!r"r#rEr\rr%rr&r'rBrBs"r&rBc^\rSrSr\"S5r\"S5r\"S5rU4SjrSr Sr Sr S r S r S rSS jrS rU4SjrSrU=r$)rirrrc>[5R"U0UD6 [RRUR S'SUR S'SUR S'[ 5UR S'[(a4[[S9n[UR S'[UR S'O [[S9n[R[R-[R-UlSUlS UlSUlSUlX0R S 'S UR S '[)5UR S '0UR S'SUR S'g)Nrr_mock_await_count_mock_await_args_mock_await_args_listr rCrE)rUrVr5r r rcrdr)rRrErrrrpr _CODE_SIGr _CODE_ATTRSrr/ CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountrl)rTrUrV code_mockr[s r'rEAsyncMockMixin.__init__s4 $)&)*1););)I)I o&-. )*,0 ()1: -. 9'=I08I  } -4=I  0 1':I     !$$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(r&c# [X4SS9nU=RS- slX0lURR U5 UR nUbu[ U5(aUe[U5(d[U5n[ U5(aUeO)[U5(aU"U0UD6IShvN nOU"U0UD6nU[LaU$UR[La UR$URbF[UR5(aUR"U0UD6IShvN $UR"U0UD6$UR$![a [ef=fNN87f)NTrr)rrrrrKrr>rir StopIterationStopAsyncIterationrrrrr-)rTrUrVrr;r~s r'r1!AsyncMockMixin._execute_mock_call s^tn$/ A ##E*!!  V$$ v&&-!&\F !(( L)$V,,%t6v6600W$  " "' 1$$ $    '"4#3#344!--t>v>>>##T4V4 4   -%--,-7?s=A3E6 E.E/E0A3E#E$"EEEEclURS:Xa$SUR=(d SS3n[U5eg)z1 Assert that the mock was awaited at least once. r Expected rAz to have been awaited.Nrrrrs r'rAsyncMockMixin.assert_awaited3 s;   q doo788NOC % % !r&cURS:Xd1SUR=(d SSURS3n[U5eg)z0 Assert that the mock was awaited exactly once. rrwrA$ to have been awaited once. Awaited rNrxrs r'r"AsyncMockMixin.assert_awaited_once; sM1$t8&9:#//09C % %%r&c@^^^TRc!TRTT5n[SUS35eUUU4SjnTR[ TT4SS95nTRTR5nXS:wa*[ U[ 5(aUOSn[U"55Ueg)z> Assert that the last await was with the specified arguments. NzExpected await: z Not awaitedc*>TRTTSS9nU$)Nawait)rrrs r'r:AsyncMockMixin.assert_awaited_with.._error_messageL s33D&3QCJr&Tr)rrrrrr,r)rTrUrVrrrrs``` r'r"AsyncMockMixin.assert_awaited_withD s ?? "77fEH #3H:]!KL L %%eT6N&EF##DOO4   *8Y ? ?HTE !12 = r&cURS:Xd1SUR=(d SSURS3n[U5eUR"U0UD6$)zQ Assert that the mock was awaited exactly once and with the specified arguments. rrwrAr{r)rrrrrs r'r'AsyncMockMixin.assert_awaited_once_withV s^ 1$t8&9:#//09C % %''888r&c4UR[X4SS95n[U[5(aUOSnURVs/sHoPRU5PM nnU(dU[ U5;a UR X5n[SU-5Uegs snf)zE Assert the mock has ever been awaited with the specified arguments. TrNz%s await not found)rrr,rrr rrr s r'rAsyncMockMixin.assert_any_awaita s%%eTN&EF&x;;151E1EF1EA$$Q'1EF HL$88">>tLO $6 9Gr c z^UVs/sHnTRU5PM nn[SU5S5n[U4SjTR55nU(dlXF;afUcSnO9SR UVs/sHn[ U[ 5(aUOSPM sn5n[US[U5STR35Ueg[U5n/n UHn URU 5 M U (a[[U 5<S35Uegs snfs snf![a U RU 5 Mbf=f) at Assert the mock has been awaited with the specified calls. The :attr:`await_args_list` list is checked for the awaits. If `any_order` is False (the default) then the awaits must be sequential. There can be extra calls before or after the specified awaits. If `any_order` is True then the awaits can be in any order, but they must all appear in :attr:`await_args_list`. c3T# UHn[U[5(dMUv M g7fr9rrs r'r3AsyncMockMixin.assert_has_awaits..{ rrNc3F># UHnTRU5v M g7fr9rrs r'rr| s!S>Rt11!44>RrzAwaits not found.z,Error processing expected awaits. Errors: {}rz Actual: z not all found in await list) rrrrrr,rrrkrrKrKrl) rTrrrrr all_awaitsrrrrs ` r'r AsyncMockMixin.assert_has_awaitsn s]4995aD&&q)59FFMSd>R>RSS )=1G ,-3V-5$7-5*4Ay)A)AAt$K-5$7.8%i !!*5!1 23#3346  *%  D '!!$'  49)4DF  7:$7 '  & 'sD6#DDD:9D:cURS:wa1SUR=(d SSURS3n[U5eg)z) Assert that the mock was never awaited. rrwrAz# to not have been awaited. Awaited rNrxrs r'r!AsyncMockMixin.assert_not_awaited sM   q t8&9:#//09C % % !r&ct>[5R"U0UD6 SUlSUl[ 5Ulg) See :func:`.Mock.reset_mock()` rN)rRrrrrrrTrUrVr[s r'rAsyncMockMixin.reset_mock s3 D+F+({r&)rrrr)r r!r"r#rrrrrEr1rrrrrrrrr%rTrUs@r'rrs\&}5K%l3J*+<=O0B&!P&&>$ 9 *X&++r&rc\rSrSrSrSrg)r i a Enhance :class:`Mock` with features allowing to mock an async function. The :class:`AsyncMock` object will behave so the object is recognized as an async function, and the result of a call is an awaitable: >>> mock = AsyncMock() >>> iscoroutinefunction(mock) True >>> inspect.isawaitable(mock()) True The result of ``mock()`` is an async function which will have the outcome of ``side_effect`` or ``return_value``: - if ``side_effect`` is a function, the async function will return the result of that function, - if ``side_effect`` is an exception, the async function will raise the exception, - if ``side_effect`` is an iterable, the async function will return the next value of the iterable, however, if the sequence of result is exhausted, ``StopIteration`` is raised immediately, - if ``side_effect`` is not defined, the async function will return the value defined by ``return_value``, hence, by default, the async function returns a new :class:`AsyncMock` object. If the outcome of ``side_effect`` or ``return_value`` is an async function, the mock async function obtained when the mock object is called will be this async function itself (and not an async function returning an async function). The test author can also specify a wrapped object with ``wraps``. In this case, the :class:`Mock` object behavior is the same as with an :class:`.Mock` object: the wrapped object may have methods defined as async function functions. Based on Martin Richard's asynctest project. rNrrr&r'r r s'r&r c*\rSrSrSrSrSrSrSrg)_ANYi z2A helper object that compares equal to everything.cgrrrTrs r'r _ANY.__eq__ sr&cgr#rrs r'r$ _ANY.__ne__ sr&cg)Nzrrs r'r _ANY.__repr__ sr&rN) r r!r"r#r$rr$rr%rr&r'rr s8r&rc :SU-nSnSRUVs/sHn[U5PM sn5nSRUR5VVs/sHupxU<SU<3PM snn5n U(aUnU (aU(aUS- nXI- nX4-$s snfs snnf)Nz%s(%%s)r8z, =)rreprry) rrUrVrformatted_argsr| args_stringrwr kwargs_strings r'rr s$GN))$7$3T#Y$78KII171?:33M$  d "N'  ##8s BB c\rSrSrSrSSjrSSjrSr\Rr Sr Sr S r S r \S 5r\S 5rS rSrSrg)ri as A tuple for holding the results of a call to a mock, either in the form `(args, kwargs)` or `(name, args, kwargs)`. If args or kwargs are empty then a call tuple will compare equal to a tuple without those values. This makes comparisons less verbose:: _Call(('name', (), {})) == ('name',) _Call(('name', (1,), {})) == ('name', (1,)) _Call(((), {'a': 'b'})) == ({'a': 'b'},) The `_Call` object provides a useful shortcut for comparing with call:: _Call(((1, 2), {'a': 3})) == call(1, 2, a=3) _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3) If the _Call has no name then it will match any name. NcSn0n[U5nUS:XaUup&nO{US:Xa9Uup[U [5(aU n[U [5(aU nOBU nO?XpvOUun [ U [ 5(aU n0nOb[ U [5(aU nS0pOGSnU nOBUS:Xa;Uup[ U [5(aU n[ U [ 5(aU 0pOSU pOXpOgU(aXc:wagXx4XE4:H$![a [s$f=f) Nr8rrFrrrr)rrrr.rr,rlr) rTr len_other self_name self_args self_kwargs other_name other_args other_kwargsrrrs r'r _Call.__eq__4 sP "E I t9>%) "I{04 -I+ D.$ / /GE>SW4X4X%%););; >')2 !^38 0JL !^FE%''" ! E3''" +-rL $ !^!ME%%%" fe,,/5r /16 +0L 0)i-EEE_ "! ! "s DD,+D,c~URc [SX4SS9$URS-n[URX4X0S9$)Nr8rRrrXrrrs r'rH_Call.__call__l sB ?? ""d+$7 7%doot44MMr&cjURc [USS9$UR<SU<3n[X SS9$)NF)rrrr)rrrr)rTrrs r'r_Call.__getattr__t s4 ?? "de4 4//40$u==r&c`U[R;a[e[RX5$r9)rlrprI__getattribute__)rTrs r'r_Call.__getattribute__{ s% 5>> ! %%d11r&c>[U5S:XaUupX4$Uup1nX4$)Nr)rrs r'_get_call_arguments_Call._get_call_arguments s2 t9>LD|"& D|r&c(UR5S$Nrrrs r'rU _Call.args '')!,,r&c(UR5S$)Nrrrs r'rV _Call.kwargs rr&c,UR(d2UR=(d SnURS5(aSU-nU$[U5S:XaSnUup#O0UupnU(dSnO!URS5(dSU-nOSU-n[ XU5$)NrrRzcall%srzcall.%s)rrrrr)rTrrUrVs r'r_Call.__repr__ s##??,fDt$$$K t9>DLD&!% D__T** 4'$%d&99r&c/nUnUb3UR(aURU5 URnUbM3[[ U55$)zFor a call object that represents multiple calls, `call_list` returns a list of all the intermediate calls as well as the final call.)rrKrrr)rTvalsthings r' call_list_Call.call_list sM$$ E"&&E$((r&)rrr)rr8NFT)rNNFT)r r!r"r#r$rrErrr$rHrrrrrUrVrrr%rr&r'rr s|$:?8@>C)2Fj]]FN>2 ----:* )r&r)rc [U5(a [U5n[U[5n[U5(a[ SU<S35e[ U5nSU0n U(aSU0n OUc0n U (a U(aSU S'U(d [ U5 URSU5nUn UcS n U RU5 [n [R"U5(a0n O[U(aU(a [S 5e[n O;[U5(d[n O$U(aU(a[!U5(d[n U "SX3U US .U D6n [U["5(aU(a [%X5n O['X5n O [)X Xr5 UbU(dXR*U'URS S5n U(aU(dS U;a[-XSSU U S9U l[1U5GH0n[3U5(aM[5X5nSU0nU (a[9X5(aURUS9 U(aSU0n[U["5(d[;XXU5nUU R*U'OU n[U["5(a U R<n[?XU5nUUS'[AU5(a[nO[nU"SUXUS.UD6nUU R*U'U"5Ul[)UUUS9 [U["5(dGM$[CXU5 GM3 [U 5(aU(aU RD"S0UD6 U $![6a GMnf=f)aCreate a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the `spec` object as their spec. Functions or methods being mocked will have their arguments checked to check that they are called with the correct signature. If `spec_set` is True then attempting to set attributes that don't exist on the spec object will raise an `AttributeError`. If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by passing `instance=True`. The returned mock will only be callable if instances of the mock are callable. `create_autospec` will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock.z'Cannot autospec a Mock object. [object=rBrr NTr$rr8zJInstance can not be True when create_autospec is mocking an async function)rr#r"rrrrR)r_rr rrr%)rrr"r#)r^r)#rmr;r,r+rr7rFr{rirr/isdatadescriptorrBr rirrsrBrrr`rr rrHrr.rIr-rkrA _must_skiprrer5)rr r_r rr&rVis_type is_async_funcrr"rrAwrappedrtr} child_kwargsr)rr^ child_klasss r'r r s(.~~Dzt$G"**. 45 5"4(MtnGt$ 8'+#$ f% JJvu %EI  NN6 E%%   >? ? t__$ X&8&>&>$  (  (& (D$ && '3D!$-DW78(,u%jj$'GxN&$@+DT2629;T U    t+H) ww..   h  / &1L(M22XhGC),D   &F$ .."48I(1L %"8,,' ' BV%*0B4@BC),D   &*}C  Xsi @ c= ) ) D %gn6 %f% KU   s8 M MMcT[U[5(dU[US05;agURnURHdnUR R U[5nU[LaM.[U[[45(a g[U[5(aUs $ g U$)zO Return whether we should skip the first argument on spec's `entry` attribute. rpF) r,r;r.r[rorprqrrGrFrB)rrtrrr~s r'rrM s dD ! ! GD*b1 1~~##E73 W   f|[9 : :  . .N Nr&c"\rSrSrSSjrSrg)rkii NcLXlXPlX lX0lX`lX@lgr9)ridsr rr_r)rTrr rrrr_s r'rE_SpecState.__init__k s      r&)rr_rrrr )FNNNF)r r!r"r#rEr%rr&r'rkrki s 48/4r&rkc[U[5(a[R"U5$[R"U5$r9)r,bytesioBytesIOStringIO) read_datas r' _to_streamr s-)U##zz)$${{9%%r&c ^^ ^ ^ ^ [T5nUS/m U U 4SjnU U 4SjnU U 4Sjm U U 4Sjm U U 4SjnU 4Sjn[cVSSKn[[ [ UR 55R[ [ UR5555q[c+SSKn[[ [ UR555q Uc[S [S 9n[[S 9m T T Rl ST Rl ST Rl ST R l ST R"l UT RlT "5T S 'T S T R lUT R"lT T R&lUT R(lUT R*lU U U U4S jnXlT Ul U$)a A helper function to create a mock to replace the use of `open`. It works for `open` called directly or used as a context manager. The `mock` argument is the mock object to configure. If `None` (the default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. `read_data` is a string for the `read`, `readline` and `readlines` of the file handle to return. This is an empty string by default. Nc>TRRbTRR$TSR"U0UD6$r) readlinesrrUrV_statehandles r'_readlines_side_effect)mock_open.._readlines_side_effect sA    ( ( 4##00 0ay""D3F33r&c>TRRbTRR$TSR"U0UD6$r)readrrs r'_read_side_effect$mock_open.._read_side_effect s; ;; # # /;;++ +ay~~t.v..r&c?b># T"5ShvN TSR"U0UD6v MN7fr)readline)rUrV_iter_side_effectrs r'_readline_side_effect(mock_open.._readline_side_effect s9$&&&)$$d5f5 5 's /-/c3># TRRbTRRv MTSHnUv M g7fr)rr)linerrs r'r$mock_open.._iter_side_effect sA ?? ' ' 3oo2221IDJsAAcz>TRRbTRR$[TS5$r)rrr)rrsr'_next_side_effect$mock_open.._next_side_effect s1 ?? ' ' 3??// /F1Ir&c&>TR5 gr9)close)exctypeexcinstexctbrs r'_exit_side_effect$mock_open.._exit_side_effect s  r&ropen)rr)rrc>[T5TS'TRRTS:XaT"5TS'TSTRl[$)Nrr)rrrr)rUrVrrrrs r' reset_datamock_open..reset_data sHy)q ?? & &&) 3-/F1I*0)FOO 'r&)r file_spec_iorkrrH TextIOWrapperunionr open_specrrrrwriterrrrr)rr) rAr _read_datarrrrrrrrrrs ` @@@@r'rr skI&J$ F4 / 6  S!2!234::3s3;;?O;PQR S]+,  |f95 I &F$*F! $FLL#FKK#'FOO $(F!/FKK%'F1I"()FOO#9F "3FOO"3FOO"3FOO"D Kr&c.\rSrSrSrSrSSjrSrSrg) ri a? A mock intended to be used as a property, or other descriptor, on a class. `PropertyMock` provides `__get__` and `__set__` methods so you can specify a return value when it is fetched. Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. c [S0UD6$)Nr)r)rTrVs r'rTPropertyMock._get_child_mock s"6""r&NcU"5$r9r)rTr2obj_types r'rPropertyMock.__get__ s v r&cU"U5 gr9r)rTr2r}s r'rPropertyMock.__set__ s  S r&rr9) r r!r"r#r$rTrrr%rr&r'rr s#r&rcr^\rSrSrSrU4Sjr\S.U4SjjrU4SjrSr U4Sjr \S.S jr S r S r U=r$) ThreadingMixini Nc >[URS5[5(aUSRUS'O6[URS5[5(aUSRUS'[ 5R "S0UD6$)Nrtimeoutr#r)r,rqr_mock_wait_timeoutrRrT)rTrr[s r'rTThreadingMixin._get_child_mock sl bffX& 7 7xL;;ByM }-~ > >}-@@ByMw&&,,,r&rc&>[5R"U0UD6 U[La URn[R "5UR S'/UR S'[R"5UR S'XR S'g)N _mock_event_mock_calls_events_mock_calls_events_lockr)rRrE_timeout_unsetDEFAULT_TIMEOUT threadingEventrpLock)rTrrUrVr[s r'rEThreadingMixin.__init__ sr $)&) n $**G'0'8 m$.0 *+3<>>3C /0.5 *+r&c>[5R"U0UD6 [R"5URS'/URS'g)rrrN)rRrr!r"rprs r'rThreadingMixin.reset_mock s> D+F+'0'8 m$.0 *+r&cUR URHup4nX44X4:XdMUs sSSS5 $ [R"5nURR XU45 SSS5 U$!,(df  W$=fr9)rrr!r"rK)rT expected_argsexpected_kwargsrUrVevent new_events r' __get_eventThreadingMixin.__get_event s}  ) )'+'>'>#e>m%EE L* )'>")I  # # * *MI+V W *  * ) sA5A54A55 Bc>[5R"U0UD6nURX5nUR5 URR5 U$r9)rRr._ThreadingMixin__get_eventrr)rTrUrV ret_value call_eventr[s r'r.ThreadingMixin._mock_call sLG&&77 %%d3  r&cU[La URnURRUS9(d&UR=(d SSUS3n[ U5eg)zWait until the mock object is called. `timeout` - time to wait for in seconds, waits forever otherwise. Defaults to the constructor provided timeout. Use None to block undefinetively. rrAz was not called before timeout(z).N)rrrwaitrr)rTrrs r'wait_until_called ThreadingMixin.wait_until_called! s` n $--G$$W$5oo/01&ir+C % %6r&cURX5nURURS9(dURX5n[ US35eg)zuWait until the mock object is called with given args. Waits for the timeout in seconds provided in the constructor. rz call not foundN)r/r4rrr)rTrUrVr*rs r'wait_until_any_call_with'ThreadingMixin.wait_until_any_call_with/ sP   .zz$"9"9z:">>tLO O#4O!DE E;r&r)r r!r"r#r rTrrErr/r.r5r8r%rTrUs@r'rr sAO-'5661,: &FFr&rc\rSrSrSrSrg)r i: ae A mock that can be used to wait until on calls happening in a different thread. The constructor can take a `timeout` argument which controls the timeout in seconds for all `wait` calls of the mock. You can change the default timeout of all instances via the `ThreadingMock.DEFAULT_TIMEOUT` attribute. If no timeout is set, it will block undefinetively. rNrrr&r'r r : s   r&r c6SUl[U5Hrn[X5n[ U[ 5(dM&[ UR RU5[5(aMVURULdMg[U5 Mt g![a Mf=f)aDisable the automatic generation of child mocks. Given an input Mock, seals it to ensure no further mocks will be generated when accessing an attribute that was not already defined. The operation recursively seals the mock passed in, meaning that the mock itself, any mocks generated by accessing one of its attributes, and all assigned mocks without a name or spec will be sealed. TN) r,rHr.rIr,r rrqrkrr)rArr[s r'rrJ sDD  #A!_--  a&&**40* = =    % G   s B  BBc$\rSrSrSrSrSrSrg)r/ib z0 Wraps an iterator in an asynchronous iterator. cpXl[[S9n[RUlX R S'g)Nrer5)iteratorr rr/CO_ITERABLE_COROUTINErkrp)rTr>rps r'rE_AsyncIterator.__init__f s+ #X6 $:: $- j!r&c`# [UR5$![a [ef=f7fr9)rr>rsrtrs r'r_AsyncIterator.__anext__l s0  & &     s.. +.+.)r>N)r r!r"r#r$rErr%rr&r'r/r/b s. !r&r/rr)NFNNN)FFNN)Nr8)__all__rrerr/rrbuiltinsrrr!typesrrr unittest.utilr functoolsrrrrrrHrrr rRrr3r7r+r>rCrOr`r[rirmrsrrr|rrrrrrrMISSINGrDELETEDrlrrrkrr r rr frozenset removeprefixrr rdrrrFrHrrrrrrrrmultiplestopallra magic_methodsnumericsrrzinplaceright _non_defaultsrr@r_sync_async_magics _async_magicsrrrr4rr3r r&r,r1r5r9r;rrMrrBrJrErfrgrKrr rrrrlrrr rrkr;rrBrr rrr TIMEOUT_UNSETrrr rr/)rrs00r'rVsJ (  '22#$CyC"(m Hmd??33GTm H   @2  F # & 4.."b>6) )f )   ;          &**(6  6 ^ 9d^ 9DO$$ y!!Di $ 4  m!Dm!b8=/8zY/VY/z < 'Ttd&+:?C04.d$u4OCHOdV/&V/r       "K  ((7hnn&67 7 5HNN$455  HHmXw 67==? ?!Hv?  @!]$'99 ]*. 306^ " 1$;;>  :   j G DGB""$!!'(*;*;T"BCIh-K E+TE+P((V 6  f$$v)Ev)r uCGT*/Tn8        &Sl4$''EFTEFP  NJ  0!!ga IH!x dIs0 P=PP !P P+PP P PK! m,__pycache__/async_case.cpython-313.opt-1.pycnu[ LiJSSKrSSKrSSKrSSKrSSKJr Sr"SS\5rg)N)TestCaseTc^\rSrSrSrSU4SjjrSrSrSrSr Sr S r S r S r S rS rSrSrSU4SjjrU4SjrSrSrU=r$)IsolatedAsyncioTestCase Ncf>[TU]U5 SUl[R"5UlgN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s :/opt/alt/python313/lib64/python3.13/unittest/async_case.pyr IsolatedAsyncioTestCase.__init__'s) $"#.#;#;#= c # g7fr rs r asyncSetUp"IsolatedAsyncioTestCase.asyncSetUp, c # g7fr rrs r asyncTearDown%IsolatedAsyncioTestCase.asyncTearDown/rrc0UR"U/UQ70UD6 gr ) addCleanuprfuncargskwargss raddAsyncCleanup'IsolatedAsyncioTestCase.addAsyncCleanup2s $1&1rc # [U5nURnURnU"U5IShvN nURXASSS5 U$![a( [ SUR SUR S35Sef=fNO7f)zEnters the supplied asynchronous context manager. If successful, also adds its __aexit__ method as a cleanup function and returns the result of the __aenter__ method. '.zC' object does not support the asynchronous context manager protocolN)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r&)rcmclsenterexitresults renterAsyncContext)IsolatedAsyncioTestCase.enterAsyncContextAs2h 'NNE==D Ry TtT48  'a/q1A1A0BCTU"& ' '!s% BA BBB 2A??BcURR5 URRUR5 UR UR 5 gr )r get_looprrunsetUp _callAsyncrrs r _callSetUp"IsolatedAsyncioTestCase._callSetUpUs> $$&   $$TZZ0 (rcfURU5b[R"SUS3[SS9 gg)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethod'IsolatedAsyncioTestCase._callTestMethod]s<    ' 3 MM((.xq23ERS U 4rcURUR5 URRUR5 gr )r=rrr;tearDownrs r _callTearDown%IsolatedAsyncioTestCase._callTearDownbs, **+   $$T]]3rc0UR"U/UQ70UD6 gr )rD)rfunctionr$r%s r _callCleanup$IsolatedAsyncioTestCase._callCleanupfs X777rcVURRU"U0UD6URS9$N)context)r r;rr"s rr="IsolatedAsyncioTestCase._callAsyncis8""&& $ !& !,,'  rc[R"U5(a*URRU"U0UD6URS9$URR"U/UQ70UD6$rT)inspectiscoroutinefunctionr r;rr"s rrD'IsolatedAsyncioTestCase._callMaybeAsyncqsj  & &t , ,&&**d%f%00+  ++//FtFvF FrcN[R"SURS9nXlg)NT)debug loop_factory)asyncioRunnerr]r rrunners r_setupAsyncioRunner+IsolatedAsyncioTestCase._setupAsyncioRunner{sd9J9JK$rc<URnUR5 gr )r closer`s r_tearDownAsyncioRunner.IsolatedAsyncioTestCase._tearDownAsyncioRunners$$ rc>UR5 [TU] U5UR5 $!UR5 f=fr )rbr r;rf)rr6rs rr;IsolatedAsyncioTestCase.runs9   " *7;v&  ' ' )D ' ' )s 2Acb>UR5 [TU] 5 UR5 gr )rbr r\rf)rrs rr\IsolatedAsyncioTestCase.debugs$   "   ##%rc@URbUR5 ggr )r rfrs r__del__IsolatedAsyncioTestCase.__del__s    *  ' ' ) +r)r r)runTestr )__name__r0r1__firstlineno__r]r rrr&r7r>rIrMrQr=rDrbrfr;r\rm__static_attributes__ __classcell__)rs@rrr sa6L>    2()U 48 G% *& **rr)r^r rXrEcaser __unittestrrrrrvs'  H*hH*rPK!ޞS,W,W"__pycache__/loader.cpython-313.pycnu[ LiKSrSSKrSSKrSSKrSSKrSSKrSSKrSSKJrJr SSK J r J r J r Sr \R"S\R5r"SS \ R"5rS rS rS rS rSr"SS\5r\"5rg)zLoading unittests.N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c8^\rSrSrSrU4SjrU4SjrSrU=r$) _FailedTestNc8>X l[[U]U5 gN) _exceptionsuperr __init__)self method_name exception __class__s 6/opt/alt/python313/lib64/python3.13/unittest/loader.pyr_FailedTest.__init__s# k4)+6c\>^UTR:wa[[T]U5$U4SjnU$)Nc>TRer rrsr testFailure,_FailedTest.__getattr__..testFailure s // !r)_testMethodNamerr __getattr__)rnamerrs` rr_FailedTest.__getattr__s. 4'' 'd7= = "rr) __name__ __module__ __qualname____firstlineno__rrr__static_attributes__ __classcell__rs@rr r sO7rr chSU<S[R"5<3n[U[U5X5$)NzFailed to import test module:  ) traceback format_exc_make_failed_test ImportError)r suiteClassmessages r_make_failed_import_testr1%s+ i""$&G T;w#7 MMrcLS[R"5<3n[XX#5$)NzFailed to call load_tests: )r+r,r-)r rr/r0s r_make_failed_load_testsr3*s%2;2F2F2HJG   ..rc.[X5nU"U45U4$r )r ) methodnamerr/r0tests rr-r-/s z -D tg  ''rc[R"[U55S5nX0n[S[R4U5nU"U"U545$)Ncgr rs r testSkipped'_make_skipped_test..testSkipped4s r ModuleSkipped)rskipstrtypeTestCase)r5rr/r:attrs TestClasss r_make_skipped_testrC3sQ YYs9~   %E_t}}&6>I y,. //rcF[RRU5S$)Nr)ospathsplitext)rFs r _splitextrH;s 77  D !! $$rc^\rSrSrSrSr\"\R5r Sr \ Rr SrU4SjrSrSS.SjrSS jrSS jrS rSS jrS rSrSrSrSrSrSrU=r$) TestLoader?zu This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite r6NcV>[[U] 5 /Ul[ 5Ulgr )rrJrerrorsset_loading_packages)rrs rrTestLoader.__init__Js# j$(* "%rc4[U[R5(a [S5eU[R [R 4;a/nO,URU5nU(d[US5(aS/nUR[X55nU$)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 TypeErrorrr@FunctionTestCasegetTestCaseNameshasattrr/map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCase TestLoader.loadTestsFromTestCaseQs mU__ 5 5() ) T]]D,A,AB BM 11-@M W]I%F%F!* s='HI rpatterncB/n[U5Hn[X5n[U[5(dM%[ U[ R 5(dMFU[ R [ R4;dMlURURU55 M [USS5nURU5nUb U"XU5$U$![aIn[URXpR5upURRU 5 UsSnA$SnAff=f)z>Return a suite of all test cases contained in the given module load_testsN)dirgetattr isinstancer?rSrr@rVappendr]r/ Exceptionr3r"rM) rmoduler`testsr objrbe error_case error_messages rloadTestsFromModuleTestLoader.loadTestsFromModuleasKD&'C3%%sDMM22 t/D/DEE T77<= V\48 &  ! "!$w77   ",COOQ-9)  ""=1!!  "sC D>DDDc URS5nSupEUc/USSnU(aSRU5n[U5nUSSnUn UHn U [X5pM [U [R 5(aUR#U 5$[U [$5(aT['U [(R*5(a5U [(R*[(R,4;aUR/U 5$[U [R05(a|[W [$5(ag['U [(R*5(aHUSnU "U5n [[X5[R05(dUR U /5$O![U [2R45(aU $[7U 5(amU "5n[U[2R45(aU$[U[(R*5(aUR U/5$[9SU <S U<S 35e[9S U -5e![aP UR 5n[ XR 5upEU(dURRU5 Us$Of=fU(aGMGNf![an [U SS5b'Ub$URRU5 UsSn A s $[XUR S[R"5<35upEURRU5 UsSn A s $Sn A ff=f) a+Return 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.popr1r/rMrfrdAttributeErrorr-r+r,retypes ModuleTypernr?rSrr@rVr] FunctionTyperrTcallablerU)rr rhpartsrlrm parts_copy module_namenext_attributerjpartparentrkinstr6s rloadTestsFromNameTestLoader.loadTestsFromNameys 3$.! >qJ *"%((:"6K' 4F!"IED &!73#5. c5++ , ,++C0 0 sD ! !3 ..DMM4+@+@AA--c2 2e0011&&//9D$". KK&&}5%%1B%002516-JKK&&}5%%% &s=I J)AJJ) M3-L< M(A L<4M<McnUVs/sHo0RX25PM nnURU5$s snf)zqReturn a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. )rr/)rnamesrhr suitess rloadTestsFromNamesTestLoader.loadTestsFromNamess8DII54((65Iv&&Js2c^^UU4Sjn[[U[T555nTR(a-UR [ R "TR5S9 U$)zLReturn a sorted sequence of method names found within testCaseClass c">^URTR5(dg[TU5n[U5(dgSTRTR U4-mTR SL=(d [U4SjTR 55$)NFz%s.%s.%sc3<># UHn[TU5v M g7fr )r).0r`fullNames r KTestLoader.getTestCaseNames..shouldIncludeMethod..sXBWwK'22BWs) startswithtestMethodPrefixrdr|r#r$testNamePatternsany)attrnametestFuncrrrZs @rshouldIncludeMethod8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<'<==}h7HH%%!((-*D*Dh&H((D0YX$BWBWXX Yr)key)listfilterrcsortTestMethodsUsingsort functools cmp_to_key)rrZr testFnNamess`` rrWTestLoader.getTestCaseNamessS Y6"5s=7IJK  $ $   !5!5d6O6O!P  QrcURnSnUcURb URnOUcSnUn[RRU5nU[R;a [RR SU5 X0lSn[RR [RRU55(ag[RRU5nX:waB[RR[RRUS55(+nO[U5 [RUnURS5Sn[RR[RRUR55nU(a5UR%U5Ul[RR'U5 U(a[)S U-5e[+UR-X55n X@lUR/U 5$![a; UR[R ;a [#S5Se[#SU<35Sef=f![(a SnNf=f) 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__.pyrqz2Can not use builtin modules as dotted module namesz don't know how to discover from z%Start directory is not importable: %r)_top_level_dirrErFabspathsysinsertisdirisfilerurvmodulesrtdirname__file__rxr"builtin_module_namesrU _get_directory_containing_moduleremover.r _find_testsr/) r start_dirr` top_level_diroriginal_top_level_dirset_implicit_topis_not_importable the_moduletop_partris rdiscoverTestLoader.discovers8"&!4!4   T%8%8%D //M  "# %M 6 ( HHOOA} -+! 77==3 4 4 2I)(*rww||I}7](^$^! 39%![[3 $??3/2 ( ")<)<>!@I$*.*O*OPX*YD'HHOOM2 E QR RT%%i9:4u%%'&(!**c.F.FF')ABGKL(>znM#'( ( )$(! )s 7 I:*AH22AI7: J J c[RUn[RR UR 5n[RR U5R5RS5(a<[RR[RRU55$[RRU5$)Nr) rrrErFrrbasenamelowerrr)rrrh full_paths rr+TestLoader._get_directory_containing_module:s[)GGOOFOO4 77  I & , , . 9 9- H H77??277??9#=> > 77??9- -rcXR:Xag[[RR U55n[RR XR5n[RR U5(aS5eURS5(aS5eUR[RRS5nU$)NrqzPath must be within the projectz..) rrHrErFnormpathrelpathisabsrreplacesep)rrF_relpathr s r_get_name_from_pathTestLoader._get_name_from_pathFs && &))$/077??4)<)<=77==**M,MM*&&t,,O.OO, S1 rc>[U5 [RU$r )rvrr)rr s r_get_module_from_name TestLoader._get_module_from_nameRs4{{4  rc[X5$r )r)rrFrr`s r _match_pathTestLoader._match_pathVs t%%rc#v# URU5nUS:wa1X0R;a"URX5upEUbUv U(dg[[R "U55nUHn[R RX5nURX5upEUbUv U(dMEURU5nURRU5 URX5ShvN URRU5 M gN$!URRU5 f=f7f)z/Used by discovery. Yields test suites it loads.rqN) rrO_find_test_pathsortedrElistdirrFruaddrdiscard) rrr`r rishould_recursepathsrFrs rrTestLoader._find_testsZs'' 2 3;4'='==%)$8$8$L !E  !rzz),-D Y5I$($8$8$L !E  ~// :&&**409#// CCC**2248D**2248s6B+D91,D9D2D3D7 D9DD66D9c[RRU5n[RRU5(Gaz[R U5(dgUR X1U5(dgURU5nURU5n[RR[USU55n[[RRU55n[[RRU55nUR5UR5:waw[RRU5n [[RRU55n [RRU5n Sn [XX4-5eUR!XRS9S4$[RR1U5(a[RR[RR3US55(dgSnSnURU5nURU5n[USS5nUR4R7U5 UR!UUS9nUbUS4UR4R9U5 $US 4UR4R9U5 $g!["R$a"n ['XMUR(5S4sSn A $Sn A f [+X@R(5upUR,R/U5 US4s$=f!UR4R9U5 f=f!["R$a"n ['XMUR(5S4sSn A $Sn A f [+X@R(5upUR,R/U5 US4s$=f) 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?r_FNrrbT)rErFrrVALID_MODULE_NAMEmatchrrrrrdrHrealpathrrr.rnrSkipTestrCr/r1rMrfrrurOrr)rrr`rr rhmod_filerfullpath_noext module_dirmod_name expected_dirmsgrkrlrmrbripackages rrTestLoader._find_test_pathzs 77##I. 77>>) $ $$**844"##HAA"++I6D P33D977??FJ :<$GG$$X.0!*GG$$Y/"1>>#~';';'==!#!:J(((3 5H#%77??9#=LDC%BBDD///H%OO WW]]9 % %77>>"'',,y-"HII"JE++I6D 944T:%WlDA &&**409 44Wg4NE!-$e|**2248!$;**2248k== K)$4??CUJJ ),T??C*  ""=1!5((Z**2248%== K)$4??CUJJ ),T??C*  ""=1!5((sN K<M6L9(L9L6K93L69;L69MO-N O ;O)rOrrMr )ztest*.pyN)r"r#r$r%__doc__r staticmethodr three_way_cmprrrrTr/rrr]rnrrrWrrrrrrrr&r'r(s@rrJrJ?s'(:(:;JN' 6:0PJd'&S&j . !&9@HHrrJ)rrErerr+ryrrrrrr __unittestcompile IGNORECASErr@r r1r3r-rCrHobjectrJdefaultTestLoaderr9rrrs  (  JJ0"--@ $-- N . (0%CCL LrPK!22"__pycache__/result.cpython-313.pycnu[ Li#`SrSSKrSSKrSSKrSSKJr SSKJr SrSr Sr S r "S S \ 5r g) zTest result objectN)utilwrapsTc0^[T5U4Sj5nU$)Nc`>[USS5(aUR5 T"U/UQ70UD6$)NfailfastF)getattrstop)selfargskwmethods 6/opt/alt/python313/lib64/python3.13/unittest/result.pyinnerfailfast..inner s0 4U + + IIKd(T(R((r)rrs` rr r s  6])) Lrz Stdout: %sz Stderr: %sc\rSrSrSrSrSrSrSSjrSr Sr Sr S r S r S rS r\S 5r\S5rSrSrSrSr\S5rSrSrSrSrSrSrSrSrSr g) TestResultaHolder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. NFcSUl/Ul/UlSUl/Ul/Ul/Ul/UlSUlSUl SUl SUl SUl [RUl[R UlSUlg)NFr)r failureserrorstestsRunskippedexpectedFailuresunexpectedSuccessescollectedDurations shouldStopbuffer tb_locals_stdout_buffer_stderr_buffersysstdout_original_stdoutstderr_original_stderr _mirrorOutput)r stream descriptions verbositys r__init__TestResult.__init__&s     "#% "$ "" #  # "rcg)z#Called by TestRunner after test runNr s r printErrorsTestResult.printErrors8rc\U=RS- slSUlUR5 g)z-Called when the given test is about to be runrFN)rr) _setupStdoutr tests r startTestTestResult.startTest;s$  " rcUR(alURc4[R"5Ul[R"5UlUR[ lUR[ lgg)N)r r#ioStringIOr"r$r%r'r1s rr6TestResult._setupStdoutAsP ;;""*&(kkm#&(kkm#,,CJ,,CJ rcg)z`Called once before any tests are executed. See startTest for a method called before each test. Nr0r1s r startTestRunTestResult.startTestRunIr4rc2UR5 SUlg)z'Called when the given test has been runFN)_restoreStdoutr)r7s rstopTestTestResult.stopTestOs "rcUR(GajUR(a[RR 5n[R R 5nU(a=UR S5(dUS- nURR[U-5 U(a=UR S5(dUS- nURR[U-5 UR[lUR[lURRS5 URR5 URRS5 URR5 gg)N r)r r)r$r%getvaluer'endswithr&write STDOUT_LINEr( STDERR_LINEr"seektruncater#)r outputerrors rrCTestResult._restoreStdoutTs  ;;;!!,,. ++-!??400$))// f0DE >>$// ))// e0CD..CJ..CJ    $ $Q '    ( ( *    $ $Q '    ( ( *% rcg)z]Called once after all tests are executed. See stopTest for a method called after each test. Nr0r1s r stopTestRunTestResult.stopTestRunir4rchURRXRX!545 SUlg)z]Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). TN)rappend_exc_info_to_stringr)r r8errs raddErrorTestResult.addErroros, D":":3"EFG!rchURRXRX!545 SUlg)z\Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().TN)rrVrWr)rXs r addFailureTestResult.addFailurews, d$<$Converts a sys.exc_info()-style tuple of values into a string.T)capture_localscompactrG)_clean_tracebacks tracebackTracebackExceptionr!listformatr r$r%rHr'rIrVrKrLjoin) r rYr8exctypevaluetbtb_emsgLinesrOrPs rrWTestResult._exc_info_to_strings   # #GB =++ B>>49 & ;;ZZ((*FJJ'')Et,,dNF f 45~~d++TME e 34wwx  rc\SnSnXU4/n[U51nU(GaUR5upnU(aAURU5(a+URnU(aURU5(aM+XRLaUR U5 U(aUnSnOX2lUbuURUR4HYn U cM[U 5U;dMUR[U 5XR 45 UR[U 55 M[ U(aGMU$)NTF) idpop_is_relevant_tb_leveltb_nextra_remove_unittest_tb_frames __traceback__ __cause__ __context__rVtypeadd) r rrrr8retfirstexcsseencs rrTestResult._clean_tracebackss$%5 {#'88: WR33B77ZZ33B77/////3&(# //5+<+<=A}Ad): T!Wa$ABA>#d* rc4SURR;$)N __unittest)tb_frame f_globals)r rs rr TestResult._is_relevant_tb_levelsr{{4444rcSnU(aCURU5(d-UnURnU(aURU5(dM-UbSUlgg)zTruncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified. N)rr)r rprevs rr%TestResult._remove_unittest_tb_framessS33B77DB33B77  DL rcS[R"UR5UR[ UR 5[ UR 54-$)Nz!<%s run=%i errors=%i failures=%i>)rstrclass __class__rryrrr1s r__repr__TestResult.__repr__sA3 dnn-t}}c$++>NDMM"$$ %r)r)r(r&r#r"r rrrr rrrr!rr)NNN)!__name__ __module__ __qualname____firstlineno____doc___previousTestClass_testRunEntered_moduleSetUpFailedr-r2r9r6r@rDrCrSr rZr]rcrfrjrmrprvrzr rWrrrr__static_attributes__r0rrrrs O#$. - # +* """" &" ,9 .. A6!,85  %rr)rr<r$rrr functoolsrrr rKrLobjectrr0rrrs;     h%h%rPK!ص__)__pycache__/signals.cpython-313.opt-2.pycnu[ Lic |SSKrSSKrSSKJr Sr"SS\5r\R"5rSr Sr Sq Sr S S jr g) N)wrapsTc \rSrSrSrSrSrg)_InterruptHandler cSUlXl[U[5(aHU[R :Xa[R nO#U[R:XaSnO [S5eXl g)NFcgN) unused_signum unused_frames 7/opt/alt/python313/lib64/python3.13/unittest/signals.pydefault_handler3_InterruptHandler.__init__..default_handlerszYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr)selfrs r __init___InterruptHandler.__init__ s` / os + +&..0"("<"< FNN2 !233 /rc[R"[R5nX0LaURX5 UR(aURX5 SUl[ R 5HnUR5 M g)NT)r getsignalSIGINTrr_resultskeysstop)rsignumframeinstalled_handlerresults r __call___InterruptHandler.__call__sb",,V]];  (   / ;;   / mmoF KKM&r)rrrN)__name__ __module__ __qualname____firstlineno__rr'__static_attributes__r rr rr s /$ rrcS[U'g)N)r r&s r registerResultr1*s HVrc@[[RUS55$r )boolr popr0s r removeResultr5-s  VT* ++rc[cY[R"[R5n[ U5q[R"[R[5 ggr )_interrupt_handlerrrrr)rs r installHandlerr81s?! **6==9.? fmm%78"rc^Tb[T5U4Sj5nU$[b4[R"[R[R5 gg)Nc>[R"[R5n[5 T"U0UD6[R"[RU5 $![R"[RU5 f=fr )rrr removeHandler)argskwargsinitialmethods r innerremoveHandler..inner;sS&&v}}5G O 6t.v. fmmW5 fmmW5s A'B)rr7rrr)r?r@s` r r;r;9sL  v 6  6 % fmm%7%H%HI&rr )rweakref functoolsr __unittestobjectrWeakKeyDictionaryr r1r5r7r8r;r rr rGsM   @  $ $ &,9JrPK!NVV,__pycache__/async_case.cpython-313.opt-2.pycnu[ LiJSSKrSSKrSSKrSSKrSSKJr Sr"SS\5rg)N)TestCaseTc^\rSrSrSrSU4SjjrSrSrSrSr Sr S r S r S r S rS rSrSrSU4SjjrU4SjrSrSrU=r$)IsolatedAsyncioTestCase Ncf>[TU]U5 SUl[R"5UlgN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s :/opt/alt/python313/lib64/python3.13/unittest/async_case.pyr IsolatedAsyncioTestCase.__init__'s) $"#.#;#;#= c # g7fr rs r asyncSetUp"IsolatedAsyncioTestCase.asyncSetUp, c # g7fr rrs r asyncTearDown%IsolatedAsyncioTestCase.asyncTearDown/rrc0UR"U/UQ70UD6 gr ) addCleanuprfuncargskwargss raddAsyncCleanup'IsolatedAsyncioTestCase.addAsyncCleanup2s $1&1rc # [U5nURnURnU"U5IShvN nURXASSS5 U$![a( [ SUR SUR S35Sef=fNO7f)N'.zC' object does not support the asynchronous context manager protocol)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r&)rcmclsenterexitresults renterAsyncContext)IsolatedAsyncioTestCase.enterAsyncContextAs2h 'NNE==D Ry TtT48  'a/q1A1A0BCTU"& ' '!s% BA BBB 2A??BcURR5 URRUR5 UR UR 5 gr )r get_looprrunsetUp _callAsyncrrs r _callSetUp"IsolatedAsyncioTestCase._callSetUpUs> $$&   $$TZZ0 (rcfURU5b[R"SUS3[SS9 gg)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethod'IsolatedAsyncioTestCase._callTestMethod]s<    ' 3 MM((.xq23ERS U 4rcURUR5 URRUR5 gr )r=rrr;tearDownrs r _callTearDown%IsolatedAsyncioTestCase._callTearDownbs, **+   $$T]]3rc0UR"U/UQ70UD6 gr )rD)rfunctionr$r%s r _callCleanup$IsolatedAsyncioTestCase._callCleanupfs X777rcVURRU"U0UD6URS9$N)context)r r;rr"s rr="IsolatedAsyncioTestCase._callAsyncis8""&& $ !& !,,'  rc[R"U5(a*URRU"U0UD6URS9$URR"U/UQ70UD6$rT)inspectiscoroutinefunctionr r;rr"s rrD'IsolatedAsyncioTestCase._callMaybeAsyncqsj  & &t , ,&&**d%f%00+  ++//FtFvF FrcN[R"SURS9nXlg)NT)debug loop_factory)asyncioRunnerr]r rrunners r_setupAsyncioRunner+IsolatedAsyncioTestCase._setupAsyncioRunner{sd9J9JK$rc<URnUR5 gr )r closer`s r_tearDownAsyncioRunner.IsolatedAsyncioTestCase._tearDownAsyncioRunners$$ rc>UR5 [TU] U5UR5 $!UR5 f=fr )rbr r;rf)rr6rs rr;IsolatedAsyncioTestCase.runs9   " *7;v&  ' ' )D ' ' )s 2Acb>UR5 [TU] 5 UR5 gr )rbr r\rf)rrs rr\IsolatedAsyncioTestCase.debugs$   "   ##%rc@URbUR5 ggr )r rfrs r__del__IsolatedAsyncioTestCase.__del__s    *  ' ' ) +r)r r)runTestr )__name__r0r1__firstlineno__r]r rrr&r7r>rIrMrQr=rDrbrfr;r\rm__static_attributes__ __classcell__)rs@rrr sa6L>    2()U 48 G% *& **rr)r^r rXrEcaser __unittestrrrrrvs'  H*hH*rPK!pe&33&__pycache__/main.cpython-313.opt-1.pycnu[ Lit-xSrSSKrSSKrSSKrSSKJrJr SSKJr Sr Sr Sr S r S r S rS r"S S\5r\rg)zUnittest main programN)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase cb[RRU5(Ga UR5R S5(a[RR U5(a[RR U[R"55n[RR U5(d$UR[R5(aU$Un[RRU5SSRSS5RSS5$U$)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths 4/opt/alt/python313/lib64/python3.13/unittest/main.py _convert_namers  ww~~d 5 5e < < 77==  wwtRYY[9Hww}}X&&(*=*=bii*H*H Dww%cr*224=EEc3OO KcDUVs/sHn[U5PM sn$s snfN)r)namesrs r_convert_namesr!.s,1 2EDM$ E 22 2scSU;aSU-nU$)N*z*%s*)patterns r_convert_select_patternr&2s '>7" Nrc \rSrSrSrSrSrS=r=r=r =r =r r Sr SSSS\RSSSSSS4 SSS.S jjrS rS rSS jrS rSrSrSrSSjrSrSrg) TestProgram8ztA command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. Nr__main__TF) tb_locals durationsc B[U[5(aG[U5UlUR S5SSHn[ URU5UlM OXlUc[ RnX`lXl Xl Xpl Xl Xl XlU c[ R(dSUlOXlX lX@lXPl[(R*R-US5UlUR1U5 UR35 g)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr+r, warnoptionswarnings defaultTest testRunner testLoaderr rbasenameprogName parseArgsrunTests)selfr2r>r6r?r@r7r:r8r9r;r=r+r,parts r__init__TestProgram.__init__Bs fc " "$V,DK S)!"-%dkk48 .!K <88D  $" ""  COO&DM%M&$$((a1  t rcXURc\[URR55 [[SUR 0-5 UR R5 g[URR55 [[SUR 0-5 g)Nprog) r2print _main_parser format_help MAIN_EXAMPLESrB_discovery_parser print_helpMODULE_EXAMPLES)rEargskwargss r _print_helpTestProgram._print_helpjsx ;;  $##//1 2 -64=="99 :  " " - - / $##//1 2 /VT]]$;; r/r0list createTests)rEr6s rrCTestProgram.parseArgsss  ;; 4y1}aJ!>""48,    ( (ab4 8::""2&     ( (ab4 8 ::+DJJ7DN:%"    %!DN ((# . ."..0DN!$"2"23DN rcUR(aURURlU(aNUc UROU"5nUR"URURUR 5UlgURc+URRUR5UlgURRURUR5Ulgr) testNamePatternsr@rWstartr%toptestr^loadTestsFromModuler2loadTestsFromNames)rEfrom_discoveryLoaderrs rraTestProgram.createTestss  /3/D/DDOO , (.T__FHF DLL$((KDI ^^ #;;DKKHDI::4>>;?;;HDIrc|UR5nURU5UlURU5Ulgr)_getParentArgParser_getMainArgParserrL_getDiscoveryArgParserrO)rE parent_parsers rrYTestProgram._initArgParserss6002  22=A!%![+UR R,5S:Xa[&R""[.5 g[&R""S5 gg![a> URURURURURS9nGNf=f![a UR5nGN?f=f)N)r:r8r;r=r+r,)r:r8r;r=rr)r9rr?rTextTestRunnerr/r|r:r8r;r=r+r, TypeErrorrunrgresultr7 wasSuccessfulr5testsRunrZskipped_NO_TESTS_EXITCODE)rEr?s rrDTestProgram.runTestssf ??   ?? "$33DO doot , , / I!%4>>:>--8< :>--;?>>;?>> "1"KJ"J nnTYY/ 99;;,,.. %%*s4;;3F3F/G1/L+, !I!%4>>:>--8< :>--"1"IJI  /!__.  /s,AFAGGGGG<;G<)rOrLr;r9r>r,r7r8r2r%rBrrer+rgr@rdr^r?rfr:r=)FNr)r_ __module__ __qualname____firstlineno____doc__r2r:r8r9r;rBr=rdrOrdefaultTestLoaderrGrTrCrarYrnrorpr[rD__static_attributes__r$rrr(r(8s FINRRHRzRFRXR;K(d#0H0HTd$&>C" &P=: HL $L * =!rr()rr5rr rrsignalsr __unittestrrNrQrr!r&objectr(mainr$rrrsU  #    3 ]&]@rPK!ص__)__pycache__/signals.cpython-313.opt-1.pycnu[ Lic |SSKrSSKrSSKJr Sr"SS\5r\R"5rSr Sr Sq Sr S S jr g) N)wrapsTc \rSrSrSrSrSrg)_InterruptHandler cSUlXl[U[5(aHU[R :Xa[R nO#U[R:XaSnO [S5eXl g)NFcgN) unused_signum unused_frames 7/opt/alt/python313/lib64/python3.13/unittest/signals.pydefault_handler3_InterruptHandler.__init__..default_handlerszYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr)selfrs r __init___InterruptHandler.__init__ s` / os + +&..0"("<"< FNN2 !233 /rc[R"[R5nX0LaURX5 UR(aURX5 SUl[ R 5HnUR5 M g)NT)r getsignalSIGINTrr_resultskeysstop)rsignumframeinstalled_handlerresults r __call___InterruptHandler.__call__sb",,V]];  (   / ;;   / mmoF KKM&r)rrrN)__name__ __module__ __qualname____firstlineno__rr'__static_attributes__r rr rr s /$ rrcS[U'g)N)r r&s r registerResultr1*s HVrc@[[RUS55$r )boolr popr0s r removeResultr5-s  VT* ++rc[cY[R"[R5n[ U5q[R"[R[5 ggr )_interrupt_handlerrrrr)rs r installHandlerr81s?! **6==9.? fmm%78"rc^Tb[T5U4Sj5nU$[b4[R"[R[R5 gg)Nc>[R"[R5n[5 T"U0UD6[R"[RU5 $![R"[RU5 f=fr )rrr removeHandler)argskwargsinitialmethods r innerremoveHandler..inner;sS&&v}}5G O 6t.v. fmmW5 fmmW5s A'B)rr7rrr)r?r@s` r r;r;9sL  v 6  6 % fmm%7%H%HI&rr )rweakref functoolsr __unittestobjectrWeakKeyDictionaryr r1r5r7r8r;r rr rGsM   @  $ $ &,9JrPK! ,, __pycache__/case.cpython-313.pycnu[ MiSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r SSK r SSK J r SSKJrJrJrJrJr Sr\"5rSr"SS \5r"S S \5r"S S \5r"SS\5rSrSrSrSr /r!Sr"Sr#Sr$Sr%Sr&Sr'Sr(Sr)"SS5r*"SS\*5r+"S S!\+5r,"S"S#\+5r-"S$S%\-5r."S&S'\R^5r0"S(S)\5r1"S*S+\15r2"S,S-\15r3g).zTest 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\rSrSrSrSrg)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____firstlineno____doc____static_attributes__r 4/opt/alt/python313/lib64/python3.13/unittest/case.pyr r srr c\rSrSrSrSrg) _ShouldStop"z The test should stop. r Nrr rrrr"rrc\rSrSrSrSrg)_UnexpectedSuccess'z/ The test was supposed to fail, but it didn't! r Nrr rrrr'rrrcF\rSrSrSSjr\R SSj5rSrg)_Outcome-Nc\SUlXl[US5UlSUlSUlg)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init___Outcome.__init__.s-!& (/ (E% #rc## URnSUlSv U(a8UR(a'URRURUS5 UR=(a UUlg![a e[ a1nSUl[ URU[U55 SnAN[SnAf[a Nj [R"5nUR(aXPl OKSUlU(a'URRURX5 O[URX5 SnN=f!UR=(a UUlf=f7f)NTF)r&rr" test_caseKeyboardInterruptr _addSkipstrrsysexc_infor#r' _addError)r(r,subTest old_successer1s rtestPartExecutor_Outcome.testPartExecutor5sll   8 ,4<< &&y':':ItL<<7KDL1!   5 DL T[[)SV 4 4   ||~H%%'/$$ KK**9+>+> Tdkk9?H  <<7KDLsLE#A5?EE#5E 'B50E5 EEA;E?EE  E#)r'r#rr%r&N)F) rrrrr) contextlibcontextmanagerr6rr rrrr-s!$88rrc[USS5nUb U"X5 g[R"S[S5 UR"U5 g)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr,reasonr<s rr.r.Vs@fi.G " L$a ))$rcUbHUbD[USUR5(aUR"X5 gUR"X5 ggg)Nr) issubclassfailureException addFailureaddError)rtestr1s rr2r2_sF h2 hqk4#8#8 9 9   d - OOD + 3rcU$r8r )objs r_idrLfs Jrc[U5nURnURnU"U5nU"X@SSS5 U$![a( [ SUR SUR S35Sef=f)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrZjs r(CO ||2YFttT* M O!CNN+1S-=-=,>?CDEJN OOs :2A,c2[RXU45 g)zjSame as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).N)_module_cleanupsappend)functionargskwargss raddModuleCleanuprazsXV45rc"[U[5$)z&Same as enterContext, but module-wide.)rZra)rUs renterModuleContextrcs ". //rc/n[(a-[R5upnU"U0UD6 [(aM-U(aUSeg![anURU5 SnAN:SnAff=f)zSExecute all module cleanup functions. Normally called for you after tearDownModule.Nr)r\pop Exceptionr]) exceptionsr^r_r`excs rdoModuleCleanupsrisuJ  !1!5!5!7 # d %f %   m #   c " " #sA A-A((A-cj^U4Sjn[T[R5(a TnSmU"U5$U$)z Unconditionally skip a test. c>[U[5(d![R"U5U4Sj5nUnSUlTUlU$)Nc>[T5er8r )r_r`rCs r skip_wrapper-skip..decorator..skip_wrappersv&&rT) isinstancerP functoolswraps__unittest_skip____unittest_skip_why__) test_itemrnrCs r decoratorskip..decoratorsF)T** __Y ' '( '$I&* #*0 'r)rptypes FunctionType)rCrvrus` rskipr{s8 &%,,-- ## rc2U(a [U5$[$)z' Skip a test if the condition is true. r{rL conditionrCs rskipIfrsF| Jrc2U(d [U5$[$)z+ Skip a test unless the condition is true. r}r~s r skipUnlessrs F| JrcSUlU$)NT)__unittest_expecting_failure__)rus rr'r's/3I, rc^[U[5(a[U4SjU55$[U[5=(a [ UT5$)Nc3<># UHn[UT5v M g7fr8) _is_subtype).0r5basetypes r _is_subtype..s>X;q(++Xs)rptupleallrPrE)expectedrs `rrrs:(E"">X>>> h % H*Xx*HHrc \rSrSrSrSrSrg)_BaseTestCaseContextcXlgr8r,)r(r,s rr)_BaseTestCaseContext.__init__s"rcURRURU5nURRU5er8)r,_formatMessagemsgrF)r( standardMsgrs r _raiseFailure"_BaseTestCaseContext._raiseFailures1nn++DHHkBnn--c22rrN)rrrrr)rrr rrrrs #3rrc$\rSrSrSSjrSrSrg)_AssertRaisesBaseContextNc[RX5 XlX lUb[R "U5nX0lSUlSUlgr8) rr)rr,recompileexpected_regexobj_namer)r(rr,rs rr)!_AssertRaisesBaseContext.__init__sB%%d6 "  %ZZ7N, rc[URUR5(d[U<SUR<35eU(dCUR SS5UlU(a![[[U55<S35eUSn$UtpBURUl U U"U0UD6 SSS5 Sng![a [U5Ul N2f=f!,(df  N1=f!Snf=f)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. z() arg 1 must be rNz1 is an invalid keyword argument for this function) rr _base_typerT_base_type_strrernextiterrrrSr/)r(namer_r` callable_objs rhandle_AssertRaisesBaseContext.handles t}}doo>>!%t':':!<==!::eT2#7;DL7I%LMMD#' L 2 , 5 5 d-f-D " 2 #L 1  2DsNBC) C)B8"C)$ C-C)8CC)CC) C&"C))C-)rrrrr,r8)rrrrr)rrr rrrrs rrcP\rSrSrSr\rSrSrSr \ "\ R5r Srg)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typescU$r8r r(s rrQ_AssertRaisesContext.__enter__s rcUcuURRnUR(a,UR SR UUR55 O7UR SR U55 O[R"U5 [XR5(dgURS5Ul URcgURnUR[U55(d4UR SR UR[U555 g![a [UR5nGN5f=f)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rrrSr/rrformat traceback clear_framesrEwith_traceback exceptionrsearchpattern)r(exc_type exc_valuetbexc_namers rrR_AssertRaisesContext.__exit__s   .==11}}""#8#?#?@D $OP""?#9#9(#CD  " "2 &(MM22"11$7    &,,$$S^44   9@@#++S^ = >+" .t}}- .sD..EE)rN)rrrrr BaseExceptionrrrQrR classmethodry GenericAlias__class_getitem__rr rrrrs,MJDN6$E$6$67rrc,\rSrSrSr\rSrSrSr Sr g)_AssertWarnsContextizBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typescJ[[RR55Hn[ USS5(dM0UlM [ R"SS9UlURR5Ul[ R"SUR5 U$)N__warningregistry__T)recordalways) listr0modulesvaluesr>rr?catch_warningswarnings_managerrQ simplefilterr)r(vs rrQ_AssertWarnsContext.__enter__!s|ckk((*+Aq/66(*%,!) 7 7t D--779 h 6 rc>URRXU5 UbgURRnSnUR HnURn[XpR5(dM+UcUnURb+URR[ U55(dMhXpl URUl URUl g Ub>URSRURR [ U555 UR"(a,URSRUUR"55 gURSRU55 g![a [ UR5nGNcf=f)Nrz{} not triggered by {}z{} not triggered)rrRrrrSr/r?messagerprrwarningfilenamelinenorrrr)r(rrrrfirst_matchingmws rrR_AssertWarnsContext.__exit__,s] &&xB?    *}}--HA Aa//%!"##/''..s1v66LJJDM((DK   %   9@@((00#n2E G H ==   7>>x?C}} N O   188B C3 *4==)H *sE99FF)rrrr?rN) rrrrrWarningrrrQrRrr rrrrsLJ?N  Drrc\rSrSrSrSrg)_AssertNotWarnsContextiOcZURRXU5 UbgURRnUR H?nURn[X`R5(dM+URUS35 MA g![a [ UR5nNqf=f)Nz triggered) rrRrrrSr/r?rrpr)r(rrrrrrs rrR_AssertNotWarnsContext.__exit__Qs &&xB?    *}}--HA A!]]++""hZz#:; *4==)H *sBB*)B*r N)rrrrrRrr rrrrOs \ 4Sj5r!Sr"Sr#Sr$Sr%Sr&Sr'S r(SPS!jr)S"r*\S#5r+S$r,S%r-S&r.SPS'jr/SPS(jr0SPS)jr1S*r2S+r3S,r4S-r5SQS.jr6SQS/jr7S0r8SPS1jr9SPS2jr:SPS3jr;SRS4jr<SRS5jr=SQS6jr>S7r?SPS8jr@SPS9jrASPS:jrBSPS;jrCSPS<jrDSPS=jrESPS>jrFSPS?jrGSPS@jrHSPSAjrISPSBjrJSPSCjrKSPSDjrLSPSEjrMSPSFjrNSPSGjrOSPSHjrPSPSIjrQSJrRSKrSSPSLjrTSPSMjrUSNrVU=rW$)STestCaseijaA 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. TiicB>SUl/Ul[TU] "U0UD6 g)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rWr_r` __class__s rrTestCase.__init_subclass__s% %  !4262rcXlSUlSUl[X5nURUl/UlSUl 0Ul UR[S5 UR[S5 UR[S5 UR[S 5 UR[ S 5 UR["S 5 g![ a& US:wa[ SUR<SU<35eNf=f) 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 testrunTestzno such test method in : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr>rrS ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr/)r( methodName testMethods rr)TestCase.__init__s * ' 5 2J#-"4"4D  %'!   '89   '89   (:;   &67   ,<=   &<=) 4Y&!~~z"344' 4s C -C<;C<c X RU'g)aAdd 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)r(typeobjr^s rrTestCase.addTypeEqualityFuncs.6!!'*rc>URRXU45 g)zAdd 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).N)rr]r(r^r_r`s r addCleanupTestCase.addCleanups xv67rc,[XR5$)zEnters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method. )rZr)r(rUs r enterContextTestCase.enterContexts b//22rc>URRXU45 g)zhSame as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).N)rr]rWr^r_r`s raddClassCleanupTestCase.addClassCleanups ""HF#;>2D4H4HIIrcn[U5[U5La[$URUR:H$r8)rPNotImplementedrr(others r__eq__TestCase.__eq__ s/ :T%[ (! !##u'<'<<r:rs r__repr__TestCase.__repr__s"($*>*>@ @rc+v# URbURR(dSv gURnUc [U5nOURR U5n[ XU5UlURRURSS9 Sv SSS5 URR(d1URRnUbUR(a[eO!URR(a[eX0lg!,(df  N=f!X0lf=f7f)a(Return 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. NT)r3) rr%rrparams new_child_SubTestr6r&rfailfastrr')r(rrRparent params_maprs rr3TestCase.subTests ==  (N(N   >)&1J008J J7  #// t/LM==((--%&//%%.."!"MML#Ms7A5D98$D.D!A5D.D9 D+'D..D66D9cURnU"X5 g![a0 [R"S[5 UR "U5 gf=f)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerSr?r@rArB)r(rr1rZs r_addExpectedFailureTestCase._addExpectedFailure8sN /!'!:!:  t .  $ MM\( *   d # $s 7AAcURnU"U5 g![a[ [R"S[5 [ Se![ a* UR "U[R"55 gf=ff=f)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrSr?r@rArrGr0r1)r(rr^s r_addUnexpectedSuccessTestCase._addUnexpectedSuccessBsr '#)#>#>  ! & 8 MM_( * 8(d2% 8!!$ 7 8 8s& %A<A0A84A<7A88A<cURnU"X5 g![a [R"S[5 gf=f)Nz$TestResult has no addDuration method) addDurationrSr?r@rA)r(relapsedrbs r _addDurationTestCase._addDurationQs? ' ,,K  &  * MM@( * *s %??c$UR5 gr8)rrs r _callSetUpTestCase._callSetUpZs  rcRU"5b[R"SUS3[SS9 gg)NzFIt is deprecated to return a value that is not None from a test case (rI) stacklevel)r?r@DeprecationWarning)r(methods r_callTestMethodTestCase._callTestMethod]s3 8  MM((.xq23ERS U rc$UR5 gr8)r rs r _callTearDownTestCase._callTearDownbs  rcU"U0UD6 gr8r rs r _callCleanupTestCase._callCleanupes$!&!rcUc5UR5n[USS5n[USS5nUbU"5 OSnUR"U5 [XR5n[URSS5(d[USS5(aV[URSS5=(d [USS5n[ XU5 UUR "U5 UbU"5 $$[USS5=(d [USS5n[U5n[R"5nXpl URU5 UR5 SSS5 UR(abXglURU5 URU5 SSS5 SUlURU5 UR!5 SSS5 UR#5 UR%U[R"5U- 5 UR(aXU(a?UR&(aUR)XR&5 O$UR+U5 OUR,"U5 USUlSnSUl UR "U5 UbU"5 $$!,(df  GNR=f!,(df  GN"=f!,(df  GN=f!SUlSnSUl f=f!UR "U5 UbU"5 ff=f)N startTestRun stopTestRunrsFrtrxr)r/r> startTestrrr.stopTestrtime perf_counterrr6rgr&r#rnrq doCleanupsrdr'r[r_rB) r(rrwrxrskip_whyr#outcome start_times rrun TestCase.runhs >++-F"6>4@L!&->K'K4  ';';FM $DeL v&G**,J % ' --d3OO%4??0A- 11$7,,Z8805G- 11$7**,8!!!&4+<+<+>+KM??("22 44V=T=TU 66v>))$/+/'!%  OOD !& 'A438787"+/'!%  OOD !& 'suA;K''AK')KJ0KJ. K3KB*K.K' J+&K. J=8K K KK$$K''LcXUR=(d [5nUR(a`URR5up#nUR U5 UR "U/UQ70UD6 SSS5 UR(aM`UR $!,(df  N-=f)zFExecute all cleanup functions. Normally called for you after tearDown.N)rrrrer6rtr&)r(rr^r_r`s rr}TestCase.doCleanupss}---8:nn%)^^%7%7%9 "HF))$/!!( "HF ?$)&)!!! ?''..s||~> ?sA8BBc&UR"U0UD6$r8)r)r(r_kwdss r__call__TestCase.__call__sxx&&&rc[XR5n[URSS5(d[USS5(a6[URSS5=(d [USS5n[U5eUR 5 UR U5 UR 5 UR(aGURR5up4nUR"U/UQ70UD6 UR(aMFgg)z6Run the test without collecting errors in a TestResultrsFrtrxN) r>rrr rgrnrqrrert)r(rr~r^r_r`s rdebugTestCase.debugsT#7#78 DNN$7 ? ? J 3U ; ;0GLL":/FK 8$ $  Z( nn%)^^%7%7%9 "HF   h 8 8 8nnnrc[U5e)zSkip this test.rm)r(rCs rskipTestTestCase.skipTests vrc$URU5e)z)Fail immediately, with the given message.)rF)r(rs rfail TestCase.fails##C((rcpU(a/URUS[U5-5nURU5eg)z#Check that the expression is false.z%s is not falseNrrrFr(exprrs r assertFalseTestCase.assertFalses7 %%c+>.$?GdGs!%c<[X5nURSX#5$)a Fail 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) assertWarnsrrr(expected_warningr_r`rs rrTestCase.assertWarns s 8&&6=~~mT::rc<[X5nURSX#5$)z7The opposite of assertWarns. Private due to low demand._assertNotWarns)rrrs rrTestCase._assertNotWarns?s()9@~~/>>rcSSKJn U"XUSS9$)a&Fail 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_AssertLogsContextFno_logs_logrr(loggerlevelrs r assertLogsTestCase.assertLogsDs* -!$uEErcSSKJn U"XUSS9$)zFail unless no log messages of level *level* or higher are emitted on *logger_name* or its children. This method must be used as a context manager. rrTrrrs r assertNoLogsTestCase.assertNoLogs\s -!$tDDrc[U5[U5LaIURR[U55nUb"[U[5(a [ X5nU$UR $)zGet a detailed comparison function for the types of the two args. Returns: A callable accepting (first, second, msg=None) that will raise a failure exception if first != second with a useful human readable error message for those types. )rPrgetrpr/r>_baseAssertEqual)r(firstsecondasserters r_getAssertEqualityFuncTestCase._getAssertEqualityFunces\" ;$v, &0044T%[AH#h,,&t6H$$$rcnX:Xd0S[X5-nURX45nURU5eg)z:The default assertEqual implementation, not type specific.%s != %sN)r rrF)r(rrrrs rrTestCase._baseAssertEquals=$';E'JJK%%c7C'', ,rc4URX5nU"XUS9 g)zHFail if the two objects are unequal as determined by the '==' operator. )rN)r)r(rrrassertion_funcs r assertEqualTestCase.assertEquals44UCu#.rcX:wd<URU[U5<S[U5<35nURU5eg)zFFail if the two objects are equal as determined by the '!=' operator.  == Nr)r(rrrs rassertNotEqualTestCase.assertNotEqualsG%%c59I:CF:K,MNC'', ,rc X:XagUbUb [S5e[X- 5nUb=Xe::ag[U5<S[U5<S[U5<S[U5<S3nOBUcSn[Xc5S:Xag[U5<S[U5<SU<S [U5<S3nUR XG5nUR U5e) aFail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). If the two objects compare equal then they will automatically compare almost equal. N specify delta or places not bothz !=  within  delta ( difference)rz places (rTabsrroundrrFr(rrplacesrdeltadiffrs rassertAlmostEqualTestCase.assertAlmostEquals ?   !3>? ?5>"  }% &!% $ !K ~T"a'% &!$ !K !!#3##C((rc UbUb [S5e[X- 5nUbBX:XdXe:ag[U5<S[U5<S[U5<S[U5<S3nO:UcSnX:Xd[Xc5S:wag[U5<S[U5<SU<S 3nUR XG5nUR U5e) aFail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measured from the most significant digit). Objects that are equal automatically fail. Nrrrrrrrz placesrrs rassertNotAlmostEqualTestCase.assertNotAlmostEquals  !3>? ?5>"  O% &!% $ !K ~Ot)<)A9B59I9B69J9?AK!!#3##C((rc UbqURn[X5(d"URSU<S[U5<35e[X$5(d"URSU<S[U5<35eOSnSn[ U5nUc [ U5nUcX:XagSUR54[X5--n[[WW55H)n Xn X)n X:wdMUS U 4[X5--- n O# Xx:XaUc[U5[U5:wagXx:a#US XWU- 4-- nUS U[X54-- nO'Xx:a"USXXU- 4-- nUS U[X'54-- nUn SSR[R"[ R""U5R%5[ R""U5R%555-n UR'X5n UR)X<5nUR+U5 g![ [ 4a SU-nGNf=f![ [ 4a SU-nGNf=f![ [[ 4a US X4-- n GMMf=f![ [[ 4a US X4-- n GMtf=f![ [[ 4a USX4-- nGNJf=f![ [[ 4a USXu4-- nGNof=f)aAn equality assertion for ordered sequences (like lists and tuples). For the purposes of this function, a valid ordered sequence type is one which can be indexed, has a length, and has an equality operator. Args: seq1: The first sequence to compare. seq2: The second sequence to compare. seq_type: The expected datatype of the sequences, or None if no datatype should be enforced. msg: Optional message to use on failure instead of a list of differences. NzFirst sequence is not a rzSecond sequence is not a sequencez(First %s has no length. Non-sequence?z)Second %s has no length. Non-sequence?z%ss differ: %s != %s z( Unable to index element %d of first %s z) Unable to index element %d of second %s z# First differing element %d: %s %s z+ First %s contains %d additional elements. zFirst extra element %d: %s z'Unable to index element %d of first %s z, Second %s contains %d additional elements. z(Unable to index element %d of second %s r2)rrprFrlenrTNotImplementedError capitalizer rangemin IndexErrorrPjoindifflibndiffpprintpformat splitlines_truncateMessagerr)r(seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualTestCase.assertSequenceEquals  $--Md--+++8)D/-KLLd--+++8)D/-KLL.'M  #t9D   '4y  |0"--/1(456I3tT?+ GE  GE >"K#$$)=e)K"K#MNI%,(LX%5J$t*,{+.;D[-IJK K"A#'4:)>"?#@AI +.;D[-IJK L"A#'4:)>"?#@AI   MM&...99; ...99; =>>++KA !!#3 #K./ #B!#I #23 'G%'  '":/BC"N"#!3#45I":/BC"O"#!3#45I*":/BCK#2594I#JKIK":/BCL#36:5J#KLILsl: H H.I I12JJ=H+*H+.II I.-I.1JJJ:9J:=KKcpURnUb[U5U::aX-$U[[U5--$r8)maxDiffr DIFF_OMITTED)r(rrmax_diffs rrTestCase._truncateMessageIs8<<  s4yH4> !,T233rc.URXU[S9 g)zA list-specific equality assertion. Args: list1: The first list to compare. list2: The second list to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r(list1list2rs rrTestCase.assertListEqualOs   sT Brc.URXU[S9 g)zA tuple-specific equality assertion. Args: tuple1: The first tuple to compare. tuple2: The second tuple to compare. msg: Optional message to use on failure instead of a list of differences. rN)rr)r(tuple1tuple2rs rrTestCase.assertTupleEqual[s   u ErcURU5nURU5nW(dW(dg/nU(a4UR S5 UHnUR [ U55 M W(a4UR S5 UHnUR [ U55 M SR U5n URURX955 g![anURSU-5 SnANSnAf[anURSU-5 SnAGNSnAff=f![anURSU-5 SnAGN/SnAf[anURSU-5 SnAGNVSnAff=f)agA 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:r2) differencerTrrSr]reprrr) r(set1set2r difference1r5 difference2linesitemrs rrTestCase.assertSetEqualfsC P//$/K  Q//$/K {   LLE F# T$Z($  LLE F# T$Z($ii&  $%%c785 M IIG!K L L P IIJQN O O P  M IIG!K L L Q IIKaO P P QsFCD0 D-(D D-D((D-0 F:E F!E;;FcX;a<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a in b), but with a nicer default message. not found in Nrrrr(member containerrrs rassertInTestCase.assertIns<  "2;F2C2;I2FHK IId))#; < #rcX;a<[U5<S[U5<3nURURX455 gg)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nrrs r assertNotInTestCase.assertNotIns<  ;DV;L8A)8LNK IId))#; < rcXLa<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nrr(expr1expr2rrs rassertIsTestCase.assertIss;  ,5e,<-6u-=?K IId))#; < rclXLa0S[U5<3nURURX455 gg)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nrr&s r assertIsNotTestCase.assertIsNots0 >:CE:JLK IId))#; < rc URU[S5 URU[S5 X:waS[X5-nSSR[R "[ R"U5R5[ R"U5R555-nURXE5nURURX455 gg)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr2) assertIsInstancerr rrrrrrrrr)r(d1d2rrrs rrTestCase.assertDictEquals b$(LM b$(MN 8$';B'CCK499W]]!>>"-88:!>>"-88:&<==D// BK IId))#; < rc[U5[U5pT[R"U5n[R"U5nX:Xag[XE5nU(a\SnUVs/sHnSU-PM n nSR U 5n URXz5nURX75nURU5 gg![a [ XE5nN{f=fs snf)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: z First has %d, Second has %d: %rr2) r collectionsCounterrrTrrrrr) r(rrr first_seq second_seq differencesrrrrs rassertCountEqualTestCase.assertCountEquals!%U T&\: F'' 2E ((4F .yEK ;EWii&G// EK%%c7C IIcN  I1)HK IXs,B8!C8CCcURU[S5 URU[S5 X:wGa$[U5UR:d[U5UR:aUR XU5 UnUnU(a$U(aUSS:wd USS:wa US- nUS- nO+U(aUSS:waUS- nOU(aUSS:waUS- nUR SS9nUR SS9nS[ X5-nSSR[R"Xg55-n URX5nURURX855 g g ) z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringr2T)keependsrrxN) r/r/r_diffThresholdrrr rrrrrr) r(rrrfirst_presplitsecond_presplit firstlines secondlinesrrs rrTestCase.assertMultiLineEqualsN eS*JK fc+LM ?E T000F d111%%eS9 #N$O9$r d(:"d*N#t+OF2J$.4'59,$&'22D2AJ)44d4CK%';E'JJK"'''-- "HIID// BK IId))#; <9 rcX:d<[U5<S[U5<3nURURX455 gg)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nrr(abrrs r assertLessTestCase.assertLesss5u3 b), but with a nicer default message.z not greater than NrrEs r assertGreaterTestCase.assertGreaters5u6?lIaLQK IId))#; <rcX:d<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to NrrEs rassertGreaterEqualTestCase.assertGreaterEqual s8vBKA,PYZ[P\]K IId))#; <rcjUb0[U5<S3nURURX#55 gg)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Nonerr(rKrrs r assertIsNoneTestCase.assertIsNones/ ?.7n>K IId))#; < rcPUc#SnURURX#55 gg)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rrrTs rassertIsNotNoneTestCase.assertIsNotNones( ;-K IId))#; < rc[X5(d3[U5<SU<3nURURX455 gg)zLSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.z is not an instance of Nrprrrr(rKrWrrs rr/TestCase.assertIsInstances9###;DS>3OK IId))#; <$rc[X5(a3[U5<SU<3nURURX455 gg)z,Included for symmetry with assertIsInstance.z is an instance of Nr[r\s rassertNotIsInstanceTestCase.assertNotIsInstance&s7 c  7@~sKK IId))#; < rc>[XU5nURSX45$)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)r(rrr_r`rs rrbTestCase.assertRaisesRegex,s#''9P~~14@@rc>[XU5nURSX45$)arAsserts 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)r(rrr_r`rs rreTestCase.assertWarnsRegex<s# &&6nM~~0$??rc[U[[45(a$U(dS5e[R"U5nUR U5(d6SUR <SU<3nURX45nURU5eg)z=Fail the test unless the text matches the regular expression.z!expected_regex must not be empty.zRegex didn't match: rN) rpr/bytesrrrrrrF)r(textrrrs r assertRegexTestCase.assertRegexOsz nsEl 3 3! F#F F>ZZ7N$$T**&&.K%%c7C'', , +rcF[U[[45(a[R"U5nUR U5nU(aXSXR 5UR5<SUR<SU<3nURX55nURU5eg)z9Fail the test if the text matches the regular expression.zRegex matched: z matches z in N) rpr/rhrrrstartendrrrF)r(riunexpected_regexrmatchrs rassertNotRegexTestCase.assertNotRegex[s &e 5 5!zz*:;  ''- [[]UYY[1 ((K %%c7C'', , r)rrrrrr)rr8)NNNNN)XrrrrrAssertionErrorrFrrr>rr)rrrrrrrr r$r(r+r/r7r;rArErJrOr9r:_subtest_msg_sentinelr3r[r_rdrgrnrqrtrr}rrrrrrrrrrrrrrrrrrrrrrrrr r#r)r,rr9rrHrKrNrQrUrXr/r_rbrerjrqr __classcell__rs@rrrjs @&KGN3 >@ 683== 77  VVaa#CJ= 8e@/##</ ''U "?B  ? ?'9")- - I*B;>? F0E%4-/-AE $+)ZDH#'!)FaF4 C F)9V==== =@!=F= = = = = = == A @& - - -rrcf^\rSrSrSrSU4SjjrSrSrSrSr Sr S r S r S r S rS rU=r$)FunctionTestCaseika5A 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. cZ>[[U] 5 X lX0lXlX@lgr8)rryr) _setUpFunc _tearDownFunc _testFunc _description)r(testFuncrr  descriptionrs rr)FunctionTestCase.__init__ts' .0%!'rc@URbUR5 ggr8)r{rs rrFunctionTestCase.setUp{s ?? & OO  'rc@URbUR5 ggr8)r|rs rr FunctionTestCase.tearDowns    )     *rc$UR5 gr8)r}rs rrFunctionTestCase.runTests  rc.URR$r8)r}rrs rr;FunctionTestCase.ids~~&&&rc4[XR5(d[$URUR:H=(aY URUR:H=(a9 UR UR :H=(a UR UR :H$r8)rprr>r{r|r}r~r?s rrAFunctionTestCase.__eq__sw%00! !%"2"227!!U%8%887~~07  E$6$66 7rc[[U5URURURUR 45$r8)rDrPr{r|r}r~rs rrEFunctionTestCase.__hash__s7T$Z$2D2D^^T%6%689 9rcd[UR5<SURR<S3$)NrHrI)rrr}rrs rrJFunctionTestCase.__str__s%$T^^4 NN335 5rcRS[UR5<SUR<S3$)NrMz tec=rN)rrr}rs rrOFunctionTestCase.__repr__s ( 8%)^^5 5rcURb UR$URRnU=(a" URS5SR 5=(d S$)Nr2r)r~r}rr4r3r5s rr7!FunctionTestCase.shortDescriptionsO    ($$ $nn$$1syyq)//19T9r)r~r{r|r}rs)rrrrrr)rr rr;rArErJrOr7rrvrws@rryryks?(!'7955::rrycF^\rSrSrU4SjrSrSrSrSrSr Sr U=r $) rTich>[TU]5 X lXlX0lUR Ulgr8)rr)_messager,rRrF)r(r,rrRrs rr)_SubTest.__init__s+  " ) : :rc[S5e)Nzsubtests cannot be run directly)rrs rr_SubTest.runTests!"CDDrcv/nUR[La*URSRUR55 UR(aPSR SURR 555nURSRU55 SR U5=(d S$)Nz[{}]z, c3H# UHupSRX5v M g7f)z{}={!r}N)r)rrrs rr+_SubTest._subDescription..s'$31FQ  &&1s "z({}) z ())rrur]rrRritems)r(parts params_descs r_subDescription_SubTest._subDescriptions == 5 5 LLt}}5 6 ;;))$3"kk//1$33K LL{3 4xx/-/rcrSRURR5UR55$Nz{} {})rr,r;rrs rr; _SubTest.ids)~~dnn//143G3G3IJJrc6URR5$)z\Returns a one-line description of the subtest, or None if no description has been provided. )r,r7rs rr7_SubTest.shortDescriptions~~..00rcVSRURUR55$r)rr,rrs rrJ_SubTest.__str__s ~~dnnd.B.B.DEEr)rrFrRr,) rrrrr)rrr;r7rJrrvrws@rrTrTs*;E 0K1 FFrrT)4rr0rqrrrr?r4r9rr{ryrxrutilrrrrr __unittestobjectrurrfr rrrr.r2rLrZr\rarcrir{rrr'rrrrrrChainMaprrryrTr rrrsA   ?? 7 y)  &8v&8R%, 6 0  (I 33'3'T$83$8N1D21Dh<0<"{++}-v}-B 7:x7:t!Fx!FrPK!6A&__pycache__/_log.cpython-313.opt-1.pycnu[ Mi SSKrSSKrSSKJr \R"SSS/5r"SS\R 5r"S S \5rg) N)_BaseTestCaseContext_LoggingWatcherrecordsoutputc*\rSrSrSrSrSrSrSrg)_CapturingHandler zE A logging handler capturing all (raw and formatted) logging output. cd[RRU5 [//5UlgN)loggingHandler__init__rwatcherselfs 4/opt/alt/python313/lib64/python3.13/unittest/_log.pyr_CapturingHandler.__init__s"  &&r2. cgr rs rflush_CapturingHandler.flushs rcURRRU5 URU5nURRRU5 gr )rrappendformatr)rrecordmsgs remit_CapturingHandler.emits@ ##F+kk&! ""3'r)rN) __name__ __module__ __qualname____firstlineno____doc__rrr__static_attributes__rrrr r s/ (rr c.\rSrSrSrSrSrSrSrSr g) _AssertLogsContextz6A context manager for assertLogs() and assertNoLogs() z"%(levelname)s:%(name)s:%(message)sc[R"X5 X lU(a%[RR X35UlO[RUlSUlX@l gr ) rr logger_namer _nameToLevelgetlevelINFOrno_logs)r test_caser+r.r0s rr_AssertLogsContext.__init__!sH%%d6&  --11%?DJ DJ rc[UR[R5(aUR=olO&[R "UR5=ol[R "UR5n[5nURUR5 URU5 URUl URSSUlURUlUR UlU/Ul URUR5 SUlUR$(agUR$)NF) isinstancer+r Loggerlogger getLogger FormatterLOGGING_FORMATr setLevelr. setFormatterrhandlers old_handlers old_level propagate old_propagater0)rr6 formatterhandlers r __enter___AssertLogsContext.__enter__+s d&& 7 7#'#3#3 3F[#*#4#4T5E5E#F FF[%%d&9&9: #%$Y' "OOA.#--") #  << rcURURlURURlURR UR 5 UbgUR(aY[URR5S:a5URSRURR55 gg[URR5S:XaTURSR[R"UR 5URR"55 gg)NFrzUnexpected logs found: {!r}z-no logs of level {} or higher triggered on {})r=r6r<r@r?r:r>r0lenrr _raiseFailurerrr getLevelNamer.name)rexc_type exc_valuetbs r__exit___AssertLogsContext.__exit__?s#00  $ 2 2  T^^,   <<4<<''(1,""188 ++-4<<''(A-""CVG00N>NOQ.r) r.r6r+rr0r=r>r@rN) r!r"r#r$r%r9rrCrMr&rrrr(r(s@9N(Qrr() r collectionscaser namedtuplerrr r(rrrrRsK&(():*3X)>@(($:Q-:QrPK!N   __pycache__/util.cpython-313.pycnu[ Li_SrSSKJrJr SSKJr SrSrSrSr Sr Sr \\ \-\ -\-\ -- r \ S:deSr S rSS jrS rS rS rSr\"SS5rSrSrg)zVarious utility functions.) namedtupleCounter) commonprefixTP cn[U5U- U- nU[:aSUSUX0[U5U- S4-nU$)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s prefixlen suffixlenskips 4/opt/alt/python313/lib64/python3.13/unittest/util.py_shortenrsI q6I  )D  *9 ts1v 7I7J5KL L Hc^^[[[U55n[[[U55nU[ ::aU$[ U5m[ T5m[ UT- [-[-- nU[:aK[[-[-UT- -[ :de[T[U5m[UU4SjU55$[T[[5m[UU4SjU55$)Nc34># UH nTUTS-v M g7fN.0r prefixr s r '_common_shorten_repr..'s:TVa m+Tsc3Z># UH nT[UTS[[5-v M" g7fr)r _MIN_DIFF_LEN _MIN_END_LENrs rrr*s, Q(1YZ=-NNs(+) tuplemap safe_reprmaxr _MAX_LENGTHr_MIN_BEGIN_LENr _MIN_COMMON_LENr)argsmaxlen common_lenrr s @@r_common_shorten_reprr)s Y% &D S$ F  $ FF I9$~58HHJJO# 00?B"$&12 22&.*=:T::: fno >F     rc[U5nU(a[ U5[ :aU$US[ S-$![a [RU5nNIf=f)Nz [truncated]...)repr Exceptionobject__repr__r r#)objshortresults rr!r!-sW&c CK+- ,; "3 33 &%&s 5AAc<UR<SUR<3$)N.) __module__ __qualname__)clss rstrclassr76snnc&6&6 77rcS=p#/n/nXnXnXg:a.URU5 US- nXU:XaUS- nXU:XaMOlXg:a.URU5 US- nXU:XaUS- nXU:XaMO9US- nXU:XaUS- nXU:XaMUS- nXU:XaUS- nXU:XaMM!US- nXU:XaUS- nXU:XaMff=f![a+ URXS5 URXS5 XE4$f=f)a^Finds elements in only one or the other of two, sorted input lists. Returns a two-element tuple of lists. The first list contains those elements in the "expected" list but not in the "actual" list, and the second contains those elements in the "actual" list but not in the "expected" list. Duplicate elements in either input list are ignored. rN)append IndexErrorextend)expectedactualijmissing unexpectedeas rsorted_list_differencerE9sa IAGJ   A Auq!QkQ&FAkQ&!!!$Qi1nFAi1nQ"+*Q#+*FA )q.Q!)q.+ (FA )q.Q!)q.  NN8B< (   fRj )     s;8C0C8C>B3C3CCC0D  D c/nU(a+UR5nURU5 U(aM+X!4$![a URU5 N)f=f)zSame behavior as sorted_list_difference but for lists of unorderable items (like dicts). As it does a linear search per item (remove) it has O(n*n) performance.)popremove ValueErrorr:)r=r>rAitems runorderable_list_differencerKbsV G ||~ ! MM$  ( ?  ! NN4  !s8AAcX:X:- $)z.Return -1 if x < y, 0 if x == y and 1 if x > yr)xys r three_way_cmprOss Eae rMismatchzactual expected valuecB[U5[U5p2[U5[U5pT[5n/n[U5H{upXLaM S=p[ X5Hn X,U :XdM U S- n XbU 'M [U5HupX:XdM U S- n XcU 'M X:wdM^[ XU 5nUR U5 M} [U5HOupXLaM Sn [ X5Hn X<U :XdM U S- n XcU 'M [ SX5nUR U5 MQ U$)HReturns list of (cnt_act, cnt_exp, elem) triples where the counts differrr9)listr r- enumeraterange _Mismatchr:)r>r=r tmnNULLr1r?elemcnt_scnt_tr@ other_elemdiffs r_count_diff_all_purposer`ys# <hq q63q6q 8D FQ< < qAtt| !'q\MA! !* >U40D MM$  Q< < qAtt| !E( d  MrcL[U5[U5p2/nUR5H;upVURUS5nXg:wdM[XgU5nUR U5 M= UR5H)upWXR;dM [SXu5nUR U5 M+ U$)rRr)ritemsgetrVr:) r>r=r rWr1r[r\r]r_s r_count_diff_hashablerds 6?GH-q Fwwy dA >U40D MM$  ! wwy  =Q,D MM$ ! MrN)F)__doc__ collectionsrros.pathr __unittestr#r r$rr%rrr)r!r7rErKrOrVr`rdrrrris +    !11OC !#/01   *48&R" z#: ; !FrPK!*&__pycache__/async_case.cpython-313.pycnu[ LiJSSKrSSKrSSKrSSKrSSKJr Sr"SS\5rg)N)TestCaseTc^\rSrSrSrSU4SjjrSrSrSrSr Sr S r S r S r S rS rSrSrSU4SjjrU4SjrSrSrU=r$)IsolatedAsyncioTestCase Ncf>[TU]U5 SUl[R"5UlgN)super__init___asyncioRunner contextvars copy_context_asyncioTestContext)self methodName __class__s :/opt/alt/python313/lib64/python3.13/unittest/async_case.pyr IsolatedAsyncioTestCase.__init__'s) $"#.#;#;#= c # g7fr rs r asyncSetUp"IsolatedAsyncioTestCase.asyncSetUp, c # g7fr rrs r asyncTearDown%IsolatedAsyncioTestCase.asyncTearDown/rrc0UR"U/UQ70UD6 gr ) addCleanuprfuncargskwargss raddAsyncCleanup'IsolatedAsyncioTestCase.addAsyncCleanup2s $1&1rc # [U5nURnURnU"U5IShvN nURXASSS5 U$![a( [ SUR SUR S35Sef=fNO7f)zEnters the supplied asynchronous context manager. If successful, also adds its __aexit__ method as a cleanup function and returns the result of the __aenter__ method. '.zC' object does not support the asynchronous context manager protocolN)type __aenter__ __aexit__AttributeError TypeError __module__ __qualname__r&)rcmclsenterexitresults renterAsyncContext)IsolatedAsyncioTestCase.enterAsyncContextAs2h 'NNE==D Ry TtT48  'a/q1A1A0BCTU"& ' '!s% BA BBB 2A??BcURR5 URRUR5 UR UR 5 gr )r get_looprrunsetUp _callAsyncrrs r _callSetUp"IsolatedAsyncioTestCase._callSetUpUs> $$&   $$TZZ0 (rcfURU5b[R"SUS3[SS9 gg)NzFIt is deprecated to return a value that is not None from a test case ()) stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)rmethods r_callTestMethod'IsolatedAsyncioTestCase._callTestMethod]s<    ' 3 MM((.xq23ERS U 4rcURUR5 URRUR5 gr )r=rrr;tearDownrs r _callTearDown%IsolatedAsyncioTestCase._callTearDownbs, **+   $$T]]3rc0UR"U/UQ70UD6 gr )rD)rfunctionr$r%s r _callCleanup$IsolatedAsyncioTestCase._callCleanupfs X777rcURcS5e[R"U5(d U<S35eURRU"U0UD6URS9$)N!asyncio runner is not initializedz is not an async functioncontextr inspectiscoroutinefunctionr;rr"s rr="IsolatedAsyncioTestCase._callAsyncisr"".S0SS.**400VTHUR5 [TU] U5UR5 $!UR5 f=fr )rdr r;rh)rr6rs rr;IsolatedAsyncioTestCase.runs9   " *7;v&  ' ' )D ' ' )s 2Acb>UR5 [TU] 5 UR5 gr )rdr r^rh)rrs rr^IsolatedAsyncioTestCase.debugs$   "   ##%rc@URbUR5 ggr )r rhrs r__del__IsolatedAsyncioTestCase.__del__s    *  ' ' ) +r)r r)runTestr )__name__r0r1__firstlineno__r_r rrr&r7r>rIrMrQr=rDrdrhr;r^ro__static_attributes__ __classcell__)rs@rrr sa6L>    2()U 48 G% *& **rr)r`r rXrEcaser __unittestrrrrrxs'  H*hH*rPK!ȃ!&__pycache__/mock.cpython-313.opt-1.pycnu[ MiFSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ r SSK r SSK J r J r Jr SSKJr SSKJrJr SSK Jr "SS \5r\"\5Vs1sHoR1S 5(aMUiM snrS r\rS rS rSrSr Sr!Sr"S~Sjr#Sr$Sr%Sr&Sr'S~Sjr(SSjr)Sr*Sr+Sr,"SS\-5r."SS \-5r/\/"5r0\0Rbr1\0Rdr3\0Rhr51S!kr6S"r7"S#S$\85r9S%r:"S&S'\-5r;"S(S)\-5r<"S*S+\<5r=\>"\"\=5Vs1sH,nUR1S,5(dMURS,5iM. sn5r@"S-S.\85rAS/rB"S0S1\<5rC"S2S3\C\=5rDS4rE"S5S6\-5rFS7rG\1SSSSS4SS8.S9jjrHSS:jrI\1SSSSS4SS8.S;jjrJ"S<S=\-5rKS>rLS?rM\H\Jl-\K\JlN\I\JlO\M\JlPS@\JlQSArRSBrSSCRSD\SR555rVSCRSE\SR555rW1SFkrXSGrYSCR\R\S\V\W/5R5Vs1sHnSHU-iM snrZ1SIkr[SJ1r\\[\\-r]\Z\X-r^\^\]-r_1SKkr`SLSMSNSOSP.ra\b\b\b\bSQSSSSRSSS SQSST. rcSUrdSVreSWrfSXrg\d\e\f\gSY.rhSZri"S[S\\<5rj"S]S^\j\=5rk"S_S`\j5rl"SaSb\j\D5rm"ScSd\<5rn\R"\"\ RS55rq\"\ 5rr"SeSf\<5rt"SgSh\t\l\D5ru"SiSj\-5rv\v"5rwSkrx"SlSm\y5rz\z"SSn9r{SSS8.Sojjr|Spr}"SqSr\-5r~\"\|5\"\wGR54rSqSqSsrSStjr"SuSv\D5r\0GRr"SwSx\<5r"SySz\\j\D5rS{r"S|S}5rgs snfs snfs snf!\sa SrqNf=f))Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock ThreadingMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockc\rSrSrSrSrg)InvalidSpecError+z8Indicates that an invalid value was used as a mock spec.N__name__ __module__ __qualname____firstlineno____doc____static_attributes__r4/opt/alt/python313/lib64/python3.13/unittest/mock.pyrr+sBr&r_Tc[U5(a[U[5(dg[US5(a [ US5n[ U5=(d [ R"U5$)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r' _is_async_objr37sPji&@&@sJc:& s # ?w':':3'??r&c>[USS5(a [U5$g)N__code__F)r.r)funcs r'_is_async_funcr7?stZ&&"4((r&c4[[U5[5$N) issubclasstyper r1s r'r+r+Fs d3i 11r&c~[U[5=(d' [U[5=(a [U[5$r9)r, BaseExceptionr;r:r1s r' _is_exceptionr>Ls-3 & A3@*S-"@r&cj[U[5(a[US5(a UR$U$Nmock)r, FunctionTypesr-rAr1s r' _extract_mockrCSs+#}%%'#v*>*>xx r&c[U[5(aU(dURnSnOa[U[[45(a$[U[5(aSnUR nO"[U[ 5(d URnU(a [US5nOUnU[R"U54$![a gf=f![a gf=f)z Given an arbitrary, possibly callable object, try to create a suitable signature object. Return a (reduced func, signature) tuple, or None. TN) r,r;__init__ classmethod staticmethodr*rB__call__AttributeErrorrr/ signature ValueError)r6 as_instanceeat_selfsig_funcs r'_get_signature_objectrO\s $k}} D; 5 6 6 dK ( (H}} m , , ==D4&W&&x000   s$ B<$C < C C  CCFc^[XU5mTcgTunmU4Sjn[X5 U[U5lT[U5lg)Nc*>TR"U0UD6 gr9bind)selfargskwargssigs r'checksig"_check_signature..checksig $!&!r&)rO_copy_func_detailsr;_mock_check_sig __signature__)r6rA skipfirstinstancerXrWs @r'_check_signaturer`sE  :C {ID#"t&!)DJ"DJr&c dSHn[X[X55 M g![a M+f=f)N)r r$__text_signature__r! __defaults____kwdefaults__)setattrr.rI)r6funcopy attributes r'r[r[s6   G(@ A     s ! //c[U[5(ag[U[[[45(a[ UR 5$[USS5bgg)NTrHF)r,r;rGrFr _callabler*r.r1s r'ririsJ#t# k:>??&&sJ%1 r&c2[U5[[4;$r9)r;listtupler1s r'_is_listrms 9u %%r&c[U[5(d[USS5SL$U4UR-H!nURR S5cM! g g)zpGiven an object, return True if the object is callable. For classes, return True if instances would be callable.rHNTF)r,r;r.__mro____dict__get)r2bases r'_instance_callablerssY c4 sJ-T99$ ==  Z ( 4% r&c^ [U[5n[XU5nUcU$Uunm U 4Sjn[XV5 URnUR 5(dSnX`S.nSU-n [ X5 Xn [XT 5 U $)Nc*>TR"U0UD6 gr9rRrUrVrWs r'rX _set_signature..checksigrZr&rf _checksig_rAzYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r,r;rOr[r isidentifierexec _setup_func) rAoriginalr_r^resultr6rXnamecontextsrcrfrWs @r'_set_signaturers 8T*I "8y AF ~ ID#"t&   D     %4G $&* +C #mGs# Nr&c^ [U[5n[XU5unm U 4Sjn[XV5 URnX`S.nSU-n [ X5 Xn [ XT 5 [U 5 U $)Nc*>TR"U0UD6 gr9rRrvs r'rX&_set_async_signature..checksigrZr&rxzeasync def %s(*args, **kwargs): _checksig_(*args, **kwargs) return await mock(*args, **kwargs))r,r;rOr[r r{r|_setup_async_mock) rAr}r_ is_async_mockr^r6rXrrrrfrWs @r'_set_async_signaturersx 8T*I%h)DID#"t&   D%4G *,0 1C #mGs#g Nr&c^^TTlU4SjnU4SjnU4SjnU4SjnU4SjnU4SjnU4Sjn UU4Sjn S TlS TlSTl[ 5Tl[ 5Tl[ 5TlTRTlTRTl TRTl UTl UTl UTl U TlU TlUTlUTlUTlUTlTTlg) Nc(>TR"U0UD6$r9)assert_called_withrUrVrAs r'r'_setup_func..assert_called_with&&777r&c(>TR"U0UD6$r9) assert_calledrs r'r"_setup_func..assert_calleds!!42622r&c(>TR"U0UD6$r9)assert_not_calledrs r'r&_setup_func..assert_not_calleds%%t6v66r&c(>TR"U0UD6$r9)assert_called_oncers r'r'_setup_func..assert_called_oncerr&c(>TR"U0UD6$r9)assert_called_once_withrs r'r,_setup_func..assert_called_once_withs++TTR"U0UD6$r9)assert_has_callsrs r'r%_setup_func..assert_has_callss$$d5f55r&c(>TR"U0UD6$r9)assert_any_callrs r'r$_setup_func..assert_any_calls##T4V44r&c>[5Tl[5TlTR5 TRn[ U5(aUTLaUR5 gggr9) _CallList method_calls mock_calls reset_mock return_valuer+)retrfrAs r'r_setup_func..reset_mocksO({&[ "" S ! !#+ NN +6 !r&Fr)rAcalled call_count call_argsrcall_args_listrrr side_effect_mock_childrenrrrrrrrrr]_mock_delegate) rfrArWrrrrrrrrs `` r'r|r|sGL8378=65GNGG&[G$;G"G,,G**G!00G!3G&=G#/G-G#G)G 1G!3GG!Dr&c ^[RRTlSTlSTl[ 5TlU4SjnSHn[TU[X55 M g)Nrc<>[TRU5"U0UD6$r9)r.rA)attrrUrVrAs r'wrapper"_setup_async_mock..wrapper"styy$'888r&)assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listrer)rArrgs` r'rrsT ++99DDDO$;D 9,  i!<=,r&cSUSS-U:H$)N__%s__rrs r' _is_magicr4s d1Rj D ((r&c*\rSrSrSrSrSrSrSrg)_SentinelObjecti8z!A unique, named, sentinel object.cXlgr9rrTrs r'rE_SentinelObject.__init__:s r&c SUR-$Nz sentinel.%srrTs r'__repr___SentinelObject.__repr__=tyy((r&c SUR-$rrrs r' __reduce___SentinelObject.__reduce__@rr&rN) r r!r"r#r$rErrr%rr&r'rr8s'))r&rc*\rSrSrSrSrSrSrSrg) _SentineliDzAAccess attributes to return a named object, usable as a sentinel.c0Ulgr9 _sentinelsrs r'rE_Sentinel.__init__Fs r&cdUS:Xa[eURRU[U55$)N __bases__)rIr setdefaultrrs r' __getattr___Sentinel.__getattr__Is, ;  ))$0EFFr&cg)Nrrrs r'r_Sentinel.__reduce__Osr&rN) r r!r"r#r$rErrr%rr&r'rrDsKG r&r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecd[RU5 SU-nX4SjnX4Sjn[X#5$)N_mock_cLURnUc [X5$[X15$r9)rr.)rTr _the_namerWs r'_get"_delegating_property.._getds(!! ;4+ +s!!r&cXURnUcXRU'g[XBU5 gr9)rrpre)rTvaluerrrWs r'_set"_delegating_property.._setis(!! ;',MM) $ Cu %r&)_allowed_namesaddproperty)rrrrs r'_delegating_propertyras8t4I" $& D r&c \rSrSrSrSrSrg)ritc[U[5(d[RX5$[U5n[U5nX#:ag[ SX2- S-5HnXXB-nXQ:XdM g g)NFrT)r,rk __contains__lenrange)rTr len_valuelen_selfisub_lists r'r_CallList.__contains__vsn%&&$$T1 1J t9  q(.23Aak*H 4r&c@[R"[U55$r9)pprintpformatrkrs r'r_CallList.__repr__s~~d4j))r&rN)r r!r"r#rrr%rr&r'rrts  *r&rc8[U5n[U5(dgUR(d+UR(dURc UR bgUnUbXALagUR nUbMU(a XlX1lU(a XlX!lg)NFT)rCr+rrrr)parentrrnew_name_parents r'_check_and_set_parentr s % E U # #   U11    '    +G    **  !'' # r&c \rSrSrSrSrSrg) _MockIteric$[U5Ulgr9)iterr2)rTr2s r'rE_MockIter.__init__s 9r&c,[UR5$r9)nextr2rs r'__next___MockIter.__next__sDHH~r&r1N)r r!r"r#rErr%rr&r'r r s r&r c"\rSrSr\rSrSrSrg)BaseiNcgr9rrTrUrVs r'rE Base.__init__s r&r) r r!r"r#rrrrEr%rr&r'rrs  r&rc\rSrSrSr\"5rS.SjrS.SjrSr S/Sjr S0S jr S r S r S r\"\ \ \5r\S 5r\"S5r\"S5r\"S5r\"S5r\"S5rSrSr\"\\5rS1SSS.S\S\4SjjjrSrSrSrSr Sr!Sr"Sr#S r$S2S!jr%S"r&S#r'S$r(S%r)S&r*S'r+S(r,S/S)jr-S*r.S+r/S,r0S-r1g)3r iz A non-callable version of `Mock`NFc  U4n [U[5(d&U=(d UnUb[U5(a[U4n [URU SUR 05n[ [U5RU5nU$)Nr$) r:AsyncMockMixinr3r;r r$ _safe_superr __new__)clsspecrrspec_setr _spec_state _new_name _new_parent_spec_as_instance _eat_selfunsaferVbasesspec_argnewr_s r'rNonCallableMock.__new__ss#~..'4H# h(?(?'-3<<CKK(@A4<d..6&& D'C!$  r&cfURbXRlgXl[XSS5 g)NrR)rrrr )rTrs r'__set_return_value"NonCallableMock.__set_return_valueHs,    */4   ,&+ # !$tT :r&z1The value to be returned when the mock is called.cJURc [U5$UR$r9)rCr;rs r' __class__NonCallableMock.__class__Ts$    #: r&rrrrrcURnUc UR$URnUbF[U5(d6[ U[ 5(d![ U5(d[ U5nX!lU$r9)rrrcallabler,r r>)rT delegatedsfs r'__get_side_effect!NonCallableMock.__get_side_effectasb''  )) )  " " N8B<<"2y11-:K:K2B$& ! r&cR[U5nURnUcXlgXlgr9) _try_iterrrr)rTrr_s r'__set_side_effect!NonCallableMock.__set_side_effectls)% ''  %* "$) !r&rrrrc.Uc/n[U5U;agUR[U55 SUlSUlSUl[ 5Ul[ 5Ul[ 5UlU(a [Ul U(aSUl URR5H3n[U[5(d U[ LaM#UR#XUS9 M5 URn[%U5(aXPLaUR#U5 ggg)z-Restore the mock object to its initial state.NFrrg)idrKrrrrrrrrrrrvaluesr, _SpecState_deletedrr+)rTvisitedrrchildrs r'rNonCallableMock.reset_mockws ?G d8w  r$x  #+'k%K &-D # %)D "((//1E%,,0A   W[  Y2 %% S ! !co NN7 #'6 !r&c [UR5SS9HHup#URS5nUR5nUnUHn[ Xg5nM [ XeU5 MJ g)a2Set attributes on the mock through keyword arguments. Attributes plus return values and side effects can be set on child mocks using standard dot notation and unpacking a dictionary in the method call: >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError} >>> mock.configure_mock(**attrs)c*USRS5$)Nr.)count)entrys r'0NonCallableMock.configure_mock..sq1Dr&)keyrrN)sorteditemssplitpopr.re)rTrVargvalrUfinalr2rts r'r5NonCallableMock.configure_mocksbv||~$E FHC 99S>DHHJECc) C $Fr&c 6US;a [U5eURb(XR;d U[;a[SU-5eO[U5(a [U5eUR(dSUR(aXR;a3UR S5(d U[ ;a[U<SU<S35e[R URRU5nU[La [U5eUcESnURb[URU5nURXX1US9nX RU'Oe[U[ 5(aP[#UR$UR&UR(UR*UR,5nX RU'SSS5 U$![.a? UR0S=(d Un[/SU<S U<S U<S UR$<S 3 5ef=f!,(df  W$=f) N>r3rFzMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)rrrr"r#rCannot autospec attr from target , as it has already been mocked out. [target=, attr=rB)rIrF _all_magicsrr3 startswith_ATTRIB_DENY_LISTr _lockrrqrlr-r.rTr,rkr rr r_rrrrp)rTrr~r target_names r'rNonCallableMock.__getattr__s 4 4 & &    +---1D$%F%MNN2E t__ & &  $*<*<L^L^@^OPPTX\mTm$h''+h.KMNN " "((,,T2F!$T**##/$D$4$4d;E--% $..4##D)FJ// D, V__foo v{{F.4##D);#> (D"&-- "="EK*/x}&/*##'('&++CDDD/# "> s'B H $AF=%H =A HH  HcUR/nURnUnSnUS/:XaSnUbEUnURURU-5 SnURS:XaSnURnUbME[[ U55nUR =(d Sn[ U5S:aUSS;aUS- nXQS'SRU5$)NrrrRr8rAr)rRz().r)rrrKrkreversedrrjoin)rT _name_listr lastdot_firsts r'_extract_mock_name"NonCallableMock._extract_mock_names))* '' $ C!D   g44s: ;C%%-..G!(:./ *F z?Q !}M1# 1 wwz""r&cUR5nSnUS;aSU-nSnURb-SnUR(aSnX0RR-nS[ U5R<U<U<S[ U5<S3$) Nr8)rAzmock.z name=%rz spec=%rz spec_set=%r)rrCrDr r;ri)rTr name_string spec_strings r'rNonCallableMock.__repr__s&&( ( ($t+K    '$K~~, %(8(8(A(AAK J     tH   r&cL[(d[RU5$UR=(d /n[ [ U55n[ UR5nURR5VVs/sHupEU[LdMUPM nnnUVs/sHowRS5(aMUPM nnUVs/sH,owRS5(a[U5(dM*UPM. nn[[X-U-U-55$s snnfs snfs snf)z8Filter the output of `dir(mock)` to only useful members.r()r object__dir__rFrHr;rkrprryrlrrrxset)rTextras from_type from_dictm_namem_valuefrom_child_mockses r'rNonCallableMock.__dir__ sz>>$' '##)rT O ' *.*=*=*C*C*E(*Evh& *E (!*C 1c1BQ C )# 1c1B1Bq\ #c&,y8;KKLMM(D#s$<DDD9D)D!2D!c^^U[;a[RTX5$TR(a;TRb.UTR;aUTR ;a[ SU-5eU[;aSU-n[ U5eU[;aTRbUTR;a[ SU-5e[U5(d)[[T5U[X55 UmUU4SjnOb[TUSU5 [[T5X5 UTRU'O/US:XaUTlg[TX!U5(aUTRU'TR (a4[#TU5(d#TR%5SU3n[ SU35e['U[(5(aUTR U'g[RTX5$)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.c>T"T/UQ70UD6$r9r)rUkwr}rTs r'ru-NonCallableMock.__setattr__..1sHT,GD,GB,Gr&r[rrz Cannot set )rr __setattr__rDrFrprI_unsupported_magicsrr+rer; _get_methodr rrCr,r-rr,r)rTrrmsg mock_namer}s` @r'rNonCallableMock.__setattr__s > !%%dD8 8nn!3!3!? ** *  % !Dt!KL L ( (BTIC % % [ !!-$d>P>P2P$%H4%OPP$U++T D+d*BC G&dE4>T D0,1##D) [ $D  $T5==,1##D)   WT4%8%82245Qtf=I ;yk!:; ; e\ * *"'DMM$  !!$44r&cU[;a>U[U5R;a%[[U5U5 XR;agURR U[ 5nXR;a [[U5RU5 OU[La [U5eU[ La URU [URU'gr9) rr;rpdelattrrrq_missingrr __delattr__rlrI)rTrr2s r'rNonCallableMock.__delattr__Is ; 44:+>+>#> DJ %==(!!%%dH5 ==  . : :4 @ H_ & & h ##D)$,D!r&cDUR=(d Sn[X1U5$r@)r_format_call_signaturerTrUrVrs r'_format_mock_call_signature+NonCallableMock._format_mock_call_signature[s(&%d&99r&cjSnURX5nURnUR"U6nXCXW4-$)Nz0expected %s not found. Expected: %s Actual: %s)rr)rTrUrVactionmessageexpected_stringr actual_strings r'_format_mock_failure_message,NonCallableMock._format_mock_failure_message`s>F::4HNN 88)D /AAAr&c:U(d UR$SnURSS5RS5nURnUHRnUR U5nUb[ U[ 5(a U$[U5nURnURnMT U$)a * If call objects are asserted against a method/function like obj.meth1 then there could be no name for the call object to lookup. Hence just return the spec_signature of the method/function being asserted against. * If the name is not empty then remove () and split by '.' to get list of names to iterate through the children until a potential match is found. A child mock is created only during attribute access so if we get a _SpecState then no attributes of the spec were accessed and can be safely exited. NrRr8rr)rEreplacerzrrqr,rkrC)rTrrWnameschildrenrns r'_get_call_signature_from_name-NonCallableMock._get_call_signature_from_namehs'' ' T2&,,S1&&DLL&E} 5* = = &e, //++ r&c[U[5(a$[U5S:aURUS5nO URnUbN[U5S:XaSnUupEOUup4nUR "U0UD6n[ X6RUR5$U$![anURS5sSnA$SnAff=f)z Given a call (or simply an (args, kwargs) tuple), return a comparison key suitable for matching with other calls. This is a best effort method which relies on the spec's signature, if available, or falls back on the arguments themselves. rrNr8) r,rlrrrErSrrUrV TypeErrorwith_traceback)rT_callrWrrUrV bound_callrs r' _call_matcherNonCallableMock._call_matchers eU # #E Q44U1X>C&&C ?5zQ$ f%*"F . XXt6v6 D//:3D3DEEL .''-- .s%1B B>#B93B>9B>cURS:waDSUR=(d S<SUR<SUR5<3n[U5eg)z/assert that the mock was never called. r Expected 'rAz"' to not have been called. Called  times.Nrr _calls_reprAssertionErrorrTrs r'r!NonCallableMock.assert_not_calledsK ??a oo//oo&&(*C!% % r&cjURS:Xa#SUR=(d S-n[U5eg)z6assert that the mock was called at least once rz"Expected '%s' to have been called.rAN)rrrrs r'rNonCallableMock.assert_calleds6 ??a 7OO-v/C % % r&cURS:XdDSUR=(d S<SUR<SUR5<3n[U5eg)z3assert that the mock was called only once. rrrAz#' to have been called once. Called rNrrs r'r"NonCallableMock.assert_called_oncesK!#oo//oo&&(*C!% % $r&cP^^^TRc)TRTT5nSnSU<SU<3n[U5eUUU4SjnTR[ TT4SS95nTRTR5nXC:wa*[ U[ 5(aUOSn[U"55Ueg)zassert that the last call was made with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.Nz not called.z#expected call not found. Expected: Actual: c,>TRTT5nU$r9rrrUrVrTs r'_error_message:NonCallableMock.assert_called_with.._error_messages33D&ACJr&Ttwo)rrrr_Callr, Exception)rTrUrVexpectedactual error_messagercauses``` r'r"NonCallableMock.assert_called_withs >> !77fEH"F)M / / %%eT6N&EF##DNN3   *8Y ? ?HTE !12 = r&cURS:XdDSUR=(d S<SUR<SUR5<3n[U5eUR"U0UD6$)zaassert that the mock was called exactly once and that that call was with the specified arguments.rrrAz' to be called once. Called r)rrrrrrTrUrVrs r'r'NonCallableMock.assert_called_once_withs\!#oo//oo&&(*C!% %&&777r&c ^UVs/sHnTRU5PM nn[SU5S5n[U4SjTR55nU(duXF;aoUcSnO9SR UVs/sHn[ U[ 5(aUOSPM sn5n[US[U5S[TR535Ueg[U5n/n UHn URU 5 M U (a4[TR=(d S<S [U 5<S U<S 35Uegs snfs snf![a U RU 5 M}f=f) aWassert the mock has been called with the specified calls. The `mock_calls` list is checked for the calls. If `any_order` is False (the default) then the calls must be sequential. There can be extra calls before or after the specified calls. If `any_order` is True then the calls can be in any order, but they must all appear in `mock_calls`.c3T# UHn[U[5(dMUv M g7fr9r,r.0rs r' 3NonCallableMock.assert_has_calls..FAZ9-Eaa( (Nc3F># UHnTRU5v M g7fr9rrcrTs r'rrsM_d0033_!zCalls not found.z+Error processing expected calls. Errors: {} Expected: rrAz does not contain all of z in its call list, found z instead)rrrrformatr,rrrrkremoverKrKrrl) rTcalls any_orderrrr all_callsproblemr not_foundkalls ` r'r NonCallableMock.assert_has_callsss4995aD&&q)59FFMMT__MM (=0G ,-3V-5$7-5*4Ay)A)AAt$K-5$7.8%i !!*5!1 23!!*4??!; <>  O  D '  &  &*oo&?&?&+I&6 C   7:$7 '  & 'sD56#D:$D??EEc4UR[X4SS95n[U[5(aUOSnURVs/sHoPRU5PM nnU(dU[ U5;a UR X5n[SU-5Uegs snf)zassert the mock has been called with the specified arguments. The assert passes if the mock has *ever* been called, unlike `assert_called_with` and `assert_called_once_with` that only pass if the call is the most recent one.TrNz%s call not found)rrr,rr _AnyComparerrrrTrUrVrrrrrs r'rNonCallableMock.assert_any_calls %%eTN&EF&x;;151D1DE1DA$$Q'1DE HL$88">>tLO #o5 9FBc UR(a.SU;aSUS3OSnUR5U-n[U5eURS5nX@RS;a [ S0UD6$[ U5n[U[5(aU[;a[ nO[U[5(a8U[;d UR(aX@R;a[nOc[ nO\[U[5(d8[U[5(a[nO+[U[5(a[ nOUR"SnW"S0UD6$)a(Create the child mocks for attributes and return value. By default child mocks will be the same type as the parent. Subclasses of Mock may want to override this to customize the way child mocks are made. For non-callable mocks the callable variant will be used (rather than any custom subclass).rrrrRr"rGrr)r,rrIrqrpr r;r:r_async_method_magicsr_all_sync_magicsrF CallableMixinrr rro)rTrrgrr"_typeklasss r'rTNonCallableMock._get_child_mocks   ,2bL!BvJ<(dI//1I=I + +FF;'  n5 5?r? "T  eY ' 'I9M,ME ~ . .--&&98J8J+J!!E=11%!566!E?33MM!$E{r{r&cXUR(dgS[UR5S3$)zRenders self.mock_calls as a string. Example: " Calls: [call(1), call(2)]." If self.mock_calls is empty, an empty string is returned. The output will be truncated if very long. r8z Calls: rr)rrrs r'rNonCallableMock._calls_reprEs'9T__56a88r&) rrrCrrrrrrr) NNNNNNr8NFNFFFFr9)r)2r r!r"r#r$rrrrEr:r?r4"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr[rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrboolrr5rrrrrrrrrrrrrrrrrrTrr%rr&r'r r s`* GE=AEIBEI, 8*Z  #L 9r&r assert_c\rSrSrSrSrSrg)r iZzA list which checks if it contains a call which may have an argument of ANY, flipping the components of item and self from their traditional locations so that ANY is guaranteed to be on the left.c UH5n[[X5VVs/sH up4X4:HPM snn5(dM5 g gs snnf)NTF)allzip)rTitemrrrs r'r_AnyComparer.__contains___sNE(+D(8(8$H"(8  s= rN)r r!r"r#r$rr%rr&r'r r Zs r&r cUcU$[U5(aU$[U5(aU$[U5$![a Us$f=fr9)r>rirrr1s r'rdrdjsO { S ~~ Cy  s 6 AAc P\rSrSrSS\SSSSSSS4 SjrSrSrSrSr S r S r g) riyNr8c vX0RS'[[U5R"XXVUXU 40U D6 X lg)Nr)rprrrEr) rTrrrrrr rr!r"r#rVs r'rECallableMixin.__init__{sB/; *+M4(11  K 39 'r&cgr9rrs r'r\CallableMixin._mock_check_sigs r&cnUR"U0UD6 UR"U0UD6 UR"U0UD6$r9)r\_increment_mock_call _mock_callrs r'rHCallableMixin.__call__s> d-f- !!4262///r&c&UR"U0UD6$r9)_execute_mock_callrs r'r.CallableMixin._mock_calls&&777r&cLSUl[R [X4SS9nX0lUR R U5 [UR 5UlSSS5 URSLnURnURnUS:HnURR [SX455 URnUbU(aMURR [XQU455 URSLnU(aURS-U-n[XaU45n URR U 5 UR(a-U(aSn OSn URS:HnURU -U-nURnUbMgg!,(df  GN<=f)NTrrRr8rr)rr rrrrrKrrrrrrrr) rTrUrVrdo_method_callsmethod_call_namemock_call_name is_a_callr#this_mock_callrs r'r-"CallableMixin._increment_mock_calls  " " 4.d3E"N    & &u -!$"5"56DO#++47??,,"d*  ub$%789++ %((//7Gv6V0WX"-":":$"F"'2'='='CFV'V$#N&#ABN  " " ) ). 9))CC'66$> !,!;!;c!AN!R&66K-%-# "s AF F#cURnUbS[U5(aUe[U5(d[U5n[U5(aUeOU"U0UD6nU[LaU$UR [La UR $UR(a)URR [La UR $URbUR"U0UD6$UR $r9) rr>rirrrrrr-)rTrUrVeffectr~s r'r1 CallableMixin._execute_mock_calls!!  V$$ v&&f (( L) 00W$  " "' 1$$ $   4#6#6#C#C7#R$$ $    '##T4V4 4   r&)rrrr) r r!r"r#rrEr\rHr.r-r1r%rr&r'rrys8 d$d!RT ' 0827h!r&rc\rSrSrSrSrg)ria Create a new `Mock` object. `Mock` takes several optional arguments that specify the behaviour of the Mock object: * `spec`: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an `AttributeError`. If `spec` is an object (rather than a list of strings) then `mock.__class__` returns the class of the spec object. This allows mocks to pass `isinstance` tests. * `spec_set`: A stricter variant of `spec`. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as `spec_set` will raise an `AttributeError`. * `side_effect`: A function to be called whenever the Mock is called. See the `side_effect` attribute. Useful for raising exceptions or dynamically changing return values. The function is called with the same arguments as the mock, and unless it returns `DEFAULT`, the return value of this function is used as the return value. If `side_effect` is an iterable then each call to the mock will return the next value from the iterable. If any of the members of the iterable are exceptions they will be raised instead of returned. * `return_value`: The value returned when the mock is called. By default this is a new Mock (created on first access). See the `return_value` attribute. * `unsafe`: By default, accessing any attribute whose name starts with *assert*, *assret*, *asert*, *aseert*, or *assrt* raises an AttributeError. Additionally, an AttributeError is raised when accessing attributes that match the name of an assertion method without the prefix `assert_`, e.g. accessing `called_once` instead of `assert_called_once`. Passing `unsafe=True` will allow access to these attributes. * `wraps`: Item for the mock object to wrap. If `wraps` is not None then calling the Mock will pass the call through to the wrapped object (returning the real result). Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist will raise an `AttributeError`). If the mock has an explicit `return_value` set then calls are not passed to the wrapped object and the `return_value` is returned instead. * `name`: If the mock has a name then it will be used in the repr of the mock. This can be useful for debugging. The name is propagated to child mocks. Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. rNrrr&r'rrs7r&rcBSnUHnX ;dM [U<S35e g)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r'_check_spec_arg_typosrF's/ 2E  "(OP r&c\rSrSrSr/rSS.SjrSrSrSr \ RS 5r S r S rS rS rSrSrSrSrg)_patchi0NFr&c Ub"U[La [S5eUb [S5eU (d [U 5 [U5(a[ SU<SU<S35e[U5(a[ SU<SU<S35eXlX lX0lXlX@l XPl SUl X`l Xpl Xl/UlSUlg)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=rBz? as the spec_set target has already been mocked out. [spec_set=F)rrKrFr+rgetterrgr) new_callablercreate has_localr autospecrVadditional_patchers is_started) rTrKrgr)rrMr rOrLrVr&s r'rE_patch.__init__5s  #'! B# G !& ) T " ""#I=166:XQ@A A X & &"#I=1AAI AOP P "(     #% r&c j[URURURURUR UR URURUR5 nURUl URVs/sHo"R5PM snUl U$s snfr9) rHrKrgr)rrMr rOrLrVattribute_namerPcopy)rTpatcherps r'rU _patch.copy[s KK499 KK MM4,,dkk  "&!4!4"66' 6FFH6' #' s B0c[U[5(aURU5$[R"U5(aUR U5$UR U5$r9r,r;decorate_classr/rdecorate_async_callabledecorate_callable)rTr6s r'rH_patch.__call__hsS dD ! !&&t, ,  & &t , ,//5 5%%d++r&c[U5HinUR[R5(dM)[ X5n[ US5(dMGUR 5n[XU"U55 Mk U$NrH)rHrr TEST_PREFIXr.r-rUre)rTrr attr_valuerVs r'r[_patch.decorate_classpscJD??5#4#455 -J:z22iikG E!4 5 r&c#h# /n[R"5nURHZnURU5nURbUR U5 M4UR [LdMIURU5 M\ U[U5- nX#4v SSS5 g!,(df  g=f7fr9) contextlib ExitStack patchings enter_contextrTupdater)rrKrl)rTpatchedrUkeywargs extra_args exit_stackpatchingr|s r'decoration_helper_patch.decoration_helper~s  ! ! #z#-- ..x8**6OOC(\\W,%%c* . E*% %D" "$ # #s#B2AB!0(B! B2! B/+B2c^^^[TS5(aTRRT5 T$[T5UUU4Sj5mT/TlT$)Nrgct>TRTUU5up#T"U0UD6sSSS5 $!,(df  g=fr9rorUrknewargs newkeywargsr6rjrTs r'rj)_patch.decorate_callable..patcheds;''(,(025KgW4 4222s ) 7r-rgrKrrTr6rjs``@r'r]_patch.decorate_callablesN 4 % % NN ! !$ 'K t 5  5 "Fr&c^^^[TS5(aTRRT5 T$[T5UUU4Sj5mT/TlT$)Nrgc># TRTUU5up#T"U0UD6IShvN sSSS5 $N !,(df  g=f7fr9rsrts r'rj/_patch.decorate_async_callable..patchedsJ''(,(025Kg!7:k::22;22s$A535 A5 AArxrys``@r'r\_patch.decorate_async_callablesN 4 % % NN ! !$ 'K t ;  ; "Fr&cdUR5nURn[nSnURUnSnU[;a[U[5(aSUl UR(dU[La[ U<SU<35eX44$![[ 4a [ X[5nNwf=f)NFTz does not have the attribute ) rKrgrrprIKeyErrorr. _builtinsr,rrM)rTtargetrr}locals r' get_original_patch.get_originals~~ t,HE 9 FJ!?!?DK{{x72 7=tD ) 6vW5H 6sB B/.B/c J UR(a [S5eURURURp2nUR UR pTURnUR5Ul USLaSnUSLaSnUSLaSnUbUb [S5eUcUbUS;a [S5eUR5upxU[LGaUGcSn USLa UnUSLaUnSnOUb USLaUnSnOUSLaUnUcUb+U[La [S5e[U[5(aSn UbUn OUc[U5(a[ n OeUcUbYUn UbUn [#U 5(aS U ;n O[%U 5(+n [U 5(a[ n OU (a[&n O [(n O[(n 0n UbX-S 'UbX=S '[U [5(a5[+U [,5(a UR.(aUR.U S 'U R1U5 U "S0U D6nU (a^[3U5(aNUn UbUn [#U 5(d[5U 5(d[&n U R7S 5 U "SUS S.U D6UlGOUbU[La [S5eU[La [S5e[;U5nUSLaUn[3UR5(a,[=SUR.<SUR<SU<S35e[3U5(aQ[?URSUR5n[=SUR.<SU<SUR<SU<S3 5e[AU4UUR.S.UD6nOU(a [S5eUnXpl!Xl"[FRH"5Ul%SUl[MURUR.U5 URNbz0nUR[LaUUURN'URPHDnURJRSU5nUR[LdM3UR1U5 MF U$U$! URT"[VRX"56(deg=f)zPerform the patch.zPatch is already startedFNzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerHrr rrRrSzBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=Truerz: as the patch target has already been mocked out. [target=rrBr rr)r _namez.Can't pass kwargs to a mock we aren't creatingr)-rQrBr)rr rOrVrLrKrrrrr,r;r3r rmr^rrr:r rgrir+rsr{rrrr.r temp_originalis_localrerf _exit_stackrerTrPrh__exit__sysexc_info)rTr)rr rOrVrLr}rinheritKlass this_spec not_callable_kwargsrnew_attrrlrnr|s r' __enter___patch.__enter__s ??9: :"hh 4==8==$++&(( kkm  5=D u H u H   4=> >  !5 L (TU U++- '>h.Gt|t#'HD!t##HDT!#8#7w&#$GHHh--"G'$-"9"9!!X%9 ' (II&&#-Y#>L'/ ':#:L ++%E!0E%E!G"&#&. #5$''5/22t~~"&.. NN6 ""'"C,S11! ' (I ++&y110E F##($4SD$4+2$4  !'!(7" GHHH~H4# --&+DNN+=>#{{oWXLCDD!**%dkk:t{{K &+DNN+=]"o&#{{oWXLCDD "(BX(,B:@BC LM M% %//1  DKK :"". 88w&7:Jt223 $ 8 8H**88BC||w."))#.!9"!J ==#,,.12s B Q6Q64Q66*R"c<UR(dgUR(a?UR[La,[ UR UR UR5 O[UR UR 5 UR(d`[UR UR 5(aUR S;a+[ UR UR UR5 U?U?U?URnU? SUlUR"U6$)zUndo the patch.N)r$r!rc__annotations__rdF) rQrrrrerrgrrMr-rr)rTrrms r'r_patch.__exit__as  ==T//w> DKK1C1C D DKK 0;; T^^(L(L+== T^^T5G5GH   M K%%  ""H--r&c\UR5nURRU5 U$z-Activate a patch, returning any created mock.)r_active_patchesrKrTr~s r'start _patch.startzs'! ##D) r&cURRU5 URSSS5$![a gf=fzStop an active patch.N)rrrKrrs r'stop _patch.stopsD   ' ' - }}T4..   s 0 ==)rrPrgrOrMrKrNrrQrVr)rLrr rr)r r!r"r#rTrrErUrHr[recontextmanagerror]r\rrrrrr%rr&r'rHrH0sgNOAF# L ,  # #""0Xt.2/r&rHcURSS5up[ [ R U5U4$![[[4a [SU<35ef=f)Nrrrz,Need a valid target to patch. You supplied: )rsplitrrKrIrpkgutil resolve_name)rrgs r' _get_targetrshG"MM#q1 7'' 0) ;; z> 2G:6* EG GGs 2%ArIc n^[T5[La[T<S35eU4Sjn [XX#UXVXyUS9 $)a patch the named member (`attribute`) on an object (`target`) with a mock object. `patch.object` can be used as a decorator, class decorator or a context manager. Arguments `new`, `spec`, `create`, `spec_set`, `autospec` and `new_callable` have the same meaning as for `patch`. Like `patch`, `patch.object` takes arbitrary keyword arguments for configuring the mock object it creates. When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. z3 must be the actual object to be patched, not a strc>T$r9rrsr'ru_patch_object..sVr&rI)r;strrrH) rrgr)rrMr rOrLr&rVrKs ` r' _patch_objectrsK$ F|sjK L  F 3fL r&c x^[T5[La[[RT5nOU4SjnU(d [ S5e[ UR55nUSup[XyXX#XE05 n Xl USSH5up[XyXX#XE05 n Xl U RRU 5 M7 U $)aPerform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the patches:: with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): ... Use `DEFAULT` as the value if you want `patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, and a dictionary is returned when `patch.multiple` is used as a context manager. `patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments `spec`, `spec_set`, `create`, `autospec` and `new_callable` have the same meaning as for `patch`. These arguments will be applied to *all* patches done by `patch.multiple`. When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX` for choosing which methods to wrap. c>T$r9rrsr'ru!_patch_multiple..sr&z=Must supply at least one keyword argument with patch.multiplerrN) r;rrrrrKrkryrHrTrPrK) rrrMr rOrLrVrKryrgr)rV this_patchers ` r'_patch_multiplers, F|s--v6  K    E1XNI3fG')  s& B '0###**<8 $ Nr&c 8[U5up[XXUXEXhUS9 $)aV `patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the `target` is patched with a `new` object. When the function/with statement exits the patch is undone. If `new` is omitted, then the target is replaced with an `AsyncMock if the patched object is an async function or a `MagicMock` otherwise. If `patch` is used as a decorator and `new` is omitted, the created mock is passed in as an extra argument to the decorated function. If `patch` is used as a context manager the created mock is returned by the context manager. `target` should be a string in the form `'package.module.ClassName'`. The `target` is imported and the specified object replaced with the `new` object, so the `target` must be importable from the environment you are calling `patch` from. The target is imported when the decorated function is executed, not at decoration time. The `spec` and `spec_set` keyword arguments are passed to the `MagicMock` if patch is creating one for you. In addition you can pass `spec=True` or `spec_set=True`, which causes patch to pass in the object being mocked as the spec/spec_set object. `new_callable` allows you to specify a different class, or callable object, that will be called to create the `new` object. By default `AsyncMock` is used for async functions and `MagicMock` for the rest. A more powerful form of `spec` is `autospec`. If you set `autospec=True` then the mock will be created with a spec from the object being replaced. All attributes of the mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise a `TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. Instead of `autospec=True` you can pass `autospec=some_object` to use an arbitrary object as the spec instead of the one being replaced. By default `patch` will fail to replace attributes that don't exist. If you pass in `create=True`, and the attribute doesn't exist, patch will create the attribute for you when the patched function is called, and delete it again afterwards. This is useful for writing tests against attributes that your production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist! Patch can be used as a `TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods share a common patchings set. `patch` finds tests by looking for method names that start with `patch.TEST_PREFIX`. By default this is `test`, which matches the way `unittest` finds tests. You can specify an alternative prefix by setting `patch.TEST_PREFIX`. Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use "as" then the patched object will be bound to the name after the "as"; very useful if `patch` is creating a mock object for you. Patch will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `patch` takes arbitrary keyword arguments. These will be passed to `AsyncMock` if the patched object is asynchronous, to `MagicMock` otherwise or to `new_callable` if specified. `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are available for alternate use-cases. rI)rrH) rr)rrMr rOrLr&rVrKrgs r'rrs-V$F+F 3fL r&c^\rSrSrSrSSjrSrSrSrSr Sr S r S r S r S rS rSrg) _patch_dicti6a Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test. `in_dict` can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys. `in_dict` can also be a string specifying the name of the dictionary, which will then be fetched by importing it. `values` can be a dictionary of values to set in the dictionary. `values` can also be an iterable of `(key, value)` pairs. If `clear` is True then the dictionary will be cleared before the new values are set. `patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary:: with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()): ... `patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator `patch.dict` honours `patch.TEST_PREFIX` for choosing which methods to wrap. c Xl[U5UlURRU5 X0lSUlgr9)in_dictdictrjriclear _original)rTrrjrrVs r'rE_patch_dict.__init__Ss0 6l  6" r&c[U[5(aURU5$[R"U5(aUR U5$UR U5$r9rZ)rTfs r'rH_patch_dict.__call__\sS a  &&q) )  & &q ) )//2 2%%a((r&c4^^[T5UU4Sj5nU$)Nc>TR5 T"U0UD6TR5 $!TR5 f=fr9r _unpatch_dictrUrrrTs r'_inner-_patch_dict.decorate_callable.._inneres8     %$~"~""$""$s+=rrTrrs`` r'r]_patch_dict.decorate_callabled q %  % r&c4^^[T5UU4Sj5nU$)Nc># TR5 T"U0UD6IShvN TR5 $N!TR5 f=f7fr9rrs r'r3_patch_dict.decorate_async_callable.._innerqsC     %^^+""$,""$s%A  757A 7A  A rrs`` r'r\#_patch_dict.decorate_async_callableprr&c0[U5Hn[X5nUR[R5(dM4[ US5(dMG[ URURUR5nU"U5n[XU5 M U$r`) rHr.rrrar-rrrjrre)rTrrrb decorator decorateds r'r[_patch_dict.decorate_class|sqJD -J 1 122Z00' dkk4::N %j1 Y/  r&c:UR5 UR$)zPatch the dict.)rrrs r'r_patch_dict.__enter__s ||r&cURn[UR[5(a%[R "UR5UlURnUR nUR5nX@l U(a [U5 URU5 g![a 0nUH nX%XE'M NHf=f![a UH nXX%'M gf=fr9) rjr,rrrrrrUrIr _clear_dictri)rTrjrrr}rws r'r_patch_dict._patch_dicts dllC ( ("// =DL,,  -||~H"    + NN6 " -H '    - +%{  +s$*B%C%CCC"!C"cURnURn[U5 URU5 g![a UH nX#X'M gf=fr9)rrrrirI)rTrr}rws r'r_patch_dict._unpatch_dictsO,,>>G - NN8 $ -'}   -s7AAc>URbUR5 g)zUnpatch the dict.F)rr)rTrUs r'r_patch_dict.__exit__s >> %    r&cdUR5n[RRU5 U$r)rrHrrKrs r'r_patch_dict.starts'!%%d+ r&c[RRU5 UR SSS5$![a gf=fr)rHrrrKrrs r'r_patch_dict.stopsD   " " ) )$ / }}T4..   s4 AA)rrrrjN)rF)r r!r"r#r$rErHr]r\r[rrrrrrr%rr&r'rr6s>8)   +8 -/r&rcrUR5 g![a [U5nUHnX M gf=fr9)rrIrk)rkeysrws r'rrs7  G}C s  66cd[[R5HnUR5 M g)z7Stop all active patches. LIFO to unroll nested patches.N)rrHrr)rs r'_patch_stopallrs &001 2r&testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c#,# UH nSU-v M g7f)zi%sNrrns r'rrs7&6519&6c#,# UH nSU-v M g7f)zr%sNrrs r'rrs5$4q$4r>r__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c ^U4SjnXlU$)z:Turns a callable object (like a mock) into a real functionc>T"U/UQ70UD6$r9r)rTrUrr6s r'method_get_method..method sD&4&2&&r&)r )rr6rs ` r'rrs'O Mr&r> __aexit__ __anext__ __aenter__ __aiter__>__del__rrEr __prepare__r__instancecheck____subclasscheck__c,[RU5$r9)r__hash__rs r'ruru%s V__T2r&c,[RU5$r9)r__str__rs r'ruru&s FNN40r&c,[RU5$r9)r __sizeof__rs r'ruru'sv006r&cj[U5RSUR5S[U53$)N/)r;r rrirs r'ruru(s3$t*"5"5!6a8O8O8Q7RRSTVW[T\S]^r&)rrr  __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r __complex__ __float____bool__ __index__rc^U4SjnU$)Nc^>TRRnU[LaU$TULag[$NT)__eq__rrNotImplemented)otherret_valrTs r'r_get_eq..__eq__=s/++00 ' !N 5=r&r)rTrs` r'_get_eqr <s Mr&c^U4SjnU$)Ncb>TRR[La[$TULag[$NF)__ne__rrr)rrTs r'r$_get_ne..__ne__Gs* ;; ) ) 8N 5=r&r)rTr$s` r'_get_ner&Fs Mr&c^U4SjnU$)Ncn>TRRnU[La [/5$[U5$r9)__iter__rrrrrTs r'r)_get_iter..__iter__Ps/--22 g 8OG}r&r)rTr)s` r' _get_iterr,Os Or&c^U4SjnU$)Nc>TRRnU[La[[ /55$[[ U55$r9)rrr_AsyncIteratorrr*s r'r"_get_async_iter..__aiter__Zs8..33 g !$r(+ +d7m,,r&r)rTrs` r'_get_async_iterr1Ys- r&)rr$r)rc[RU[5nU[LaX1lg[RU5nUbU"U5nXQlg[ RU5nUbU"U5Ulggr9)_return_valuesrqrr_calculate_return_value_side_effect_methodsr)rArrfixedreturn_calculatorr side_effectors r'_set_return_valuer9jsw   tW -E G#/33D9$(. *(,,T2M *40!r&c \rSrSrSrSrSrg) MagicMixini|cUR5 [[U5R"U0UD6 UR5 gr9)_mock_set_magicsrr;rE)rTrUrs r'rEMagicMixin.__init__}s4 J%..;; r&c [[-nUn[USS5bXURUR5n[ 5nX- nUH)nU[ U5R;dM[X5 M+ U[ [ U5R5- n[ U5nUHn[XT[X@55 M g)NrF) _magicsrr. intersectionrFrr;rprre MagicProxy)rT orig_magics these_magics remove_magicsrtrs r'r=MagicMixin._mock_set_magicss 44 " 4$ / ;&33D4F4FGLEM'6M&DJ///D(' $c$t**=*=&>> T !E E*U"9 :"r&rN)r r!r"r#rEr=r%rr&r'r;r;|s  ;r&r;c"\rSrSrSrSSjrSrg)riz-A version of `MagicMock` that isn't callable.cFURX5 UR5 gr=r4r=r>s r'r?"NonCallableMagicMock.mock_add_spec D+ r&rNr)r r!r"r#r$r?r%rr&r'rrs 7 r&rc\rSrSrSrg)AsyncMagicMixinirN)r r!r"r#r%rr&r'rMrMsr&rMcF^\rSrSrSrS SjrSS.S\4U4SjjjrSrU=r $) riah MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself. If you use the `spec` or `spec_set` arguments then *only* magic methods that exist in the spec will be created. Attributes and the return value of a `MagicMock` will also be `MagicMocks`. FcFURX5 UR5 gr=rIr>s r'r?MagicMock.mock_add_specrKr&)rrc>U(a-UR(a[UR5(aSn[5R"USU0UD6 g)NFr)rrsuperr)rTrrUrVr[s r'rMagicMock.reset_mocks= $//** !L DF|FvFr&rr) r r!r"r#r$r?rrr% __classcell__r[s@r'rrs&  9> G G Gr&rc*\rSrSrSrSrSSjrSrg)rBicXlX lgr9rr)rTrrs r'rEMagicProxy.__init__s   r&cURnURnURXUS9n[X!U5 [ X#U5 U$)N)rr"r#)rrrTrer9)rTrtrms r' create_mockMagicProxy.create_mocksG   " "/5 # 7q!&U+r&Nc"UR5$r9)r\)rTr2rs r'rMagicProxy.__get__s!!r&rXr9)r r!r"r#rEr\rr%rr&r'rBrBs"r&rBc^\rSrSr\"S5r\"S5r\"S5rU4SjrSr Sr Sr S r S r S rSS jrS rU4SjrSrU=r$)rirrrc>[5R"U0UD6 [RRUR S'SUR S'SUR S'[ 5UR S'[(a4[[S9n[UR S'[UR S'O [[S9n[R[R-[R-UlSUlS UlSUlSUlX0R S 'S UR S '[)5UR S '0UR S'SUR S'g)Nrr_mock_await_count_mock_await_args_mock_await_args_listr rCrE)rUrVr5r r rcrdr)rRrErrrrpr _CODE_SIGr _CODE_ATTRSrr/ CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountrl)rTrUrV code_mockr[s r'rEAsyncMockMixin.__init__s4 $)&)*1););)I)I o&-. )*,0 ()1: -. 9'=I08I  } -4=I  0 1':I     !$$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(r&c# [X4SS9nU=RS- slX0lURR U5 UR nUbu[ U5(aUe[U5(d[U5n[ U5(aUeO)[U5(aU"U0UD6IShvN nOU"U0UD6nU[LaU$UR[La UR$URbF[UR5(aUR"U0UD6IShvN $UR"U0UD6$UR$![a [ef=fNN87f)NTrr)rrrrrKrr>rir StopIterationStopAsyncIterationrrrrr-)rTrUrVrr;r~s r'r1!AsyncMockMixin._execute_mock_call s^tn$/ A ##E*!!  V$$ v&&-!&\F !(( L)$V,,%t6v6600W$  " "' 1$$ $    '"4#3#344!--t>v>>>##T4V4 4   -%--,-7?s=A3E6 E.E/E0A3E#E$"EEEEclURS:Xa$SUR=(d SS3n[U5eg)z1 Assert that the mock was awaited at least once. r Expected rAz to have been awaited.Nrrrrs r'rAsyncMockMixin.assert_awaited3 s;   q doo788NOC % % !r&cURS:Xd1SUR=(d SSURS3n[U5eg)z0 Assert that the mock was awaited exactly once. rrwrA$ to have been awaited once. Awaited rNrxrs r'r"AsyncMockMixin.assert_awaited_once; sM1$t8&9:#//09C % %%r&c@^^^TRc!TRTT5n[SUS35eUUU4SjnTR[ TT4SS95nTRTR5nXS:wa*[ U[ 5(aUOSn[U"55Ueg)z> Assert that the last await was with the specified arguments. NzExpected await: z Not awaitedc*>TRTTSS9nU$)Nawait)rrrs r'r:AsyncMockMixin.assert_awaited_with.._error_messageL s33D&3QCJr&Tr)rrrrrr,r)rTrUrVrrrrs``` r'r"AsyncMockMixin.assert_awaited_withD s ?? "77fEH #3H:]!KL L %%eT6N&EF##DOO4   *8Y ? ?HTE !12 = r&cURS:Xd1SUR=(d SSURS3n[U5eUR"U0UD6$)zQ Assert that the mock was awaited exactly once and with the specified arguments. rrwrAr{r)rrrrrs r'r'AsyncMockMixin.assert_awaited_once_withV s^ 1$t8&9:#//09C % %''888r&c4UR[X4SS95n[U[5(aUOSnURVs/sHoPRU5PM nnU(dU[ U5;a UR X5n[SU-5Uegs snf)zE Assert the mock has ever been awaited with the specified arguments. TrNz%s await not found)rrr,rrr rrr s r'rAsyncMockMixin.assert_any_awaita s%%eTN&EF&x;;151E1EF1EA$$Q'1EF HL$88">>tLO $6 9Gr c z^UVs/sHnTRU5PM nn[SU5S5n[U4SjTR55nU(dlXF;afUcSnO9SR UVs/sHn[ U[ 5(aUOSPM sn5n[US[U5STR35Ueg[U5n/n UHn URU 5 M U (a[[U 5<S35Uegs snfs snf![a U RU 5 Mbf=f) at Assert the mock has been awaited with the specified calls. The :attr:`await_args_list` list is checked for the awaits. If `any_order` is False (the default) then the awaits must be sequential. There can be extra calls before or after the specified awaits. If `any_order` is True then the awaits can be in any order, but they must all appear in :attr:`await_args_list`. c3T# UHn[U[5(dMUv M g7fr9rrs r'r3AsyncMockMixin.assert_has_awaits..{ rrNc3F># UHnTRU5v M g7fr9rrs r'rr| s!S>Rt11!44>RrzAwaits not found.z,Error processing expected awaits. Errors: {}rz Actual: z not all found in await list) rrrrrr,rrrkrrKrKrl) rTrrrrr all_awaitsrrrrs ` r'r AsyncMockMixin.assert_has_awaitsn s]4995aD&&q)59FFMSd>R>RSS )=1G ,-3V-5$7-5*4Ay)A)AAt$K-5$7.8%i !!*5!1 23#3346  *%  D '!!$'  49)4DF  7:$7 '  & 'sD6#DDD:9D:cURS:wa1SUR=(d SSURS3n[U5eg)z) Assert that the mock was never awaited. rrwrAz# to not have been awaited. Awaited rNrxrs r'r!AsyncMockMixin.assert_not_awaited sM   q t8&9:#//09C % % !r&ct>[5R"U0UD6 SUlSUl[ 5Ulg) See :func:`.Mock.reset_mock()` rN)rRrrrrrrTrUrVr[s r'rAsyncMockMixin.reset_mock s3 D+F+({r&)rrrr)r r!r"r#rrrrrEr1rrrrrrrrr%rTrUs@r'rrs\&}5K%l3J*+<=O0B&!P&&>$ 9 *X&++r&rc\rSrSrSrSrg)r i a Enhance :class:`Mock` with features allowing to mock an async function. The :class:`AsyncMock` object will behave so the object is recognized as an async function, and the result of a call is an awaitable: >>> mock = AsyncMock() >>> iscoroutinefunction(mock) True >>> inspect.isawaitable(mock()) True The result of ``mock()`` is an async function which will have the outcome of ``side_effect`` or ``return_value``: - if ``side_effect`` is a function, the async function will return the result of that function, - if ``side_effect`` is an exception, the async function will raise the exception, - if ``side_effect`` is an iterable, the async function will return the next value of the iterable, however, if the sequence of result is exhausted, ``StopIteration`` is raised immediately, - if ``side_effect`` is not defined, the async function will return the value defined by ``return_value``, hence, by default, the async function returns a new :class:`AsyncMock` object. If the outcome of ``side_effect`` or ``return_value`` is an async function, the mock async function obtained when the mock object is called will be this async function itself (and not an async function returning an async function). The test author can also specify a wrapped object with ``wraps``. In this case, the :class:`Mock` object behavior is the same as with an :class:`.Mock` object: the wrapped object may have methods defined as async function functions. Based on Martin Richard's asynctest project. rNrrr&r'r r s'r&r c*\rSrSrSrSrSrSrSrg)_ANYi z2A helper object that compares equal to everything.cgrrrTrs r'r _ANY.__eq__ sr&cgr#rrs r'r$ _ANY.__ne__ sr&cg)Nzrrs r'r _ANY.__repr__ sr&rN) r r!r"r#r$rr$rr%rr&r'rr s8r&rc :SU-nSnSRUVs/sHn[U5PM sn5nSRUR5VVs/sHupxU<SU<3PM snn5n U(aUnU (aU(aUS- nXI- nX4-$s snfs snnf)Nz%s(%%s)r8z, =)rreprry) rrUrVrformatted_argsr| args_stringrwr kwargs_strings r'rr s$GN))$7$3T#Y$78KII171?:33M$  d "N'  ##8s BB c\rSrSrSrSSjrSSjrSr\Rr Sr Sr S r S r \S 5r\S 5rS rSrSrg)ri as A tuple for holding the results of a call to a mock, either in the form `(args, kwargs)` or `(name, args, kwargs)`. If args or kwargs are empty then a call tuple will compare equal to a tuple without those values. This makes comparisons less verbose:: _Call(('name', (), {})) == ('name',) _Call(('name', (1,), {})) == ('name', (1,)) _Call(((), {'a': 'b'})) == ({'a': 'b'},) The `_Call` object provides a useful shortcut for comparing with call:: _Call(((1, 2), {'a': 3})) == call(1, 2, a=3) _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3) If the _Call has no name then it will match any name. NcSn0n[U5nUS:XaUup&nO{US:Xa9Uup[U [5(aU n[U [5(aU nOBU nO?XpvOUun [ U [ 5(aU n0nOb[ U [5(aU nS0pOGSnU nOBUS:Xa;Uup[ U [5(aU n[ U [ 5(aU 0pOSU pOXpOgU(aXc:wagXx4XE4:H$![a [s$f=f) Nr8rrFrrrr)rrrr.rr,rlr) rTr len_other self_name self_args self_kwargs other_name other_args other_kwargsrrrs r'r _Call.__eq__4 sP "E I t9>%) "I{04 -I+ D.$ / /GE>SW4X4X%%););; >')2 !^38 0JL !^FE%''" ! E3''" +-rL $ !^!ME%%%" fe,,/5r /16 +0L 0)i-EEE_ "! ! "s DD,+D,c~URc [SX4SS9$URS-n[URX4X0S9$)Nr8rRrrXrrrs r'rH_Call.__call__l sB ?? ""d+$7 7%doot44MMr&cjURc [USS9$UR<SU<3n[X SS9$)NF)rrrr)rrrr)rTrrs r'r_Call.__getattr__t s4 ?? "de4 4//40$u==r&c`U[R;a[e[RX5$r9)rlrprI__getattribute__)rTrs r'r_Call.__getattribute__{ s% 5>> ! %%d11r&c>[U5S:XaUupX4$Uup1nX4$)Nr)rrs r'_get_call_arguments_Call._get_call_arguments s2 t9>LD|"& D|r&c(UR5S$Nrrrs r'rU _Call.args '')!,,r&c(UR5S$)Nrrrs r'rV _Call.kwargs rr&c,UR(d2UR=(d SnURS5(aSU-nU$[U5S:XaSnUup#O0UupnU(dSnO!URS5(dSU-nOSU-n[ XU5$)NrrRzcall%srzcall.%s)rrrrr)rTrrUrVs r'r_Call.__repr__ s##??,fDt$$$K t9>DLD&!% D__T** 4'$%d&99r&c/nUnUb3UR(aURU5 URnUbM3[[ U55$)zFor a call object that represents multiple calls, `call_list` returns a list of all the intermediate calls as well as the final call.)rrKrrr)rTvalsthings r' call_list_Call.call_list sM$$ E"&&E$((r&)rrr)rr8NFT)rNNFT)r r!r"r#r$rrErrr$rHrrrrrUrVrrr%rr&r'rr s|$:?8@>C)2Fj]]FN>2 ----:* )r&r)rc [U5(a [U5n[U[5n[U5(a[ SU<S35e[ U5nSU0n U(aSU0n OUc0n U (a U(aSU S'U(d [ U5 URSU5nUn UcS n U RU5 [n [R"U5(a0n O[U(aU(a [S 5e[n O;[U5(d[n O$U(aU(a[!U5(d[n U "SX3U US .U D6n [U["5(aU(a [%X5n O['X5n O [)X Xr5 UbU(dXR*U'URS S5n U(aU(dS U;a[-XSSU U S9U l[1U5GH0n[3U5(aM[5X5nSU0nU (a[9X5(aURUS9 U(aSU0n[U["5(d[;XXU5nUU R*U'OU n[U["5(a U R<n[?XU5nUUS'[AU5(a[nO[nU"SUXUS.UD6nUU R*U'U"5Ul[)UUUS9 [U["5(dGM$[CXU5 GM3 [U 5(aU(aU RD"S0UD6 U $![6a GMnf=f)aCreate a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the `spec` object as their spec. Functions or methods being mocked will have their arguments checked to check that they are called with the correct signature. If `spec_set` is True then attempting to set attributes that don't exist on the spec object will raise an `AttributeError`. If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by passing `instance=True`. The returned mock will only be callable if instances of the mock are callable. `create_autospec` will raise a `RuntimeError` if passed some common misspellings of the arguments autospec and spec_set. Pass the argument `unsafe` with the value True to disable that check. `create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock.z'Cannot autospec a Mock object. [object=rBrr NTr$rr8zJInstance can not be True when create_autospec is mocking an async function)rr#r"rrrrR)r_rr rrr%)rrr"r#)r^r)#rmr;r,r+rr7rFr{rirr/isdatadescriptorrBr rirrsrBrrr`rr rrHrr.rIr-rkrA _must_skiprrer5)rr r_r rr&rVis_type is_async_funcrr"rrAwrappedrtr} child_kwargsr)rr^ child_klasss r'r r s(.~~Dzt$G"**. 45 5"4(MtnGt$ 8'+#$ f% JJvu %EI  NN6 E%%   >? ? t__$ X&8&>&>$  (  (& (D$ && '3D!$-DW78(,u%jj$'GxN&$@+DT2629;T U    t+H) ww..   h  / &1L(M22XhGC),D   &F$ .."48I(1L %"8,,' ' BV%*0B4@BC),D   &*}C  Xsi @ c= ) ) D %gn6 %f% KU   s8 M MMcT[U[5(dU[US05;agURnURHdnUR R U[5nU[LaM.[U[[45(a g[U[5(aUs $ g U$)zO Return whether we should skip the first argument on spec's `entry` attribute. rpF) r,r;r.r[rorprqrrGrFrB)rrtrrr~s r'rrM s dD ! ! GD*b1 1~~##E73 W   f|[9 : :  . .N Nr&c"\rSrSrSSjrSrg)rkii NcLXlXPlX lX0lX`lX@lgr9)ridsr rr_r)rTrr rrrr_s r'rE_SpecState.__init__k s      r&)rr_rrrr )FNNNF)r r!r"r#rEr%rr&r'rkrki s 48/4r&rkc[U[5(a[R"U5$[R"U5$r9)r,bytesioBytesIOStringIO) read_datas r' _to_streamr s-)U##zz)$${{9%%r&c ^^ ^ ^ ^ [T5nUS/m U U 4SjnU U 4SjnU U 4Sjm U U 4Sjm U U 4SjnU 4Sjn[cVSSKn[[ [ UR 55R[ [ UR5555q[c+SSKn[[ [ UR555q Uc[S [S 9n[[S 9m T T Rl ST Rl ST Rl ST R l ST R"l UT RlT "5T S 'T S T R lUT R"lT T R&lUT R(lUT R*lU U U U4S jnXlT Ul U$)a A helper function to create a mock to replace the use of `open`. It works for `open` called directly or used as a context manager. The `mock` argument is the mock object to configure. If `None` (the default) then a `MagicMock` will be created for you, with the API limited to methods or attributes available on standard file handles. `read_data` is a string for the `read`, `readline` and `readlines` of the file handle to return. This is an empty string by default. Nc>TRRbTRR$TSR"U0UD6$r) readlinesrrUrV_statehandles r'_readlines_side_effect)mock_open.._readlines_side_effect sA    ( ( 4##00 0ay""D3F33r&c>TRRbTRR$TSR"U0UD6$r)readrrs r'_read_side_effect$mock_open.._read_side_effect s; ;; # # /;;++ +ay~~t.v..r&c?b># T"5ShvN TSR"U0UD6v MN7fr)readline)rUrV_iter_side_effectrs r'_readline_side_effect(mock_open.._readline_side_effect s9$&&&)$$d5f5 5 's /-/c3># TRRbTRRv MTSHnUv M g7fr)rr)linerrs r'r$mock_open.._iter_side_effect sA ?? ' ' 3oo2221IDJsAAcz>TRRbTRR$[TS5$r)rrr)rrsr'_next_side_effect$mock_open.._next_side_effect s1 ?? ' ' 3??// /F1Ir&c&>TR5 gr9)close)exctypeexcinstexctbrs r'_exit_side_effect$mock_open.._exit_side_effect s  r&ropen)rr)rrc>[T5TS'TRRTS:XaT"5TS'TSTRl[$)Nrr)rrrr)rUrVrrrrs r' reset_datamock_open..reset_data sHy)q ?? & &&) 3-/F1I*0)FOO 'r&)r file_spec_iorkrrH TextIOWrapperunionr open_specrrrrwriterrrrr)rr) rAr _read_datarrrrrrrrrrs ` @@@@r'rr skI&J$ F4 / 6  S!2!234::3s3;;?O;PQR S]+,  |f95 I &F$*F! $FLL#FKK#'FOO $(F!/FKK%'F1I"()FOO#9F "3FOO"3FOO"3FOO"D Kr&c.\rSrSrSrSrSSjrSrSrg) ri a? A mock intended to be used as a property, or other descriptor, on a class. `PropertyMock` provides `__get__` and `__set__` methods so you can specify a return value when it is fetched. Fetching a `PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set. c [S0UD6$)Nr)r)rTrVs r'rTPropertyMock._get_child_mock s"6""r&NcU"5$r9r)rTr2obj_types r'rPropertyMock.__get__ s v r&cU"U5 gr9r)rTr2r}s r'rPropertyMock.__set__ s  S r&rr9) r r!r"r#r$rTrrr%rr&r'rr s#r&rcr^\rSrSrSrU4Sjr\S.U4SjjrU4SjrSr U4Sjr \S.S jr S r S r U=r$) ThreadingMixini Nc >[URS5[5(aUSRUS'O6[URS5[5(aUSRUS'[ 5R "S0UD6$)Nrtimeoutr#r)r,rqr_mock_wait_timeoutrRrT)rTrr[s r'rTThreadingMixin._get_child_mock sl bffX& 7 7xL;;ByM }-~ > >}-@@ByMw&&,,,r&rc&>[5R"U0UD6 U[La URn[R "5UR S'/UR S'[R"5UR S'XR S'g)N _mock_event_mock_calls_events_mock_calls_events_lockr)rRrE_timeout_unsetDEFAULT_TIMEOUT threadingEventrpLock)rTrrUrVr[s r'rEThreadingMixin.__init__ sr $)&) n $**G'0'8 m$.0 *+3<>>3C /0.5 *+r&c>[5R"U0UD6 [R"5URS'/URS'g)rrrN)rRrr!r"rprs r'rThreadingMixin.reset_mock s> D+F+'0'8 m$.0 *+r&cUR URHup4nX44X4:XdMUs sSSS5 $ [R"5nURR XU45 SSS5 U$!,(df  W$=fr9)rrr!r"rK)rT expected_argsexpected_kwargsrUrVevent new_events r' __get_eventThreadingMixin.__get_event s}  ) )'+'>'>#e>m%EE L* )'>")I  # # * *MI+V W *  * ) sA5A54A55 Bc>[5R"U0UD6nURX5nUR5 URR5 U$r9)rRr._ThreadingMixin__get_eventrr)rTrUrV ret_value call_eventr[s r'r.ThreadingMixin._mock_call sLG&&77 %%d3  r&cU[La URnURRUS9(d&UR=(d SSUS3n[ U5eg)zWait until the mock object is called. `timeout` - time to wait for in seconds, waits forever otherwise. Defaults to the constructor provided timeout. Use None to block undefinetively. rrAz was not called before timeout(z).N)rrrwaitrr)rTrrs r'wait_until_called ThreadingMixin.wait_until_called! s` n $--G$$W$5oo/01&ir+C % %6r&cURX5nURURS9(dURX5n[ US35eg)zuWait until the mock object is called with given args. Waits for the timeout in seconds provided in the constructor. rz call not foundN)r/r4rrr)rTrUrVr*rs r'wait_until_any_call_with'ThreadingMixin.wait_until_any_call_with/ sP   .zz$"9"9z:">>tLO O#4O!DE E;r&r)r r!r"r#r rTrrErr/r.r5r8r%rTrUs@r'rr sAO-'5661,: &FFr&rc\rSrSrSrSrg)r i: ae A mock that can be used to wait until on calls happening in a different thread. The constructor can take a `timeout` argument which controls the timeout in seconds for all `wait` calls of the mock. You can change the default timeout of all instances via the `ThreadingMock.DEFAULT_TIMEOUT` attribute. If no timeout is set, it will block undefinetively. rNrrr&r'r r : s   r&r c6SUl[U5Hrn[X5n[ U[ 5(dM&[ UR RU5[5(aMVURULdMg[U5 Mt g![a Mf=f)aDisable the automatic generation of child mocks. Given an input Mock, seals it to ensure no further mocks will be generated when accessing an attribute that was not already defined. The operation recursively seals the mock passed in, meaning that the mock itself, any mocks generated by accessing one of its attributes, and all assigned mocks without a name or spec will be sealed. TN) r,rHr.rIr,r rrqrkrr)rArr[s r'rrJ sDD  #A!_--  a&&**40* = =    % G   s B  BBc$\rSrSrSrSrSrSrg)r/ib z0 Wraps an iterator in an asynchronous iterator. cpXl[[S9n[RUlX R S'g)Nrer5)iteratorr rr/CO_ITERABLE_COROUTINErkrp)rTr>rps r'rE_AsyncIterator.__init__f s+ #X6 $:: $- j!r&c`# [UR5$![a [ef=f7fr9)rr>rsrtrs r'r_AsyncIterator.__anext__l s0  & &     s.. +.+.)r>N)r r!r"r#r$rErr%rr&r'r/r/b s. !r&r/rr)NFNNN)FFNN)Nr8)__all__rrerr/rrbuiltinsrrr!typesrrr unittest.utilr functoolsrrrrrrHrrr rRrr3r7r+r>rCrOr`r[rirmrsrrr|rrrrrrrMISSINGrDELETEDrlrrrkrr r rr frozenset removeprefixrr rdrrrFrHrrrrrrrrmultiplestopallra magic_methodsnumericsrrzinplaceright _non_defaultsrr@r_sync_async_magics _async_magicsrrrr4rr3r r&r,r1r5r9r;rrMrrBrJrErfrgrKrr rrrrlrrr rrkr;rrBrr rrr TIMEOUT_UNSETrrr rr/)rrs00r'rVsJ (  '22#$CyC"(m Hmd??33GTm H   @2  F # & 4.."b>6) )f )   ;          &**(6  6 ^ 9d^ 9DO$$ y!!Di $ 4  m!Dm!b8=/8zY/VY/z < 'Ttd&+:?C04.d$u4OCHOdV/&V/r       "K  ((7hnn&67 7 5HNN$455  HHmXw 67==? ?!Hv?  @!]$'99 ]*. 306^ " 1$;;>  :   j G DGB""$!!'(*;*;T"BCIh-K E+TE+P((V 6  f$$v)Ev)r uCGT*/Tn8        &Sl4$''EFTEFP  NJ  0!!ga IH!x dIs0 P=PP !P P+PP P PK!C[Z1V1V(__pycache__/loader.cpython-313.opt-1.pycnu[ LiKSrSSKrSSKrSSKrSSKrSSKrSSKrSSKJrJr SSK J r J r J r Sr \R"S\R5r"SS \ R"5rS rS rS rS rSr"SS\5r\"5rg)zLoading unittests.N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c8^\rSrSrSrU4SjrU4SjrSrU=r$) _FailedTestNc8>X l[[U]U5 gN) _exceptionsuperr __init__)self method_name exception __class__s 6/opt/alt/python313/lib64/python3.13/unittest/loader.pyr_FailedTest.__init__s# k4)+6c\>^UTR:wa[[T]U5$U4SjnU$)Nc>TRer rrsr testFailure,_FailedTest.__getattr__..testFailure s // !r)_testMethodNamerr __getattr__)rnamerrs` rr_FailedTest.__getattr__s. 4'' 'd7= = "rr) __name__ __module__ __qualname____firstlineno__rrr__static_attributes__ __classcell__rs@rr r sO7rr chSU<S[R"5<3n[U[U5X5$)NzFailed to import test module:  ) traceback format_exc_make_failed_test ImportError)r suiteClassmessages r_make_failed_import_testr1%s+ i""$&G T;w#7 MMrcLS[R"5<3n[XX#5$)NzFailed to call load_tests: )r+r,r-)r rr/r0s r_make_failed_load_testsr3*s%2;2F2F2HJG   ..rc.[X5nU"U45U4$r )r ) methodnamerr/r0tests rr-r-/s z -D tg  ''rc[R"[U55S5nX0n[S[R4U5nU"U"U545$)Ncgr rs r testSkipped'_make_skipped_test..testSkipped4s r ModuleSkipped)rskipstrtypeTestCase)r5rr/r:attrs TestClasss r_make_skipped_testrC3sQ YYs9~   %E_t}}&6>I y,. //rcF[RRU5S$)Nr)ospathsplitext)rFs r _splitextrH;s 77  D !! $$rc^\rSrSrSrSr\"\R5r Sr \ Rr SrU4SjrSrSS.SjrSS jrSS jrS rSS jrS rSrSrSrSrSrSrU=r$) TestLoader?zu This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite r6NcV>[[U] 5 /Ul[ 5Ulgr )rrJrerrorsset_loading_packages)rrs rrTestLoader.__init__Js# j$(* "%rc4[U[R5(a [S5eU[R [R 4;a/nO,URU5nU(d[US5(aS/nUR[X55nU$)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 TypeErrorrr@FunctionTestCasegetTestCaseNameshasattrr/map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCase TestLoader.loadTestsFromTestCaseQs mU__ 5 5() ) T]]D,A,AB BM 11-@M W]I%F%F!* s='HI rpatterncB/n[U5Hn[X5n[U[5(dM%[ U[ R 5(dMFU[ R [ R4;dMlURURU55 M [USS5nURU5nUb U"XU5$U$![aIn[URXpR5upURRU 5 UsSnA$SnAff=f)z>Return a suite of all test cases contained in the given module load_testsN)dirgetattr isinstancer?rSrr@rVappendr]r/ Exceptionr3r"rM) rmoduler`testsr objrbe error_case error_messages rloadTestsFromModuleTestLoader.loadTestsFromModuleasKD&'C3%%sDMM22 t/D/DEE T77<= V\48 &  ! "!$w77   ",COOQ-9)  ""=1!!  "sC D>DDDc URS5nSupEUc/USSnU(aSRU5n[U5nUSSnUn UHn U [X5pM [U [R 5(aUR#U 5$[U [$5(aT['U [(R*5(a5U [(R*[(R,4;aUR/U 5$[U [R05(a|[W [$5(ag['U [(R*5(aHUSnU "U5n [[X5[R05(dUR U /5$O![U [2R45(aU $[7U 5(amU "5n[U[2R45(aU$[U[(R*5(aUR U/5$[9SU <S U<S 35e[9S U -5e![aP UR 5n[ XR 5upEU(dURRU5 Us$Of=fU(aGMGNf![an [U SS5b'Ub$URRU5 UsSn A s $[XUR S[R"5<35upEURRU5 UsSn A s $Sn A ff=f) a+Return 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.popr1r/rMrfrdAttributeErrorr-r+r,retypes ModuleTypernr?rSrr@rVr] FunctionTyperrTcallablerU)rr rhpartsrlrm parts_copy module_namenext_attributerjpartparentrkinstr6s rloadTestsFromNameTestLoader.loadTestsFromNameys 3$.! >qJ *"%((:"6K' 4F!"IED &!73#5. c5++ , ,++C0 0 sD ! !3 ..DMM4+@+@AA--c2 2e0011&&//9D$". KK&&}5%%1B%002516-JKK&&}5%%% &s=I J)AJJ) M3-L< M(A L<4M<McnUVs/sHo0RX25PM nnURU5$s snf)zqReturn a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. )rr/)rnamesrhr suitess rloadTestsFromNamesTestLoader.loadTestsFromNamess8DII54((65Iv&&Js2c^^UU4Sjn[[U[T555nTR(a-UR [ R "TR5S9 U$)zLReturn a sorted sequence of method names found within testCaseClass c">^URTR5(dg[TU5n[U5(dgSTRTR U4-mTR SL=(d [U4SjTR 55$)NFz%s.%s.%sc3<># UHn[TU5v M g7fr )r).0r`fullNames r KTestLoader.getTestCaseNames..shouldIncludeMethod..sXBWwK'22BWs) startswithtestMethodPrefixrdr|r#r$testNamePatternsany)attrnametestFuncrrrZs @rshouldIncludeMethod8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<'<==}h7HH%%!((-*D*Dh&H((D0YX$BWBWXX Yr)key)listfilterrcsortTestMethodsUsingsort functools cmp_to_key)rrZr testFnNamess`` rrWTestLoader.getTestCaseNamessS Y6"5s=7IJK  $ $   !5!5d6O6O!P  QrcURnSnUcURb URnOUcSnUn[RRU5nU[R;a [RR SU5 X0lSn[RR [RRU55(ag[RRU5nX:waB[RR[RRUS55(+nO[U5 [RUnURS5Sn[RR[RRUR55nU(a5UR%U5Ul[RR'U5 U(a[)S U-5e[+UR-X55n X@lUR/U 5$![a; UR[R ;a [#S5Se[#SU<35Sef=f![(a SnNf=f) 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__.pyrqz2Can not use builtin modules as dotted module namesz don't know how to discover from z%Start directory is not importable: %r)_top_level_dirrErFabspathsysinsertisdirisfilerurvmodulesrtdirname__file__rxr"builtin_module_namesrU _get_directory_containing_moduleremover.r _find_testsr/) r start_dirr` top_level_diroriginal_top_level_dirset_implicit_topis_not_importable the_moduletop_partris rdiscoverTestLoader.discovers8"&!4!4   T%8%8%D //M  "# %M 6 ( HHOOA} -+! 77==3 4 4 2I)(*rww||I}7](^$^! 39%![[3 $??3/2 ( ")<)<>!@I$*.*O*OPX*YD'HHOOM2 E QR RT%%i9:4u%%'&(!**c.F.FF')ABGKL(>znM#'( ( )$(! )s 7 I:*AH22AI7: J J c[RUn[RR UR 5n[RR U5R5RS5(a<[RR[RRU55$[RRU5$)Nr) rrrErFrrbasenamelowerrr)rrrh full_paths rr+TestLoader._get_directory_containing_module:s[)GGOOFOO4 77  I & , , . 9 9- H H77??277??9#=> > 77??9- -rcXR:Xag[[RR U55n[RR XR5nUR [RRS5nU$)Nrq)rrHrErFnormpathrelpathreplacesep)rrF_relpathr s r_get_name_from_pathTestLoader._get_name_from_pathFsc && &))$/077??4)<)<= S1 rc>[U5 [RU$r )rvrr)rr s r_get_module_from_name TestLoader._get_module_from_nameRs4{{4  rc[X5$r )r)rrFrr`s r _match_pathTestLoader._match_pathVs t%%rc#v# URU5nUS:wa1X0R;a"URX5upEUbUv U(dg[[R "U55nUHn[R RX5nURX5upEUbUv U(dMEURU5nURRU5 URX5ShvN URRU5 M gN$!URRU5 f=f7f)z/Used by discovery. Yields test suites it loads.rqN) rrO_find_test_pathsortedrElistdirrFruaddrdiscard) rrr`r rishould_recursepathsrFrs rrTestLoader._find_testsZs'' 2 3;4'='==%)$8$8$L !E  !rzz),-D Y5I$($8$8$L !E  ~// :&&**409#// CCC**2248D**2248s6B+D91,D9D2D3D7 D9DD66D9c[RRU5n[RRU5(Gaz[R U5(dgUR X1U5(dgURU5nURU5n[RR[USU55n[[RRU55n[[RRU55nUR5UR5:waw[RRU5n [[RRU55n [RRU5n Sn [XX4-5eUR!XRS9S4$[RR1U5(a[RR[RR3US55(dgSnSnURU5nURU5n[USS5nUR4R7U5 UR!UUS9nUbUS4UR4R9U5 $US 4UR4R9U5 $g!["R$a"n ['XMUR(5S4sSn A $Sn A f [+X@R(5upUR,R/U5 US4s$=f!UR4R9U5 f=f!["R$a"n ['XMUR(5S4sSn A $Sn A f [+X@R(5upUR,R/U5 US4s$=f) 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?r_FNrrbT)rErFrrVALID_MODULE_NAMEmatchrrrrrdrHrealpathrrr.rnrSkipTestrCr/r1rMrfrrurOrr)rrr`rr rhmod_filerfullpath_noext module_dirmod_name expected_dirmsgrkrlrmrbripackages rrTestLoader._find_test_pathzs 77##I. 77>>) $ $$**844"##HAA"++I6D P33D977??FJ :<$GG$$X.0!*GG$$Y/"1>>#~';';'==!#!:J(((3 5H#%77??9#=LDC%BBDD///H%OO WW]]9 % %77>>"'',,y-"HII"JE++I6D 944T:%WlDA &&**409 44Wg4NE!-$e|**2248!$;**2248k== K)$4??CUJJ ),T??C*  ""=1!5((Z**2248%== K)$4??CUJJ ),T??C*  ""=1!5((sN K<M6L9(L9L6K93L69;L69MO-N O ;O)rOrrMr )ztest*.pyN)r"r#r$r%__doc__r staticmethodr three_way_cmprrrrTr/rrr]rnrrrWrrrrrrrr&r'r(s@rrJrJ?s'(:(:;JN' 6:0PJd'&S&j . !&9@HHrrJ)rrErerr+ryrrrrrr __unittestcompile IGNORECASErr@r r1r3r-rCrHobjectrJdefaultTestLoaderr9rrrs  (  JJ0"--@ $-- N . (0%CCL LrPK!pe&33 __pycache__/main.cpython-313.pycnu[ Lit-xSrSSKrSSKrSSKrSSKJrJr SSKJr Sr Sr Sr S r S r S rS r"S S\5r\rg)zUnittest main programN)loaderrunner)installHandlerTaExamples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aFExamples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase cb[RRU5(Ga UR5R S5(a[RR U5(a[RR U[R"55n[RR U5(d$UR[R5(aU$Un[RRU5SSRSS5RSS5$U$)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths 4/opt/alt/python313/lib64/python3.13/unittest/main.py _convert_namers  ww~~d 5 5e < < 77==  wwtRYY[9Hww}}X&&(*=*=bii*H*H Dww%cr*224=EEc3OO KcDUVs/sHn[U5PM sn$s snfN)r)namesrs r_convert_namesr!.s,1 2EDM$ E 22 2scSU;aSU-nU$)N*z*%s*)patterns r_convert_select_patternr&2s '>7" Nrc \rSrSrSrSrSrS=r=r=r =r =r r Sr SSSS\RSSSSSS4 SSS.S jjrS rS rSS jrS rSrSrSrSSjrSrSrg) TestProgram8ztA command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. Nr__main__TF) tb_locals durationsc B[U[5(aG[U5UlUR S5SSHn[ URU5UlM OXlUc[ RnX`lXl Xl Xpl Xl Xl XlU c[ R(dSUlOXlX lX@lXPl[(R*R-US5UlUR1U5 UR35 g)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr+r, warnoptionswarnings defaultTest testRunner testLoaderr rbasenameprogName parseArgsrunTests)selfr2r>r6r?r@r7r:r8r9r;r=r+r,parts r__init__TestProgram.__init__Bs fc " "$V,DK S)!"-%dkk48 .!K <88D  $" ""  COO&DM%M&$$((a1  t rcXURc\[URR55 [[SUR 0-5 UR R5 g[URR55 [[SUR 0-5 g)Nprog) r2print _main_parser format_help MAIN_EXAMPLESrB_discovery_parser print_helpMODULE_EXAMPLES)rEargskwargss r _print_helpTestProgram._print_helpjsx ;;  $##//1 2 -64=="99 :  " " - - / $##//1 2 /VT]]$;; r/r0list createTests)rEr6s rrCTestProgram.parseArgsss  ;; 4y1}aJ!>""48,    ( (ab4 8::""2&     ( (ab4 8 ::+DJJ7DN:%"    %!DN ((# . ."..0DN!$"2"23DN rcUR(aURURlU(aNUc UROU"5nUR"URURUR 5UlgURc+URRUR5UlgURRURUR5Ulgr) testNamePatternsr@rWstartr%toptestr^loadTestsFromModuler2loadTestsFromNames)rEfrom_discoveryLoaderrs rraTestProgram.createTestss  /3/D/DDOO , (.T__FHF DLL$((KDI ^^ #;;DKKHDI::4>>;?;;HDIrc|UR5nURU5UlURU5Ulgr)_getParentArgParser_getMainArgParserrL_getDiscoveryArgParserrO)rE parent_parsers rrYTestProgram._initArgParserss6002  22=A!%![+UR R,5S:Xa[&R""[.5 g[&R""S5 gg![a> URURURURURS9nGNf=f![a UR5nGN?f=f)N)r:r8r;r=r+r,)r:r8r;r=rr)r9rr?rTextTestRunnerr/r|r:r8r;r=r+r, TypeErrorrunrgresultr7 wasSuccessfulr5testsRunrZskipped_NO_TESTS_EXITCODE)rEr?s rrDTestProgram.runTestssf ??   ?? "$33DO doot , , / I!%4>>:>--8< :>--;?>>;?>> "1"KJ"J nnTYY/ 99;;,,.. %%*s4;;3F3F/G1/L+, !I!%4>>:>--8< :>--"1"IJI  /!__.  /s,AFAGGGGG<;G<)rOrLr;r9r>r,r7r8r2r%rBrrer+rgr@rdr^r?rfr:r=)FNr)r_ __module__ __qualname____firstlineno____doc__r2r:r8r9r;rBr=rdrOrdefaultTestLoaderrGrTrCrarYrnrorpr[rD__static_attributes__r$rrr(r(8s FINRRHRzRFRXR;K(d#0H0HTd$&>C" &P=: HL $L * =!rr()rr5rr rrsignalsr __unittestrrNrQrr!r&objectr(mainr$rrrsU  #    3 ]&]@rPK!vN??(__pycache__/runner.cpython-313.opt-2.pycnu[ Li(SSKrSSKrSSKrSSKJr SSKJr SSKJr Sr "SS\ 5r "S S \R5r "S S \ 5rg) N)result)_SubTest)registerResultTc*\rSrSrSrSrSSjrSrg)_WritelnDecoratorcXlgNstream)selfr s 6/opt/alt/python313/lib64/python3.13/unittest/runner.py__init___WritelnDecorator.__init__s cPUS;a [U5e[URU5$)N)r __getstate__)AttributeErrorgetattrr )rattrs r __getattr___WritelnDecorator.__getattr__s' - - & &t{{4((rNcVU(aURU5 URS5 gN )write)rargs rwriteln_WritelnDecorator.writelns  JJsO 4rr r )__name__ __module__ __qualname____firstlineno__rrr__static_attributes__rrrrs) rrc^\rSrSrSrSrSS.U4SjjrSrU4SjrS r U4S jr U4S jr U4S jr U4S jr U4SjrU4SjrU4SjrSrSrSrU=r$)TextTestResultzF======================================================================zF----------------------------------------------------------------------N durationsc>[[U] XU5 XlUS:UlUS:HUlX lSUlX@lg)NrT) superr(rr showAlldots descriptions_newliner+)rr r0 verbosityr+ __class__s rrTextTestResult.__init__&sC nd,V9M  1} N ( "rcUR5nUR(a#U(aSR[U5U45$[U5$r)shortDescriptionr0joinstr)rtestdoc_first_lines rgetDescriptionTextTestResult.getDescription1s=..0   99c$i89 9t9 rc>[[U] U5 UR(agURR UR U55 URR S5 URR5 SUlgg)N ... F) r-r( startTestr.r rr;flushr1rr9r3s rr?TextTestResult.startTest8sd nd-d3 << KK  d11$7 8 KK  g & KK   !DM rc[U[5nU(dUR(aUR(dURR 5 U(aURR S5 URR UR U55 URR S5 URR U5 URR5 SUlg)Nz r>T) isinstancerr1r rrr;r@)rr9status is_subtests r _write_statusTextTestResult._write_status@sh/ == ##% !!$' KK  d11$7 8 KK  g & F#  rc>UbUR(aD[USUR5(aURUS5 OURUS5 OUR(ao[USUR5(aUR R S5 OUR R S5 UR R5 [[U]+XU5 g)NrFAILERRORFE) r. issubclassfailureExceptionrGr/r rr@r-r( addSubTest)rr9subtesterrr3s rrPTextTestResult.addSubTestMs ?||c!fg&>&>??&&w7&&w8c!fg&>&>??KK%%c*KK%%c* !!# nd.tcBrc>[[U] U5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)Nok.) r-r( addSuccessr.rGr/r rr@rAs rrWTextTestResult.addSuccess\sW nd.t4 <<   tT * YY KK  c " KK   rc>[[U] X5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)NrKrM) r-r(addErrorr.rGr/r rr@rr9rRr3s rrZTextTestResult.addErrordsW nd,T7 <<   tW - YY KK  c " KK   rc>[[U] X5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)NrJrL) r-r( addFailurer.rGr/r rr@r[s rr^TextTestResult.addFailurelsW nd.t9 <<   tV , YY KK  c " KK   rc >[[U] X5 UR(a"UR USR U55 gUR (a6URRS5 URR5 gg)Nz skipped {0!r}s) r-r(addSkipr.rGformatr/r rr@)rr9reasonr3s rrbTextTestResult.addSkiptsb nd+D9 <<   t_%;%;F%C D YY KK  c " KK   rcH>[[U] X5 UR(a6URR S5 URR 5 gUR(a6URRS5 URR 5 gg)Nzexpected failurex) r-r(addExpectedFailurer.r rr@r/rr[s rrh!TextTestResult.addExpectedFailure|sj nd6tA << KK   2 3 KK    YY KK  c " KK   rcH>[[U] U5 UR(a6URR S5 URR 5 gUR(a6URRS5 URR 5 gg)Nzunexpected successu) r-r(addUnexpectedSuccessr.r rr@r/rrAs rrl#TextTestResult.addUnexpectedSuccesssj nd8> << KK   4 5 KK    YY KK  c " KK   rc4UR(dUR(a4URR5 URR 5 UR SUR 5 UR SUR5 [USS5nU(avURRUR5 UH0nURRSURU535 M2 URR 5 gg)NrKrJunexpectedSuccessesr&zUNEXPECTED SUCCESS: ) r/r.r rr@printErrorListerrorsfailuresr separator1r;)rror9s r printErrorsTextTestResult.printErrorss 99 KK   ! KK    GT[[1 FDMM2%d,A2F  KK   0+ ##&:4;N;Nt;T:U$VW, KK    rcUHup4URRUR5 URRU<SURU5<35 URRUR5 URRSU-5 URR 5 M g)Nz: z%s)r rrsr; separator2r@)rflavourrqr9rRs rrpTextTestResult.printErrorListsID KK   0 KK  GD4G4G4M N O KK   0 KK  s + KK     r)r1r0r/r+r.r )r!r"r#r$rsrwrr;r?rGrPrWrZr^rbrhrlrtrpr% __classcell__)r3s@rr(r(s^ JJEI # #"  C          rr(cB\rSrSr\rS SSS.SjjrSrSrSr S r g) TextTestRunnerNF) tb_localsr+cUc[Rn[U5UlX lX0lX@lXPlXlXl Xpl UbX`l ggr ) sysstderrrr r0r2failfastbufferr~r+warnings resultclass) rr r0r2rrrrr~r+s rrTextTestRunner.__init__sS >ZZF'/ ("  ""  "*  #rcURURURURURS9$![ a4 URURURUR5s$f=f)Nr*)rr r0r2r+ TypeError)rs r _makeResultTextTestRunner._makeResultss 4##DKK1B1B$(NNdnn$N N 4##DKK1B1B$(NN4 4 4s9<;A:9A:cJUR(dg[URSSS9nURS:aUSURnURR S5 [ US5(a%URR UR 5 SnUHEupEURS:a US :aSnMURR S U-<S S U<35 MG U(aURR S 5 gURR S5 g)Nc US$)Nrr&)rgs r0TextTestRunner._printDurations..sQqTrT)keyreverserzSlowest test durationsrwFgMbP?z%.3fs10 zA (durations < 0.001s were hidden; use -v to show these durations))collectedDurationssortedr+r rhasattrrwr2)rrlshiddenr9elapseds r_printDurationsTextTestRunner._printDurationss((  F--> " >>A OT^^$B 45 6< ( ( KK   1 1 2MD~~!go KK  g.? F G   KK  !B C KK   #rcUR5n[U5 URUlURUlURUl[ R "5 UR (a [ R"UR 5 [R"5n[USS5nUbU"5 U"U5 [USS5nUbU"5 [R"5nSSS5 WW- nUR"5 URbURU5 [US5(a%URR!UR"5 UR$nURR!SXS:g=(a S=(d SU4-5 URR!5 S=n =p['[(UR*UR,UR.45n U upn /n UR2"5(d{URR5S 5 [)UR65[)UR85pU(aU R;S U-5 U(aU R;S U-5 ODUS:Xa#U (dURR5S 5 OURR5S 5 U (aU R;SU -5 U (aU R;SU -5 U (aU R;SU -5 U (a0URR!SSR=U 5<S35 OURR5S5 URR?5 U$![USS5nUbU"5 ff=f!,(df  GN=f![0a GNf=f)N startTestRun stopTestRunrwzRan %d test%s in %.3fsrrarrFAILEDz failures=%dz errors=%dz NO TESTS RANOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rrrrr~rcatch_warnings simplefiltertime perf_counterrrtr+rrr rrwtestsRunmaplenexpectedFailuresroskippedr wasSuccessfulrrrrqappendr7r@)rr9r startTimerrstopTime timeTakenrun expectedFailsrorresultsinfosfailederroreds rrTextTestRunner.runs!!#v--  >>  $ $ &}}%%dmm4))+I"6>4@L' "V %fmTB *M((*H'y(  >> %   ( 6< ( ( KK   1 1 2oo 4 ("2s"8b)DE F 899 9+ B# 7 7 & : : & 01G ;B 7M##%% KK  h '!&//2C 4FG ]V34 [723 AXg KK  n - KK  d #  LL/ 0  LL/-? @  LL25HH I  KK  499U+; = > KK  d #  e&fmTB *M+' &B   s7$AN3N ,N3 1ON00N33 O OO) rr0r+rrr r~r2r)NTrFFNN) r!r"r#r$r(rrrrrr%r&rrr|r|s. !KABJN+#t+*4$,Drr|)rrrrrcasersignalsr __unittestobjectr TestResultr(r|r&rrrsM #     C V&&C L@V@rPK!5LL(__pycache__/loader.cpython-313.opt-2.pycnu[ LiKSSKrSSKrSSKrSSKrSSKrSSKrSSKJrJr SSKJ r J r J r Sr \R"S\R5r"SS\ R 5rS rS rS rS rS r"SS\5r\"5rg)N)fnmatch fnmatchcase)casesuiteutilTz[_a-z]\w*\.py$c8^\rSrSrSrU4SjrU4SjrSrU=r$) _FailedTestNc8>X l[[U]U5 gN) _exceptionsuperr __init__)self method_name exception __class__s 6/opt/alt/python313/lib64/python3.13/unittest/loader.pyr_FailedTest.__init__s# k4)+6c\>^UTR:wa[[T]U5$U4SjnU$)Nc>TRer rrsr testFailure,_FailedTest.__getattr__..testFailure s // !r)_testMethodNamerr __getattr__)rnamerrs` rr_FailedTest.__getattr__s. 4'' 'd7= = "rr) __name__ __module__ __qualname____firstlineno__rrr__static_attributes__ __classcell__rs@rr r sO7rr chSU<S[R"5<3n[U[U5X5$)NzFailed to import test module:  ) traceback format_exc_make_failed_test ImportError)r suiteClassmessages r_make_failed_import_testr1%s+ i""$&G T;w#7 MMrcLS[R"5<3n[XX#5$)NzFailed to call load_tests: )r+r,r-)r rr/r0s r_make_failed_load_testsr3*s%2;2F2F2HJG   ..rc.[X5nU"U45U4$r )r ) methodnamerr/r0tests rr-r-/s z -D tg  ''rc[R"[U55S5nX0n[S[R4U5nU"U"U545$)Ncgr rs r testSkipped'_make_skipped_test..testSkipped4s r ModuleSkipped)rskipstrtypeTestCase)r5rr/r:attrs TestClasss r_make_skipped_testrC3sQ YYs9~   %E_t}}&6>I y,. //rcF[RRU5S$)Nr)ospathsplitext)rFs r _splitextrH;s 77  D !! $$rc^\rSrSrSr\"\R5rSr \ Rr Sr U4SjrSrSS.SjrSSjrSS jrS rSS jrS rS rSrSrSrSrSrU=r$) TestLoader?r6NcV>[[U] 5 /Ul[ 5Ulgr )rrJrerrorsset_loading_packages)rrs rrTestLoader.__init__Js# j$(* "%rc4[U[R5(a [S5eU[R [R 4;a/nO,URU5nU(d[US5(aS/nUR[X55nU$)NzYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?runTest) issubclassr TestSuite TypeErrorrr@FunctionTestCasegetTestCaseNameshasattrr/map)r testCaseClass testCaseNames loaded_suites rloadTestsFromTestCase TestLoader.loadTestsFromTestCaseQs mU__ 5 5() ) T]]D,A,AB BM 11-@M W]I%F%F!* s='HI rpatterncB/n[U5Hn[X5n[U[5(dM%[ U[ R 5(dMFU[ R [ R4;dMlURURU55 M [USS5nURU5nUb U"XU5$U$![aIn[URXpR5upURRU 5 UsSnA$SnAff=f)N load_tests)dirgetattr isinstancer?rSrr@rVappendr]r/ Exceptionr3r"rM) rmoduler`testsr objrbe error_case error_messages rloadTestsFromModuleTestLoader.loadTestsFromModuleasKD&'C3%%sDMM22 t/D/DEE T77<= V\48 &  ! "!$w77   ",COOQ-9)  ""=1!!  "sC D>DDDc URS5nSupEUc/USSnU(aSRU5n[U5nUSSnUn UHn U [X5pM [U [R 5(aUR#U 5$[U [$5(aT['U [(R*5(a5U [(R*[(R,4;aUR/U 5$[U [R05(a|[W [$5(ag['U [(R*5(aHUSnU "U5n [[X5[R05(dUR U /5$O![U [2R45(aU $[7U 5(amU "5n[U[2R45(aU$[U[(R*5(aUR U/5$[9SU <SU<S 35e[9S U -5e![aP UR 5n[ XR 5upEU(dURRU5 Us$Of=fU(aGMGNf![an [U SS5b'Ub$URRU5 UsSn A s $[XUR S[R"5<35upEURRU5 UsSn A s $Sn A ff=f) N.)NNr__path__zFailed to access attribute: zcalling z returned z , not a testz$don't know how to make test from: %s)splitjoin __import__r.popr1r/rMrfrdAttributeErrorr-r+r,retypes ModuleTypernr?rSrr@rVr] FunctionTyperrTcallablerU)rr rhpartsrlrm parts_copy module_namenext_attributerjpartparentrkinstr6s rloadTestsFromNameTestLoader.loadTestsFromNameys 3$.! >qJ *"%((:"6K' 4F!"IED &!73#5. c5++ , ,++C0 0 sD ! !3 ..DMM4+@+@AA--c2 2e0011&&//9D$". KK&&}5%%1B%002516-JKK&&}5%%% &s=I J)AJJ) M3-L< M(A L<4M<McnUVs/sHo0RX25PM nnURU5$s snfr )rr/)rnamesrhr suitess rloadTestsFromNamesTestLoader.loadTestsFromNamess8DII54((65Iv&&Js2c^^UU4Sjn[[U[T555nTR(a-UR [ R "TR5S9 U$)Nc">^URTR5(dg[TU5n[U5(dgSTRTR U4-mTR SL=(d [U4SjTR 55$)NFz%s.%s.%sc3<># UHn[TU5v M g7fr )r).0r`fullNames r KTestLoader.getTestCaseNames..shouldIncludeMethod..sXBWwK'22BWs) startswithtestMethodPrefixrdr|r#r$testNamePatternsany)attrnametestFuncrrrZs @rshouldIncludeMethod8TestLoader.getTestCaseNames..shouldIncludeMethods&&t'<'<==}h7HH%%!((-*D*Dh&H((D0YX$BWBWXX Yr)key)listfilterrcsortTestMethodsUsingsort functools cmp_to_key)rrZr testFnNamess`` rrWTestLoader.getTestCaseNamessS Y6"5s=7IJK  $ $   !5!5d6O6O!P  QrcURnSnUcURb URnOUcSnUn[RRU5nU[R;a [RR SU5 X0lSn[RR [RRU55(ag[RRU5nX:waB[RR[RRUS55(+nO[U5 [RUnURS5Sn[RR[RRUR55nU(a5UR%U5Ul[RR'U5 U(a[)SU-5e[+UR-X55n X@lUR/U 5$![a; UR[R ;a [#S5Se[#SU<35Sef=f![(a SnNf=f) NFTr __init__.pyrqz2Can not use builtin modules as dotted module namesz don't know how to discover from z%Start directory is not importable: %r)_top_level_dirrErFabspathsysinsertisdirisfilerurvmodulesrtdirname__file__rxr"builtin_module_namesrU _get_directory_containing_moduleremover.r _find_testsr/) r start_dirr` top_level_diroriginal_top_level_dirset_implicit_topis_not_importable the_moduletop_partris rdiscoverTestLoader.discovers8"&!4!4   T%8%8%D //M  "# %M 6 ( HHOOA} -+! 77==3 4 4 2I)(*rww||I}7](^$^! 39%![[3 $??3/2 ( ")<)<>!@I$*.*O*OPX*YD'HHOOM2 E QR RT%%i9:4u%%'&(!**c.F.FF')ABGKL(>znM#'( ( )$(! )s 7 I:*AH22AI7: J J c[RUn[RR UR 5n[RR U5R5RS5(a<[RR[RRU55$[RRU5$)Nr) rrrErFrrbasenamelowerrr)rrrh full_paths rr+TestLoader._get_directory_containing_module:s[)GGOOFOO4 77  I & , , . 9 9- H H77??277??9#=> > 77??9- -rcXR:Xag[[RR U55n[RR XR5nUR [RRS5nU$Nrq)rrHrErFnormpathrelpathreplacesep)rrF_relpathr s r_get_name_from_pathTestLoader._get_name_from_pathFsc && &))$/077??4)<)<= S1 rc>[U5 [RU$r )rvrr)rr s r_get_module_from_name TestLoader._get_module_from_nameRs4{{4  rc[X5$r )r)rrFrr`s r _match_pathTestLoader._match_pathVs t%%rc#v# URU5nUS:wa1X0R;a"URX5upEUbUv U(dg[[R "U55nUHn[R RX5nURX5upEUbUv U(dMEURU5nURRU5 URX5ShvN URRU5 M gN$!URRU5 f=f7fr) rrO_find_test_pathsortedrElistdirrFruaddrdiscard) rrr`r rishould_recursepathsrFrs rrTestLoader._find_testsZs'' 2 3;4'='==%)$8$8$L !E  !rzz),-D Y5I$($8$8$L !E  ~// :&&**409#// CCC**2248D**2248s6B+D91,D9D2D3D7 D9DD66D9c[RRU5n[RRU5(Gaz[R U5(dgUR X1U5(dgURU5nURU5n[RR[USU55n[[RRU55n[[RRU55nUR5UR5:waw[RRU5n [[RRU55n [RRU5n Sn [XX4-5eUR!XRS9S4$[RR1U5(a[RR[RR3US55(dgSnSnURU5nURU5n[USS5nUR4R7U5 UR!UUS9nUbUS4UR4R9U5 $US4UR4R9U5 $g!["R$a"n ['XMUR(5S4sSn A $Sn A f [+X@R(5upUR,R/U5 US4s$=f!UR4R9U5 f=f!["R$a"n ['XMUR(5S4sSn A $Sn A f [+X@R(5upUR,R/U5 US4s$=f) N)NFrzW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?r_FrrbT)rErFrrVALID_MODULE_NAMEmatchrrrrrdrHrealpathrrr.rnrSkipTestrCr/r1rMrfrrurOrr)rrr`rr rhmod_filerfullpath_noext module_dirmod_name expected_dirmsgrkrlrmrbripackages rrTestLoader._find_test_pathzs 77##I. 77>>) $ $$**844"##HAA"++I6D P33D977??FJ :<$GG$$X.0!*GG$$Y/"1>>#~';';'==!#!:J(((3 5H#%77??9#=LDC%BBDD///H%OO WW]]9 % %77>>"'',,y-"HII"JE++I6D 944T:%WlDA &&**409 44Wg4NE!-$e|**2248!$;**2248k== K)$4??CUJJ ),T??C*  ""=1!5((Z**2248%== K)$4??CUJJ ),T??C*  ""=1!5((sN K<M6L9(L9L6K93L69;L69MO-N O ;O)rOrrMr )ztest*.pyN)r"r#r$r%r staticmethodr three_way_cmprrrrTr/rrr]rnrrrWrrrrrrrr&r'r(s@rrJrJ?s '(:(:;JN' 6:0PJd'&S&j . !&9@HHrrJ)rErerr+ryrrrrrr __unittestcompile IGNORECASErr@r r1r3r-rCrHobjectrJdefaultTestLoaderr9rrrs  (  JJ0"--@ $-- N . (0%CCL LrPK!jߴ*__pycache__/__init__.cpython-313.opt-2.pycnu[ Li /SQrSrSSKJr SSKJrJrJrJrJ r J r J r J r J r Jr SSKJrJr SSKJrJr SSKJrJr SSKJrJr SS KJrJrJrJr S rS r g ) ) TestResultTestCaseIsolatedAsyncioTestCase TestSuiteTextTestRunner TestLoaderFunctionTestCasemaindefaultTestLoaderSkipTestskipskipIf skipUnlessexpectedFailureTextTestResultinstallHandlerregisterResult removeResult removeHandleraddModuleCleanupdoModuleCleanupsenterModuleContextT)r) rrrr r r rrrr) BaseTestSuiter)rr ) TestProgramr )rr)rrrrc:[5R5S1-$)Nr)globalskeys8/opt/alt/python313/lib64/python3.13/unittest/__init__.py__dir__r!Hs 9>> 89 99rcTUS:Xa SSKJq [$[S[<SU<35e)Nrr)rzmodule z has no attribute ) async_caserAttributeError__name__)names r __getattr__r'Ks- ((7&& 78,.@I JJrN)!__all__ __unittestresultrcaserrrr r r rrrrsuiterrloaderrr r rrunnerrrsignalsrrrrr!r'rrr r0sF^ I ''',1#2PP:KrPK!ص__#__pycache__/signals.cpython-313.pycnu[ Lic |SSKrSSKrSSKJr Sr"SS\5r\R"5rSr Sr Sq Sr S S jr g) N)wrapsTc \rSrSrSrSrSrg)_InterruptHandler cSUlXl[U[5(aHU[R :Xa[R nO#U[R:XaSnO [S5eXl g)NFcgN) unused_signum unused_frames 7/opt/alt/python313/lib64/python3.13/unittest/signals.pydefault_handler3_InterruptHandler.__init__..default_handlerszYexpected SIGINT signal handler to be signal.SIG_IGN, signal.SIG_DFL, or a callable object) calledoriginal_handler isinstanceintsignalSIG_DFLdefault_int_handlerSIG_IGN TypeErrorr)selfrs r __init___InterruptHandler.__init__ s` / os + +&..0"("<"< FNN2 !233 /rc[R"[R5nX0LaURX5 UR(aURX5 SUl[ R 5HnUR5 M g)NT)r getsignalSIGINTrr_resultskeysstop)rsignumframeinstalled_handlerresults r __call___InterruptHandler.__call__sb",,V]];  (   / ;;   / mmoF KKM&r)rrrN)__name__ __module__ __qualname____firstlineno__rr'__static_attributes__r rr rr s /$ rrcS[U'g)N)r r&s r registerResultr1*s HVrc@[[RUS55$r )boolr popr0s r removeResultr5-s  VT* ++rc[cY[R"[R5n[ U5q[R"[R[5 ggr )_interrupt_handlerrrrr)rs r installHandlerr81s?! **6==9.? fmm%78"rc^Tb[T5U4Sj5nU$[b4[R"[R[R5 gg)Nc>[R"[R5n[5 T"U0UD6[R"[RU5 $![R"[RU5 f=fr )rrr removeHandler)argskwargsinitialmethods r innerremoveHandler..inner;sS&&v}}5G O 6t.v. fmmW5 fmmW5s A'B)rr7rrr)r?r@s` r r;r;9sL  v 6  6 % fmm%7%H%HI&rr )rweakref functoolsr __unittestobjectrWeakKeyDictionaryr r1r5r7r8r;r rr rGsM   @  $ $ &,9JrPK!ʋBB"__pycache__/runner.cpython-313.pycnu[ Li(SrSSKrSSKrSSKrSSKJr SSKJr SSKJ r Sr "SS \ 5r "S S \R5r"S S \ 5rg)z Running testsN)result)_SubTest)registerResultTc.\rSrSrSrSrSrSSjrSrg) _WritelnDecoratorz@Used to decorate file-like objects with a handy 'writeln' methodcXlgNstream)selfr s 6/opt/alt/python313/lib64/python3.13/unittest/runner.py__init___WritelnDecorator.__init__s cPUS;a [U5e[URU5$)N)r __getstate__)AttributeErrorgetattrr )rattrs r __getattr___WritelnDecorator.__getattr__s' - - & &t{{4((rNcVU(aURU5 URS5 gN )write)rargs rwriteln_WritelnDecorator.writelns  JJsO 4rr r ) __name__ __module__ __qualname____firstlineno____doc__rrr__static_attributes__rrrrsJ) rrc^\rSrSrSrSrSrSS.U4SjjrSrU4S jr S r U4S jr U4S jr U4S jr U4SjrU4SjrU4SjrU4SjrSrSrSrU=r$)TextTestResultz`A test result class that can print formatted text results to a stream. Used by TextTestRunner. zF======================================================================zF----------------------------------------------------------------------N durationsc>[[U] XU5 XlUS:UlUS:HUlX lSUlX@lg)zoConstruct a TextTestResult. Subclasses should accept **kwargs to ensure compatibility as the interface changes.rTN) superr)rr showAlldots descriptions_newliner,)rr r1 verbosityr, __class__s rrTextTestResult.__init__&sC nd,V9M  1} N ( "rcUR5nUR(a#U(aSR[U5U45$[U5$r)shortDescriptionr1joinstr)rtestdoc_first_lines rgetDescriptionTextTestResult.getDescription1s=..0   99c$i89 9t9 rc>[[U] U5 UR(agURR UR U55 URR S5 URR5 SUlgg)N ... F) r.r) startTestr/r rr<flushr2rr:r4s rr@TextTestResult.startTest8sd nd-d3 << KK  d11$7 8 KK  g & KK   !DM rc[U[5nU(dUR(aUR(dURR 5 U(aURR S5 URR UR U55 URR S5 URR U5 URR5 SUlg)Nz r?T) isinstancerr2r rrr<rA)rr:status is_subtests r _write_statusTextTestResult._write_status@sh/ == ##% !!$' KK  d11$7 8 KK  g & F#  rc>UbUR(aD[USUR5(aURUS5 OURUS5 OUR(ao[USUR5(aUR R S5 OUR R S5 UR R5 [[U]+XU5 g)NrFAILERRORFE) r/ issubclassfailureExceptionrHr0r rrAr.r) addSubTest)rr:subtesterrr4s rrQTextTestResult.addSubTestMs ?||c!fg&>&>??&&w7&&w8c!fg&>&>??KK%%c*KK%%c* !!# nd.tcBrc>[[U] U5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)Nok.) r.r) addSuccessr/rHr0r rrArBs rrXTextTestResult.addSuccess\sW nd.t4 <<   tT * YY KK  c " KK   rc>[[U] X5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)NrLrN) r.r)addErrorr/rHr0r rrArr:rSr4s rr[TextTestResult.addErrordsW nd,T7 <<   tW - YY KK  c " KK   rc>[[U] X5 UR(aUR US5 gUR (a6UR RS5 UR R5 gg)NrKrM) r.r) addFailurer/rHr0r rrAr\s rr_TextTestResult.addFailurelsW nd.t9 <<   tV , YY KK  c " KK   rc >[[U] X5 UR(a"UR USR U55 gUR (a6URRS5 URR5 gg)Nz skipped {0!r}s) r.r)addSkipr/rHformatr0r rrA)rr:reasonr4s rrcTextTestResult.addSkiptsb nd+D9 <<   t_%;%;F%C D YY KK  c " KK   rcH>[[U] X5 UR(a6URR S5 URR 5 gUR(a6URRS5 URR 5 gg)Nzexpected failurex) r.r)addExpectedFailurer/r rrAr0rr\s rri!TextTestResult.addExpectedFailure|sj nd6tA << KK   2 3 KK    YY KK  c " KK   rcH>[[U] U5 UR(a6URR S5 URR 5 gUR(a6URRS5 URR 5 gg)Nzunexpected successu) r.r)addUnexpectedSuccessr/r rrAr0rrBs rrm#TextTestResult.addUnexpectedSuccesssj nd8> << KK   4 5 KK    YY KK  c " KK   rc4UR(dUR(a4URR5 URR 5 UR SUR 5 UR SUR5 [USS5nU(avURRUR5 UH0nURRSURU535 M2 URR 5 gg)NrLrKunexpectedSuccessesr'zUNEXPECTED SUCCESS: ) r0r/r rrAprintErrorListerrorsfailuresr separator1r<)rrpr:s r printErrorsTextTestResult.printErrorss 99 KK   ! KK    GT[[1 FDMM2%d,A2F  KK   0+ ##&:4;N;Nt;T:U$VW, KK    rcUHup4URRUR5 URRU<SURU5<35 URRUR5 URRSU-5 URR 5 M g)Nz: z%s)r rrtr< separator2rA)rflavourrrr:rSs rrqTextTestResult.printErrorListsID KK   0 KK  GD4G4G4M N O KK   0 KK  s + KK     r)r2r1r0r,r/r )r!r"r#r$r%rtrxrr<r@rHrQrXr[r_rcrirmrurqr& __classcell__)r4s@rr)r)scJJEI # #"  C          rr)cF\rSrSrSr\rS SSS.SjjrSrSr S r S r g) TextTestRunnerzA test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. NF) tb_localsr,cUc[Rn[U5UlX lX0lX@lXPlXlXl Xpl UbX`l gg)zqConstruct a TextTestRunner. Subclasses should accept **kwargs to ensure compatibility as the interface changes. N) sysstderrrr r1r3failfastbufferrr,warnings resultclass) rr r1r3rrrrrr,s rrTextTestRunner.__init__sS >ZZF'/ ("  ""  "*  #rcURURURURURS9$![ a4 URURURUR5s$f=f)Nr+)rr r1r3r, TypeError)rs r _makeResultTextTestRunner._makeResultss 4##DKK1B1B$(NNdnn$N N 4##DKK1B1B$(NN4 4 4s9<;A:9A:cJUR(dg[URSSS9nURS:aUSURnURR S5 [ US5(a%URR UR 5 SnUHEupEURS:a US :aSnMURR S U-<S S U<35 MG U(aURR S 5 gURR S5 g)Nc US$)Nrr')rhs r0TextTestRunner._printDurations..sQqTrT)keyreverserzSlowest test durationsrxFgMbP?z%.3fs10 zA (durations < 0.001s were hidden; use -v to show these durations))collectedDurationssortedr,r rhasattrrxr3)rrlshiddenr:elapseds r_printDurationsTextTestRunner._printDurationss((  F--> " >>A OT^^$B 45 6< ( ( KK   1 1 2MD~~!go KK  g.? F G   KK  !B C KK   #rcUR5n[U5 URUlURUlURUl[ R "5 UR (a [ R"UR 5 [R"5n[USS5nUbU"5 U"U5 [USS5nUbU"5 [R"5nSSS5 WW- nUR"5 URbURU5 [US5(a%URR!UR"5 UR$nURR!SXS:g=(a S=(d SU4-5 URR!5 S =n =p['[(UR*UR,UR.45n U upn /n UR2"5(d{URR5S 5 [)UR65[)UR85pU(aU R;S U-5 U(aU R;S U-5 ODUS :Xa#U (dURR5S 5 OURR5S5 U (aU R;SU -5 U (aU R;SU -5 U (aU R;SU -5 U (a0URR!SSR=U 5<S35 OURR5S5 URR?5 U$![USS5nUbU"5 ff=f!,(df  GN=f![0a GNf=f)z&Run the given test case or test suite. startTestRunN stopTestRunrxzRan %d test%s in %.3fsrrbrrFAILEDz failures=%dz errors=%dz NO TESTS RANOKz skipped=%dzexpected failures=%dzunexpected successes=%dz (z, )r) rrrrrrcatch_warnings simplefiltertime perf_counterrrur,rrr rrxtestsRunmaplenexpectedFailuresrpskippedr wasSuccessfulrrsrrappendr8rA)rr:r startTimerrstopTime timeTakenrun expectedFailsrprresultsinfosfailederroreds rrTextTestRunner.runs!!#v--  >>  $ $ &}}%%dmm4))+I"6>4@L' "V %fmTB *M((*H'y(  >> %   ( 6< ( ( KK   1 1 2oo 4 ("2s"8b)DE F 899 9+ B# 7 7 & : : & 01G ;B 7M##%% KK  h '!&//2C 4FG ]V34 [723 AXg KK  n - KK  d #  LL/ 0  LL/-? @  LL25HH I  KK  499U+; = > KK  d #  e&fmTB *M+' &B   s7$AN3N ,N3 1ON00N33 O OO) rr1r,rrr rr3r)NTrFFNN) r!r"r#r$r%r)rrrrrr&r'rrr}r}s3 !KABJN+#t+*4$,Drr})r%rrrrrcasersignalsr __unittestobjectr TestResultr)r}r'rrrsN #     C V&&C L@V@rPK!ښ;띡&__pycache__/mock.cpython-313.opt-2.pycnu[ MiFSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ r SSK r SSK J r J r Jr SSKJr SSKJrJr SSK Jr "SS \5r\"\5Vs1sHoR1S 5(aMUiM snrS r\rS rS rSrSr Sr!Sr"S~Sjr#Sr$Sr%Sr&Sr'S~Sjr(SSjr)Sr*Sr+Sr,"SS\-5r."SS \-5r/\/"5r0\0Rbr1\0Rdr3\0Rhr51S!kr6S"r7"S#S$\85r9S%r:"S&S'\-5r;"S(S)\-5r<"S*S+\<5r=\>"\"\=5Vs1sH,nUR1S,5(dMURS,5iM. sn5r@"S-S.\85rAS/rB"S0S1\<5rC"S2S3\C\=5rDS4rE"S5S6\-5rFS7rG\1SSSSS4SS8.S9jjrHSS:jrI\1SSSSS4SS8.S;jjrJ"S<S=\-5rKS>rLS?rM\H\Jl-\K\JlN\I\JlO\M\JlPS@\JlQSArRSBrSSCRSD\SR555rVSCRSE\SR555rW1SFkrXSGrYSCR\R\S\V\W/5R5Vs1sHnSHU-iM snrZ1SIkr[SJ1r\\[\\-r]\Z\X-r^\^\]-r_1SKkr`SLSMSNSOSP.ra\b\b\b\bSQSSSSRSSS SQSST. rcSUrdSVreSWrfSXrg\d\e\f\gSY.rhSZri"S[S\\<5rj"S]S^\j\=5rk"S_S`\j5rl"SaSb\j\D5rm"ScSd\<5rn\R"\"\ RS55rq\"\ 5rr"SeSf\<5rt"SgSh\t\l\D5ru"SiSj\-5rv\v"5rwSkrx"SlSm\y5rz\z"SSn9r{SSS8.Sojjr|Spr}"SqSr\-5r~\"\|5\"\wGR54rSqSqSsrSStjr"SuSv\D5r\0GRr"SwSx\<5r"SySz\\j\D5rS{r"S|S}5rgs snfs snfs snf!\sa SrqNf=f))Mock MagicMockpatchsentinelDEFAULTANYcallcreate_autospec AsyncMock ThreadingMock FILTER_DIRNonCallableMockNonCallableMagicMock mock_open PropertyMocksealN)iscoroutinefunction)CodeType ModuleType MethodType) safe_repr)wrapspartial)RLockc\rSrSrSrg)InvalidSpecError+N__name__ __module__ __qualname____firstlineno____static_attributes__r4/opt/alt/python313/lib64/python3.13/unittest/mock.pyrr+r%r_Tc[U5(a[U[5(dg[US5(a [ US5n[ U5=(d [ R"U5$)NF__func__)_is_instance_mock isinstancer hasattrgetattrrinspect isawaitableobjs r& _is_async_objr37sPji&@&@sJc:& s # ?w':':3'??r%c>[USS5(a [U5$g)N__code__F)r.r)funcs r&_is_async_funcr7?stZ&&"4((r%c4[[U5[5$N) issubclasstyper r1s r&r+r+Fs d3i 11r%c~[U[5=(d' [U[5=(a [U[5$r9)r, BaseExceptionr;r:r1s r& _is_exceptionr>Ls-3 & A3@*S-"@r%cj[U[5(a[US5(a UR$U$Nmock)r, FunctionTypesr-rAr1s r& _extract_mockrCSs+#}%%'#v*>*>xx r%c[U[5(aU(dURnSnOa[U[[45(a$[U[5(aSnUR nO"[U[ 5(d URnU(a [US5nOUnU[R"U54$![a gf=f![a gf=fNT) r,r;__init__ classmethod staticmethodr*rB__call__AttributeErrorrr/ signature ValueError)r6 as_instanceeat_selfsig_funcs r&_get_signature_objectrP\s $k}} D; 5 6 6 dK ( (H}} m , , ==D4&W&&x000   s$ B<$C < C C  CCFc^[XU5mTcgTunmU4Sjn[X5 U[U5lT[U5lg)Nc*>TR"U0UD6 gr9bind)selfargskwargssigs r&checksig"_check_signature..checksig $!&!r%)rP_copy_func_detailsr;_mock_check_sig __signature__)r6rA skipfirstinstancerYrXs @r&_check_signaturerasE  :C {ID#"t&!)DJ"DJr%c dSHn[X[X55 M g![a M+f=f)N)r __doc____text_signature__r! __defaults____kwdefaults__)setattrr.rJ)r6funcopy attributes r&r\r\s6   G(@ A     s ! //c[U[5(ag[U[[[45(a[ UR 5$[USS5bgg)NTrIF)r,r;rHrGr _callabler*r.r1s r&rkrksJ#t# k:>??&&sJ%1 r%c2[U5[[4;$r9)r;listtupler1s r&_is_listros 9u %%r%c[U[5(d[USS5SL$U4UR-H!nURR S5cM! g g)NrITF)r,r;r.__mro____dict__get)r2bases r&_instance_callablerusY c4 sJ-T99$ ==  Z ( 4% r%c^ [U[5n[XU5nUcU$Uunm U 4Sjn[XV5 URnUR 5(dSnX`S.nSU-n [ X5 Xn [XT 5 U $)Nc*>TR"U0UD6 gr9rSrVrWrXs r&rY _set_signature..checksigr[r%rh _checksig_rAzYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs))r,r;rPr\r isidentifierexec _setup_func) rAoriginalr`r_resultr6rYnamecontextsrcrhrXs @r&_set_signaturers 8T*I "8y AF ~ ID#"t&   D     %4G $&* +C #mGs# Nr%c^ [U[5n[XU5unm U 4Sjn[XV5 URnX`S.nSU-n [ X5 Xn [ XT 5 [U 5 U $)Nc*>TR"U0UD6 gr9rSrxs r&rY&_set_async_signature..checksigr[r%rzzeasync def %s(*args, **kwargs): _checksig_(*args, **kwargs) return await mock(*args, **kwargs))r,r;rPr\r r}r~_setup_async_mock) rArr` is_async_mockr_r6rYrrrrhrXs @r&_set_async_signaturersx 8T*I%h)DID#"t&   D%4G *,0 1C #mGs#g Nr%c^^TTlU4SjnU4SjnU4SjnU4SjnU4SjnU4SjnU4Sjn UU4Sjn S TlS TlSTl[ 5Tl[ 5Tl[ 5TlTRTlTRTl TRTl UTl UTl UTl U TlU TlUTlUTlUTlUTlTTlg) Nc(>TR"U0UD6$r9)assert_called_withrVrWrAs r&r'_setup_func..assert_called_with&&777r%c(>TR"U0UD6$r9) assert_calledrs r&r"_setup_func..assert_calleds!!42622r%c(>TR"U0UD6$r9)assert_not_calledrs r&r&_setup_func..assert_not_calleds%%t6v66r%c(>TR"U0UD6$r9)assert_called_oncers r&r'_setup_func..assert_called_oncerr%c(>TR"U0UD6$r9)assert_called_once_withrs r&r,_setup_func..assert_called_once_withs++TTR"U0UD6$r9)assert_has_callsrs r&r%_setup_func..assert_has_callss$$d5f55r%c(>TR"U0UD6$r9)assert_any_callrs r&r$_setup_func..assert_any_calls##T4V44r%c>[5Tl[5TlTR5 TRn[ U5(aUTLaUR5 gggr9) _CallList method_calls mock_calls reset_mock return_valuer+)retrhrAs r&r_setup_func..reset_mocksO({&[ "" S ! !#+ NN +6 !r%Fr)rAcalled call_count call_argsrcall_args_listrrr side_effect_mock_childrenrrrrrrrrr^_mock_delegate) rhrArXrrrrrrrrs `` r&r~r~sGL8378=65GNGG&[G$;G"G,,G**G!00G!3G&=G#/G-G#G)G 1G!3GG!Dr%c ^[RRTlSTlSTl[ 5TlU4SjnSHn[TU[X55 M g)Nrc<>[TRU5"U0UD6$r9)r.rA)attrrVrWrAs r&wrapper"_setup_async_mock..wrapper"styy$'888r%)assert_awaitedassert_awaited_onceassert_awaited_withassert_awaited_once_withassert_any_awaitassert_has_awaitsassert_not_awaited) asyncio coroutines _is_coroutine await_count await_argsrawait_args_listrgr)rArris` r&rrsT ++99DDDO$;D 9,  i!<=,r%cSUSS-U:H$)N__%s__rrs r& _is_magicr4s d1Rj D ((r%c&\rSrSrSrSrSrSrg)_SentinelObjecti8cXlgr9rrUrs r&rF_SentinelObject.__init__:s r%c SUR-$Nz sentinel.%srrUs r&__repr___SentinelObject.__repr__=tyy((r%c SUR-$rrrs r& __reduce___SentinelObject.__reduce__@rr%rN)r r!r"r#rFrrr$rr%r&rr8s))r%rc&\rSrSrSrSrSrSrg) _SentineliDc0Ulgr9 _sentinelsrs r&rF_Sentinel.__init__Fs r%cdUS:Xa[eURRU[U55$)N __bases__)rJr setdefaultrrs r& __getattr___Sentinel.__getattr__Is, ;  ))$0EFFr%cg)Nrrrs r&r_Sentinel.__reduce__Osr%rN)r r!r"r#rFrrr$rr%r&rrDsG r%r> _mock_namer _mock_parentr_mock_new_name_mock_new_parent_mock_side_effect_mock_return_valuecd[RU5 SU-nX4SjnX4Sjn[X#5$)N_mock_cLURnUc [X5$[X15$r9)rr.)rUr _the_namerXs r&_get"_delegating_property.._getds(!! ;4+ +s!!r%cXURnUcXRU'g[XBU5 gr9)rrrrg)rUvaluerrrXs r&_set"_delegating_property.._setis(!! ;',MM) $ Cu %r%)_allowed_namesaddproperty)rrrrs r&_delegating_propertyras8t4I" $& D r%c \rSrSrSrSrSrg)ritc[U[5(d[RX5$[U5n[U5nX#:ag[ SX2- S-5HnXXB-nXQ:XdM g g)NFrT)r,rm __contains__lenrange)rUr len_valuelen_selfisub_lists r&r_CallList.__contains__vsn%&&$$T1 1J t9  q(.23Aak*H 4r%c@[R"[U55$r9)pprintpformatrmrs r&r_CallList.__repr__s~~d4j))r%rN)r r!r"r#rrr$rr%r&rrts  *r%rc8[U5n[U5(dgUR(d+UR(dURc UR bgUnUbXALagUR nUbMU(a XlX1lU(a XlX!lg)NFT)rCr+rrrr)parentrrnew_name_parents r&_check_and_set_parentr s % E U # #   U11    '    +G    **  !'' # r%c \rSrSrSrSrSrg) _MockIteric$[U5Ulgr9)iterr2)rUr2s r&rF_MockIter.__init__s 9r%c,[UR5$r9)nextr2rs r&__next___MockIter.__next__sDHH~r%r1N)r r!r"r#rFrr$rr%r&rrs r%rc"\rSrSr\rSrSrSrg)BaseiNcgr9rrUrVrWs r&rF Base.__init__s r%r) r r!r"r#rrrrFr$rr%r&rrs  r%rc\rSrSr\"5rS-SjrS-SjrSrS.Sjr S/Sjr S r S r S r \"\ \ \ 5r\S 5r\"S 5r\"S5r\"S5r\"S5r\"S5rSrSr\"\\5rS0SSS.S\S\4SjjjrSrSrSrSrSr Sr!Sr"Sr#S1S jr$S!r%S"r&S#r'S$r(S%r)S&r*S'r+S.S(jr,S)r-S*r.S+r/S,r0g)2r iNFc  U4n [U[5(d&U=(d UnUb[U5(a[U4n [URU SUR 05n[ [U5RU5nU$)Nrc) r:AsyncMockMixinr3r;r rc _safe_superr __new__)clsspecrrspec_setr  _spec_state _new_name _new_parent_spec_as_instance _eat_selfunsaferWbasesspec_argnewr`s r&rNonCallableMock.__new__ss#~..'4H# h(?(?'-3<<CKK(@A4<d..6&& D'C!$  r%cfURbXRlgXl[XSS5 g)NrT)rrrr )rUrs r&__set_return_value"NonCallableMock.__set_return_valueHs,    */4   ,&+ # !$tT :r%z1The value to be returned when the mock is called.cJURc [U5$UR$r9)rEr;rs r& __class__NonCallableMock.__class__Ts$    #: r%rrrrrcURnUc UR$URnUbF[U5(d6[ U[ 5(d![ U5(d[ U5nX!lU$r9)rrrcallabler,rr>)rU delegatedsfs r&__get_side_effect!NonCallableMock.__get_side_effectasb''  )) )  " " N8B<<"2y11-:K:K2B$& ! r%cR[U5nURnUcXlgXlgr9) _try_iterrrr)rUrras r&__set_side_effect!NonCallableMock.__set_side_effectls)% ''  %* "$) !r%rrrrc.Uc/n[U5U;agUR[U55 SUlSUlSUl[ 5Ul[ 5Ul[ 5UlU(a [Ul U(aSUl URR5H3n[U[5(d U[ LaM#UR#XUS9 M5 URn[%U5(aXPLaUR#U5 ggg)NFrri)idrMrrrrrrrrrrrvaluesr, _SpecState_deletedrr+)rUvisitedrrchildrs r&rNonCallableMock.reset_mockws ?G d8w  r$x  #+'k%K &-D # %)D "((//1E%,,0A   W[  Y2 %% S ! !co NN7 #'6 !r%c [UR5SS9HHup#URS5nUR5nUnUHn[ Xg5nM [ XeU5 MJ g)Nc*USRS5$)Nr.)count)entrys r&0NonCallableMock.configure_mock..sq1Dr%)keyrt)sorteditemssplitpopr.rg)rUrWargvalrVfinalr2rvs r&r7NonCallableMock.configure_mocksbv||~$E FHC 99S>DHHJECc) C $Fr%c 6US;a [U5eURb(XR;d U[;a[SU-5eO[U5(a [U5eUR(dSUR(aXR;a3UR S5(d U[ ;a[U<SU<S35e[R URRU5nU[La [U5eUcESnURb[URU5nURXX1US9nX RU'Oe[U[ 5(aP[#UR$UR&UR(UR*UR,5nX RU'SSS5 U$![.a? UR0S=(d Un[/SU<S U<S U<S UR$<S 3 5ef=f!,(df  W$=f) N>r5rHzMock object has no attribute %r)assertassretasertaseertassrtz6 is not a valid assertion. Use a spec for the mock if z is meant to be an attribute.)r rrr$r%rCannot autospec attr from target , as it has already been mocked out. [target=, attr=rD)rJrH _all_magicsrr5 startswith_ATTRIB_DENY_LISTr _lockrrsrnr/r.rVr,rmr r!r"r`r rrrr)rUrrr target_names r&rNonCallableMock.__getattr__s 4 4 & &    +---1D$%F%MNN2E t__ & &  $*<*<L^L^@^OPPTX\mTm$h''+h.KMNN " "((,,T2F!$T**##/$D$4$4d;E--% $..4##D)FJ// D, V__foo v{{F.4##D);#> (D"&-- "="EK*/x}&/*##'('&++CDDD/# "> s'B H $AF=%H =A HH  HcUR/nURnUnSnUS/:XaSnUbEUnURURU-5 SnURS:XaSnURnUbME[[ U55nUR =(d Sn[ U5S:aUSS;aUS- nXQS'SRU5$)NrtrTr;rAr)rTz().r)rrrMrmreversedrrjoin)rU _name_listr lastdot_firsts r&_extract_mock_name"NonCallableMock._extract_mock_names))* '' $ C!D   g44s: ;C%%-..G!(:./ *F z?Q !}M1# 1 wwz""r%cUR5nSnUS;aSU-nSnURb-SnUR(aSnX0RR-nS[ U5R<U<U<S[ U5<S3$) Nr;)rAzmock.z name=%rz spec=%rz spec_set=%r)rrErFr r;rk)rUr name_string spec_strings r&rNonCallableMock.__repr__s&&( ( ($t+K    '$K~~, %(8(8(A(AAK J     tH   r%cL[(d[RU5$UR=(d /n[ [ U55n[ UR5nURR5VVs/sHupEU[LdMUPM nnnUVs/sHowRS5(aMUPM nnUVs/sH,owRS5(a[U5(dM*UPM. nn[[X-U-U-55$s snnfs snfs snf)Nr()r object__dir__rHrJr;rmrrrr{rnrrrzset)rUextras from_type from_dictm_namem_valuefrom_child_mockses r&rNonCallableMock.__dir__ sz>>$' '##)rT O ' *.*=*=*C*C*E(*Evh& *E (!*C 1c1BQ C )# 1c1B1Bq\ #c&,y8;KKLMM(D#s$<DDD9D)D!2D!c^^U[;a[RTX5$TR(a;TRb.UTR;aUTR ;a[ SU-5eU[;aSU-n[ U5eU[;aTRbUTR;a[ SU-5e[U5(d)[[T5U[X55 UmUU4SjnOb[TUSU5 [[T5X5 UTRU'O/US:XaUTlg[TX!U5(aUTRU'TR (a4[#TU5(d#TR%5SU3n[ SU35e['U[(5(aUTR U'g[RTX5$)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.c>T"T/UQ70UD6$r9r)rVkwrrUs r&rw-NonCallableMock.__setattr__..1sHT,GD,GB,Gr%r]rtz Cannot set )rr __setattr__rFrHrrrJ_unsupported_magicsrr+rgr; _get_methodr rrEr.r-rr,r)rUrrmsg mock_namers` @r&rNonCallableMock.__setattr__s > !%%dD8 8nn!3!3!? ** *  % !Dt!KL L ( (BTIC % % [ !!-$d>P>P2P$%H4%OPP$U++T D+d*BC G&dE4>T D0,1##D) [ $D  $T5==,1##D)   WT4%8%82245Qtf=I ;yk!:; ; e\ * *"'DMM$  !!$44r%cU[;a>U[U5R;a%[[U5U5 XR;agURR U[ 5nXR;a [[U5RU5 OU[La [U5eU[ La URU [URU'gr9) rr;rrdelattrrrs_missingrr __delattr__rnrJ)rUrr2s r&rNonCallableMock.__delattr__Is ; 44:+>+>#> DJ %==(!!%%dH5 ==  . : :4 @ H_ & & h ##D)$,D!r%cDUR=(d Sn[X1U5$r@)r_format_call_signaturerUrVrWrs r&_format_mock_call_signature+NonCallableMock._format_mock_call_signature[s(&%d&99r%cjSnURX5nURnUR"U6nXCXW4-$)Nz0expected %s not found. Expected: %s Actual: %s)rr)rUrVrWactionmessageexpected_stringr actual_strings r&_format_mock_failure_message,NonCallableMock._format_mock_failure_message`s>F::4HNN 88)D /AAAr%c:U(d UR$SnURSS5RS5nURnUHRnUR U5nUb[ U[ 5(a U$[U5nURnURnMT U$)NrTr;rt)rGreplacer|rrsr,rmrC)rUrrXnameschildrenrps r&_get_call_signature_from_name-NonCallableMock._get_call_signature_from_namehs'' ' T2&,,S1&&DLL&E} 5* = = &e, //++ r%c[U[5(a$[U5S:aURUS5nO URnUbN[U5S:XaSnUupEOUup4nUR "U0UD6n[ X6RUR5$U$![anURS5sSnA$SnAff=f)Nrrr;) r,rnrrrGrTrrVrW TypeErrorwith_traceback)rU_callrXrrVrW bound_callrs r& _call_matcherNonCallableMock._call_matchers eU # #E Q44U1X>C&&C ?5zQ$ f%*"F . XXt6v6 D//:3D3DEEL .''-- .s%1B B>#B93B>9B>cURS:waDSUR=(d S<SUR<SUR5<3n[U5eg)Nr Expected 'rAz"' to not have been called. Called  times.rr _calls_reprAssertionErrorrUrs r&r!NonCallableMock.assert_not_calledsK ??a oo//oo&&(*C!% % r%cjURS:Xa#SUR=(d S-n[U5eg)Nrz"Expected '%s' to have been called.rA)rrrrs r&rNonCallableMock.assert_calleds6 ??a 7OO-v/C % % r%cURS:XdDSUR=(d S<SUR<SUR5<3n[U5eg)NrrrAz#' to have been called once. Called rrrs r&r"NonCallableMock.assert_called_oncesK!#oo//oo&&(*C!% % $r%cP^^^TRc)TRTT5nSnSU<SU<3n[U5eUUU4SjnTR[ TT4SS95nTRTR5nXC:wa*[ U[ 5(aUOSn[U"55Ueg)Nz not called.z#expected call not found. Expected: Actual: c,>TRTT5nU$r9rrrVrWrUs r&_error_message:NonCallableMock.assert_called_with.._error_messages33D&ACJr%Ttwo)rrrr_Callr, Exception)rUrVrWexpectedactual error_messagercauses``` r&r"NonCallableMock.assert_called_withs >> !77fEH"F)M / / %%eT6N&EF##DNN3   *8Y ? ?HTE !12 = r%cURS:XdDSUR=(d S<SUR<SUR5<3n[U5eUR"U0UD6$)NrrrAz' to be called once. Called r)rrrrrrUrVrWrs r&r'NonCallableMock.assert_called_once_withs\!#oo//oo&&(*C!% %&&777r%c ^UVs/sHnTRU5PM nn[SU5S5n[U4SjTR55nU(duXF;aoUcSnO9SR UVs/sHn[ U[ 5(aUOSPM sn5n[US[U5S[TR535Ueg[U5n/n UHn URU 5 M U (a4[TR=(d S<S[U 5<S U<S 35Uegs snfs snf![a U RU 5 M}f=f) Nc3T# UHn[U[5(dMUv M g7fr9r,r.0rs r& 3NonCallableMock.assert_has_calls..FAZ9-Eaa( (c3F># UHnTRU5v M g7fr9rrcrUs r&rrsM_d0033_!zCalls not found.z+Error processing expected calls. Errors: {} Expected: rrAz does not contain all of z in its call list, found z instead)rrrrformatr,rrrrmremoverLrMrrn) rUcalls any_orderrrr all_callsproblemr not_foundkalls ` r&r NonCallableMock.assert_has_callsss4995aD&&q)59FFMMT__MM (=0G ,-3V-5$7-5*4Ay)A)AAt$K-5$7.8%i !!*5!1 23!!*4??!; <>  O  D '  &  &*oo&?&?&+I&6 C   7:$7 '  & 'sD56#D:$D??EEc4UR[X4SS95n[U[5(aUOSnURVs/sHoPRU5PM nnU(dU[ U5;a UR X5n[SU-5Uegs snf)NTrz%s call not found)rrr,rr _AnyComparerrrrUrVrWrrrrrs r&rNonCallableMock.assert_any_calls %%eTN&EF&x;;151D1DE1DA$$Q'1DE HL$88">>tLO #o5 9FBc UR(a.SU;aSUS3OSnUR5U-n[U5eURS5nX@RS;a [ S0UD6$[ U5n[U[5(aU[;a[ nO[U[5(a8U[;d UR(aX@R;a[nOc[ nO\[U[5(d8[U[5(a[nO+[U[5(a[ nOUR"SnW"S0UD6$)NrrtrTr$rIrr)r.rrJrsrrr r;r:r_async_method_magicsr_all_sync_magicsrH CallableMixinrr rrq)rUrrirr$_typeklasss r&rVNonCallableMock._get_child_mocks   ,2bL!BvJ<(dI//1I=I + +FF;'  n5 5?r? "T  eY ' 'I9M,ME ~ . .--&&98J8J+J!!E=11%!566!E?33MM!$E{r{r%cXUR(dgS[UR5S3$)Nr;z Calls: rt)rrrs r&rNonCallableMock._calls_reprEs'9T__56a88r%) rrrErrrrrrr) NNNNNNr;NFNFFFFr9)r)1r r!r"r#rrrrFr=rAr6"_NonCallableMock__get_return_value"_NonCallableMock__set_return_value"_NonCallableMock__return_value_docrrr]rrrrrr!_NonCallableMock__get_side_effect!_NonCallableMock__set_side_effectrboolrr7rrrrrrrrrrrrrrrrrrVrr$rr%r&r r s] GE=AEIBEI, 8*Z  #L 9r%r assert_c\rSrSrSrSrg)r iZc UH5n[[X5VVs/sH up4X4:HPM snn5(dM5 g gs snnf)NTF)allzip)rUitemrrrs r&r_AnyComparer.__contains___sNE(+D(8(8$H"(8  s= rN)r r!r"r#rr$rr%r&r r Zs r%r cUcU$[U5(aU$[U5(aU$[U5$![a Us$f=fr9)r>rkrrr1s r&rfrfjsO { S ~~ Cy  s 6 AAc P\rSrSrSS\SSSSSSS4 SjrSrSrSrSr S r S r g) riyNr;c vX0RS'[[U5R"XXVUXU 40U D6 X lg)Nr)rrrrrFr) rUr!rrrrr"r r#r$r%rWs r&rFCallableMixin.__init__{sB/; *+M4(11  K 39 'r%cgr9rrs r&r]CallableMixin._mock_check_sigs r%cnUR"U0UD6 UR"U0UD6 UR"U0UD6$r9)r]_increment_mock_call _mock_callrs r&rICallableMixin.__call__s> d-f- !!4262///r%c&UR"U0UD6$r9)_execute_mock_callrs r&r0CallableMixin._mock_calls&&777r%cLSUl[R [X4SS9nX0lUR R U5 [UR 5UlSSS5 URSLnURnURnUS:HnURR [SX455 URnUbU(aMURR [XQU455 URSLnU(aURS-U-n[XaU45n URR U 5 UR(a-U(aSn OSn URS:HnURU -U-nURnUbMgg!,(df  GN<=f)NTrrTr;rt)rr rrrrrMrrrrrrrr) rUrVrWrdo_method_callsmethod_call_namemock_call_name is_a_callr%this_mock_callrs r&r/"CallableMixin._increment_mock_calls  " " 4.d3E"N    & &u -!$"5"56DO#++47??,,"d*  ub$%789++ %((//7Gv6V0WX"-":":$"F"'2'='='CFV'V$#N&#ABN  " " ) ). 9))CC'66$> !,!;!;c!AN!R&66K-%-# "s AF F#cURnUbS[U5(aUe[U5(d[U5n[U5(aUeOU"U0UD6nU[LaU$UR [La UR $UR(a)URR [La UR $URbUR"U0UD6$UR $r9) rr>rkrrrrrr/)rUrVrWeffectrs r&r3 CallableMixin._execute_mock_calls!!  V$$ v&&f (( L) 00W$  " "' 1$$ $   4#6#6#C#C7#R$$ $    '##T4V4 4   r%)rrrr) r r!r"r#rrFr]rIr0r/r3r$rr%r&rrys8 d$d!RT ' 0827h!r%rc\rSrSrSrg)rirNrrr%r&rrr'r%rcBSnUHnX ;dM [U<S35e g)N) autospect auto_specset_specz5 might be a typo; use unsafe=True if this is intended) RuntimeError)kwargs_to_checktypostypos r&_check_spec_arg_typosrH's/ 2E  "(OP r%c\rSrSrSr/rSS.SjrSrSrSr \ RS 5r S r S rS rS rSrSrSrSrg)_patchi0NFr(c Ub"U[La [S5eUb [S5eU (d [U 5 [U5(a[ SU<SU<S35e[U5(a[ SU<SU<S35eXlX lX0lXlX@l XPl SUl X`l Xpl Xl/UlSUlg)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherzCannot spec attr z0 as the spec has already been mocked out. [spec=rDz? as the spec_set target has already been mocked out. [spec_set=F)rrLrHr+rgetterrir+ new_callabler!create has_localr"autospecrWadditional_patchers is_started) rUrMrir+r!rOr"rQrNrWr(s r&rF_patch.__init__5s  #'! B# G !& ) T " ""#I=166:XQ@A A X & &"#I=1AAI AOP P "(     #% r%c j[URURURURUR UR URURUR5 nURUl URVs/sHo"R5PM snUl U$s snfr9) rJrMrir+r!rOr"rQrNrWattribute_namerRcopy)rUpatcherps r&rW _patch.copy[s KK499 KK MM4,,dkk  "&!4!4"66' 6FFH6' #' s B0c[U[5(aURU5$[R"U5(aUR U5$UR U5$r9r,r;decorate_classr/rdecorate_async_callabledecorate_callable)rUr6s r&rI_patch.__call__hsS dD ! !&&t, ,  & &t , ,//5 5%%d++r%c[U5HinUR[R5(dM)[ X5n[ US5(dMGUR 5n[XU"U55 Mk U$NrI)rJrr TEST_PREFIXr.r-rWrg)rUrr attr_valuerXs r&r]_patch.decorate_classpscJD??5#4#455 -J:z22iikG E!4 5 r%c#h# /n[R"5nURHZnURU5nURbUR U5 M4UR [LdMIURU5 M\ U[U5- nX#4v SSS5 g!,(df  g=f7fr9) contextlib ExitStack patchings enter_contextrVupdater+rrMrn)rUpatchedrVkeywargs extra_args exit_stackpatchingr~s r&decoration_helper_patch.decoration_helper~s  ! ! #z#-- ..x8**6OOC(\\W,%%c* . E*% %D" "$ # #s#B2AB!0(B! B2! B/+B2c^^^[TS5(aTRRT5 T$[T5UUU4Sj5mT/TlT$)Nrict>TRTUU5up#T"U0UD6sSSS5 $!,(df  g=fr9rqrVrmnewargs newkeywargsr6rlrUs r&rl)_patch.decorate_callable..patcheds;''(,(025KgW4 4222s ) 7r-rirMrrUr6rls``@r&r__patch.decorate_callablesN 4 % % NN ! !$ 'K t 5  5 "Fr%c^^^[TS5(aTRRT5 T$[T5UUU4Sj5mT/TlT$)Nric># TRTUU5up#T"U0UD6IShvN sSSS5 $N !,(df  g=f7fr9rurvs r&rl/_patch.decorate_async_callable..patchedsJ''(,(025Kg!7:k::22;22s$A535 A5 AArzr{s``@r&r^_patch.decorate_async_callablesN 4 % % NN ! !$ 'K t ;  ; "Fr%cdUR5nURn[nSnURUnSnU[;a[U[5(aSUl UR(dU[La[ U<SU<35eX44$![[ 4a [ X[5nNwf=f)NFTz does not have the attribute ) rMrirrrrJKeyErrorr. _builtinsr,rrO)rUtargetrrlocals r& get_original_patch.get_originals~~ t,HE 9 FJ!?!?DK{{x72 7=tD ) 6vW5H 6sB B/.B/c J UR(a [S5eURURURp2nUR UR pTURnUR5Ul USLaSnUSLaSnUSLaSnUbUb [S5eUcUbUS;a [S5eUR5upxU[LGaUGcSn USLa UnUSLaUnSnOUb USLaUnSnOUSLaUnUcUb+U[La [S5e[U[5(aSn UbUn OUc[U5(a[ n OeUcUbYUn UbUn [#U 5(aSU ;n O[%U 5(+n [U 5(a[ n OU (a[&n O [(n O[(n 0n UbX-S 'UbX=S '[U [5(a5[+U [,5(a UR.(aUR.U S 'U R1U5 U "S0U D6nU (a^[3U5(aNUn UbUn [#U 5(d[5U 5(d[&n U R7S 5 U "SUS S .U D6UlGOUbU[La [S5eU[La [S5e[;U5nUSLaUn[3UR5(a,[=SUR.<SUR<SU<S35e[3U5(aQ[?URSUR5n[=SUR.<SU<SUR<SU<S3 5e[AU4UUR.S.UD6nOU(a [S5eUnXpl!Xl"[FRH"5Ul%SUl[MURUR.U5 URNbz0nUR[LaUUURN'URPHDnURJRSU5nUR[LdM3UR1U5 MF U$U$! URT"[VRX"56(deg=f)NzPatch is already startedFzCan't specify spec and autospec)TNz6Can't provide explicit spec_set *and* spec or autospecTz!Can't use 'spec' with create=TruerIr!r"rrTrUzBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=Truerz: as the patch target has already been mocked out. [target=rrDr rr)r"_namez.Can't pass kwargs to a mock we aren't creatingr)-rSrDr+r!r"rQrWrNrMrrrrr,r;r3r ror`rrr:r rirkr+rur}rr rr.r temp_originalis_localrgrh _exit_stackrgrVrRrj__exit__sysexc_info)rUr+r!r"rQrWrNrrinheritKlass this_spec not_callable_kwargsrnew_attrrnrpr~s r& __enter___patch.__enter__s ??9: :"hh 4==8==$++&(( kkm  5=D u H u H   4=> >  !5 L (TU U++- '>h.Gt|t#'HD!t##HDT!#8#7w&#$GHHh--"G'$-"9"9!!X%9 ' (II&&#-Y#>L'/ ':#:L ++%E!0E%E!G"&#&. #5$''5/22t~~"&.. NN6 ""'"C,S11! ' (I ++&y110E F##($4SD$4+2$4  !'!(7" GHHH~H4# --&+DNN+=>#{{oWXLCDD!**%dkk:t{{K &+DNN+=]"o&#{{oWXLCDD "(BX(,B:@BC LM M% %//1  DKK :"". 88w&7:Jt223 $ 8 8H**88BC||w."))#.!9"!J ==#,,.12s B Q6Q64Q66*R"c<UR(dgUR(a?UR[La,[ UR UR UR5 O[UR UR 5 UR(d`[UR UR 5(aUR S;a+[ UR UR UR5 U?U?U?URnU? SUlUR"U6$)N)rcr!re__annotations__rfF) rSrrrrgrrirrOr-rr)rUrros r&r_patch.__exit__as  ==T//w> DKK1C1C D DKK 0;; T^^(L(L+== T^^T5G5GH   M K%%  ""H--r%c\UR5nURRU5 U$r9)r_active_patchesrMrUrs r&start _patch.startzs'! ##D) r%cURRU5 URSSS5$![a gf=fr9)rrrLrrs r&stop _patch.stopsD   ' ' - }}T4..   s 0 ==)rrRrirQrOrMrPrrSrWr+rNr!r"rr)r r!r"r#rVrrFrWrIr]rgcontextmanagerrqr_r^rrrrrr$rr%r&rJrJ0sgNOAF# L ,  # #""0Xt.2/r%rJcURSS5up[ [ R U5U4$![[[4a [SU<35ef=f)Nrtrz,Need a valid target to patch. You supplied: )rsplitrrLrJrpkgutil resolve_name)rris r& _get_targetrshG"MM#q1 7'' 0) ;; z> 2G:6* EG GGs 2%ArKc n^[T5[La[T<S35eU4Sjn [XX#UXVXyUS9 $)Nz3 must be the actual object to be patched, not a strc>T$r9rrsr&rw_patch_object..sVr%rK)r;strrrJ) rrir+r!rOr"rQrNr(rWrMs ` r& _patch_objectrsK$ F|sjK L  F 3fL r%c x^[T5[La[[RT5nOU4SjnU(d [ S5e[ UR55nUSup[XyXX#XE05 n Xl USSH5up[XyXX#XE05 n Xl U RRU 5 M7 U $)Nc>T$r9rrsr&rw!_patch_multiple..sr%z=Must supply at least one keyword argument with patch.multiplerr) r;rrrrrLrmr{rJrVrRrM) rr!rOr"rQrNrWrMr{rir+rX this_patchers ` r&_patch_multiplers, F|s--v6  K    E1XNI3fG')  s& B '0###**<8 $ Nr%c 8[U5up[XXUXEXhUS9 $)NrK)rrJ) rr+r!rOr"rQrNr(rWrMris r&rrs-V$F+F 3fL r%cZ\rSrSrSSjrSrSrSrSrSr Sr S r S r S r S rS rg) _patch_dicti6c Xl[U5UlURRU5 X0lSUlgr9)in_dictdictrlrkclear _original)rUrrlrrWs r&rF_patch_dict.__init__Ss0 6l  6" r%c[U[5(aURU5$[R"U5(aUR U5$UR U5$r9r\)rUfs r&rI_patch_dict.__call__\sS a  &&q) )  & &q ) )//2 2%%a((r%c4^^[T5UU4Sj5nU$)Nc>TR5 T"U0UD6TR5 $!TR5 f=fr9r _unpatch_dictrVrrrUs r&_inner-_patch_dict.decorate_callable.._inneres8     %$~"~""$""$s+=rrUrrs`` r&r__patch_dict.decorate_callabled q %  % r%c4^^[T5UU4Sj5nU$)Nc># TR5 T"U0UD6IShvN TR5 $N!TR5 f=f7fr9rrs r&r3_patch_dict.decorate_async_callable.._innerqsC     %^^+""$,""$s%A  757A 7A  A rrs`` r&r^#_patch_dict.decorate_async_callableprr%c0[U5Hn[X5nUR[R5(dM4[ US5(dMG[ URURUR5nU"U5n[XU5 M U$rb) rJr.rrrcr-rrrlrrg)rUrrrd decorator decorateds r&r]_patch_dict.decorate_class|sqJD -J 1 122Z00' dkk4::N %j1 Y/  r%c:UR5 UR$r9)rrrs r&r_patch_dict.__enter__s ||r%cURn[UR[5(a%[R "UR5UlURnUR nUR5nX@l U(a [U5 URU5 g![a 0nUH nX%XE'M NHf=f![a UH nXX%'M gf=fr9) rlr,rrrrrrWrJr _clear_dictrk)rUrlrrrrys r&r_patch_dict._patch_dicts dllC ( ("// =DL,,  -||~H"    + NN6 " -H '    - +%{  +s$*B%C%CCC"!C"cURnURn[U5 URU5 g![a UH nX#X'M gf=fr9)rrrrkrJ)rUrrrys r&r_patch_dict._unpatch_dictsO,,>>G - NN8 $ -'}   -s7AAc>URbUR5 gNF)rr)rUrVs r&r_patch_dict.__exit__s >> %    r%cdUR5n[RRU5 U$r9)rrJrrMrs r&r_patch_dict.starts'!%%d+ r%c[RRU5 UR SSS5$![a gf=fr9)rJrrrLrrs r&r_patch_dict.stopsD   " " ) )$ / }}T4..   s4 AA)rrrrlN)rF)r r!r"r#rFrIr_r^r]rrrrrrr$rr%r&rr6s9:)   +8 -/r%rcrUR5 g![a [U5nUHnX M gf=fr9)rrJrm)rkeysrys r&rrs7  G}C s  66cd[[R5HnUR5 M gr9)rrJrr)rs r&_patch_stopallrs &001 2r%testzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index round trunc floor ceil bool next fspath aiter zDadd sub mul matmul truediv floordiv mod lshift rshift and xor or pow c#,# UH nSU-v M g7f)zi%sNrrns r&rrs7&6519&6c#,# UH nSU-v M g7f)zr%sNrrs r&rrs5$4q$4r>r__get____set__r __delete__ __format__r __missing__ __getstate__ __reversed__ __setstate__ __getformat__ __reduce_ex____getnewargs____subclasses____getinitargs____getnewargs_ex__c ^U4SjnXlU$)Nc>T"U/UQ70UD6$r9r)rUrVrr6s r&method_get_method..method sD&4&2&&r%)r )rr6rs ` r&rrs'O Mr%r> __aexit__ __anext__ __aenter__ __aiter__>__del__rrFr __prepare__r__instancecheck____subclasscheck__c,[RU5$r9)r__hash__rs r&rwrw%s V__T2r%c,[RU5$r9)r__str__rs r&rwrw&s FNN40r%c,[RU5$r9)r __sizeof__rs r&rwrw'sv006r%cj[U5RSUR5S[U53$)N/)r;r rrkrs r&rwrw(s3$t*"5"5!6a8O8O8Q7RRSTVW[T\S]^r%)rr r  __fspath__ry?g?) __lt____gt____le____ge____int__r__len__r __complex__ __float____bool__ __index__rc^U4SjnU$)Nc^>TRRnU[LaU$TULag[$rE)__eq__rrNotImplemented)otherret_valrUs r&r_get_eq..__eq__=s/++00 ' !N 5=r%r)rUrs` r&_get_eqr <s Mr%c^U4SjnU$)Ncb>TRR[La[$TULag[$r)__ne__rrr)rrUs r&r#_get_ne..__ne__Gs* ;; ) ) 8N 5=r%r)rUr#s` r&_get_ner%Fs Mr%c^U4SjnU$)Ncn>TRRnU[La [/5$[U5$r9)__iter__rrrrrUs r&r(_get_iter..__iter__Ps/--22 g 8OG}r%r)rUr(s` r& _get_iterr+Os Or%c^U4SjnU$)Nc>TRRnU[La[[ /55$[[ U55$r9)rrr_AsyncIteratorrr)s r&r"_get_async_iter..__aiter__Zs8..33 g !$r(+ +d7m,,r%r)rUrs` r&_get_async_iterr0Ys- r%)rr#r(rc[RU[5nU[LaX1lg[RU5nUbU"U5nXQlg[ RU5nUbU"U5Ulggr9)_return_valuesrsrr_calculate_return_value_side_effect_methodsr)rArrfixedreturn_calculatorr side_effectors r&_set_return_valuer8jsw   tW -E G#/33D9$(. *(,,T2M *40!r%c \rSrSrSrSrSrg) MagicMixini|cUR5 [[U5R"U0UD6 UR5 gr9)_mock_set_magicsrr:rF)rUrVrs r&rFMagicMixin.__init__}s4 J%..;; r%c [[-nUn[USS5bXURUR5n[ 5nX- nUH)nU[ U5R;dM[X5 M+ U[ [ U5R5- n[ U5nUHn[XT[X@55 M g)NrH) _magicsrr. intersectionrHrr;rrrrg MagicProxy)rU orig_magics these_magics remove_magicsrvrs r&r<MagicMixin._mock_set_magicss 44 " 4$ / ;&33D4F4FGLEM'6M&DJ///D(' $c$t**=*=&>> T !E E*U"9 :"r%rN)r r!r"r#rFr<r$rr%r&r:r:|s  ;r%r:c\rSrSrSSjrSrg)ricFURX5 UR5 gr9r6r<r@s r&rA"NonCallableMagicMock.mock_add_spec D+ r%rNr)r r!r"r#rAr$rr%r&rrs r%rc\rSrSrSrg)AsyncMagicMixinirNrrr%r&rLrLsr%rLcB^\rSrSrSSjrSS.S\4U4SjjjrSrU=r$) riFcFURX5 UR5 gr9rHr@s r&rAMagicMock.mock_add_specrJr%)rrc>U(a-UR(a[UR5(aSn[5R"USU0UD6 g)NFr)rrsuperr)rUrrVrWr]s r&rMagicMock.reset_mocks= $//** !L DF|FvFr%rr) r r!r"r#rAr rr$ __classcell__r]s@r&rrs! 9> G G Gr%rc*\rSrSrSrSrSSjrSrg)rAicXlX lgr9rr )rUrr s r&rFMagicProxy.__init__s   r%cURnURnURXUS9n[X!U5 [ X#U5 U$)N)rr$r%)rr rVrgr8)rUrvr ms r& create_mockMagicProxy.create_mocksG   " "/5 # 7q!&U+r%Nc"UR5$r9)r[)rUr2rs r&rMagicProxy.__get__s!!r%rWr9)r r!r"r#rFr[rr$rr%r&rArAs"r%rAc^\rSrSr\"S5r\"S5r\"S5rU4SjrSr Sr Sr S r S r S rSS jrS rU4SjrSrU=r$)rirrrc>[5R"U0UD6 [RRUR S'SUR S'SUR S'[ 5UR S'[(a4[[S9n[UR S'[UR S'O [[S9n[R[R-[R-UlSUlS UlSUlSUlX0R S 'S UR S '[)5UR S '0UR S'SUR S'g)Nrr_mock_await_count_mock_await_args_mock_await_args_listr"rErG)rVrWr5r r rerfr)rQrFrrrrrr _CODE_SIGr _CODE_ATTRSrr/ CO_COROUTINE CO_VARARGSCO_VARKEYWORDSco_flags co_argcount co_varnamesco_posonlyargcountco_kwonlyargcountrn)rUrVrW code_mockr]s r&rFAsyncMockMixin.__init__s4 $)&)*1););)I)I o&-. )*,0 ()1: -. 9'=I08I  } -4=I  0 1':I     !$$ %  !"  2 '( $&' #$- j!$/ j!(- n%*, &'+/ '(r%c# [X4SS9nU=RS- slX0lURR U5 UR nUbu[ U5(aUe[U5(d[U5n[ U5(aUeO)[U5(aU"U0UD6IShvN nOU"U0UD6nU[LaU$UR[La UR$URbF[UR5(aUR"U0UD6IShvN $UR"U0UD6$UR$![a [ef=fNN87f)NTrr)rrrrrMrr>rkr StopIterationStopAsyncIterationrrrrr/)rUrVrWrr=rs r&r3!AsyncMockMixin._execute_mock_call s^tn$/ A ##E*!!  V$$ v&&-!&\F !(( L)$V,,%t6v6600W$  " "' 1$$ $    '"4#3#344!--t>v>>>##T4V4 4   -%--,-7?s=A3E6 E.E/E0A3E#E$"EEEEclURS:Xa$SUR=(d SS3n[U5eg)Nr Expected rAz to have been awaited.rrrrs r&rAsyncMockMixin.assert_awaited3 s;   q doo788NOC % % !r%cURS:Xd1SUR=(d SSURS3n[U5egNrrvrAz$ to have been awaited once. Awaited rrwrs r&r"AsyncMockMixin.assert_awaited_once; sM1$t8&9:#//09C % %%r%c@^^^TRc!TRTT5n[SUS35eUUU4SjnTR[ TT4SS95nTRTR5nXS:wa*[ U[ 5(aUOSn[U"55Ueg)NzExpected await: z Not awaitedc*>TRTTSS9nU$)Nawait)rrrs r&r:AsyncMockMixin.assert_awaited_with.._error_messageL s33D&3QCJr%Tr)rrrrrr,r)rUrVrWrrrrs``` r&r"AsyncMockMixin.assert_awaited_withD s ?? "77fEH #3H:]!KL L %%eT6N&EF##DOO4   *8Y ? ?HTE !12 = r%cURS:Xd1SUR=(d SSURS3n[U5eUR"U0UD6$rz)rrrrrs r&r'AsyncMockMixin.assert_awaited_once_withV s^ 1$t8&9:#//09C % %''888r%c4UR[X4SS95n[U[5(aUOSnURVs/sHoPRU5PM nnU(dU[ U5;a UR X5n[SU-5Uegs snf)NTrz%s await not found)rrr,rrr rrr s r&rAsyncMockMixin.assert_any_awaita s%%eTN&EF&x;;151E1EF1EA$$Q'1EF HL$88">>tLO $6 9Grc z^UVs/sHnTRU5PM nn[SU5S5n[U4SjTR55nU(dlXF;afUcSnO9SR UVs/sHn[ U[ 5(aUOSPM sn5n[US[U5STR35Ueg[U5n/n UHn URU 5 M U (a[[U 5<S35Uegs snfs snf![a U RU 5 Mbf=f)Nc3T# UHn[U[5(dMUv M g7fr9rrs r&r3AsyncMockMixin.assert_has_awaits..{ rrc3F># UHnTRU5v M g7fr9rrs r&rr| s!S>Rt11!44>RrzAwaits not found.z,Error processing expected awaits. Errors: {}rz Actual: z not all found in await list) rrrrrr,rrrmrrLrMrn) rUrrrrr all_awaitsrrrr s ` r&r AsyncMockMixin.assert_has_awaitsn s]4995aD&&q)59FFMSd>R>RSS )=1G ,-3V-5$7-5*4Ay)A)AAt$K-5$7.8%i !!*5!1 23#3346  *%  D '!!$'  49)4DF  7:$7 '  & 'sD6#DDD:9D:cURS:wa1SUR=(d SSURS3n[U5eg)NrrvrAz# to not have been awaited. Awaited rrwrs r&r!AsyncMockMixin.assert_not_awaited sM   q t8&9:#//09C % % !r%ct>[5R"U0UD6 SUlSUl[ 5UlgNr)rQrrrrrrUrVrWr]s r&rAsyncMockMixin.reset_mock s3 D+F+({r%)rrrr)r r!r"r#rrrrrFr3rrrrrrrrr$rSrTs@r&rrs\&}5K%l3J*+<=O0B&!P&&>$ 9 *X&++r%rc\rSrSrSrg)r i rNrrr%r&r r r'r%r c&\rSrSrSrSrSrSrg)_ANYi cgrErrUrs r&r _ANY.__eq__ sr%cgrrrs r&r# _ANY.__ne__ sr%cg)Nzrrs r&r _ANY.__repr__ sr%rN)r r!r"r#rr#rr$rr%r&rr sr%rc :SU-nSnSRUVs/sHn[U5PM sn5nSRUR5VVs/sHupxU<SU<3PM snn5n U(aUnU (aU(aUS- nXI- nX4-$s snfs snnf)Nz%s(%%s)r;z, =)rreprr{) rrVrWrformatted_argsr~ args_stringryr kwargs_strings r&rr s$GN))$7$3T#Y$78KII171?:33M$  d "N'  ##8s BB c\rSrSrSSjrSSjrSr\RrSr Sr Sr S r \ S 5r\ S 5rS rS rSrg)ri NcSn0n[U5nUS:XaUup&nO{US:Xa9Uup[U [5(aU n[U [5(aU nOBU nO?XpvOUun [ U [ 5(aU n0nOb[ U [5(aU nS0pOGSnU nOBUS:Xa;Uup[ U [5(aU n[ U [ 5(aU 0pOSU pOXpOgU(aXc:wagXx4XE4:H$![a [s$f=f) Nr;rrFrrrr)rrrr.rr,rnr) rUr len_other self_name self_args self_kwargs other_name other_args other_kwargsrrrs r&r _Call.__eq__4 sP "E I t9>%) "I{04 -I+ D.$ / /GE>SW4X4X%%););; >')2 !^38 0JL !^FE%''" ! E3''" +-rL $ !^!ME%%%" fe,,/5r /16 +0L 0)i-EEE_ "! ! "s DD,+D,c~URc [SX4SS9$URS-n[URX4X0S9$)Nr;rTrrWrrrs r&rI_Call.__call__l sB ?? ""d+$7 7%doot44MMr%cjURc [USS9$UR<SU<3n[X SS9$)NF)rrrt)rr rr)rUrrs r&r_Call.__getattr__t s4 ?? "de4 4//40$u==r%c`U[R;a[e[RX5$r9)rnrrrJ__getattribute__)rUrs r&r_Call.__getattribute__{ s% 5>> ! %%d11r%c>[U5S:XaUupX4$Uup1nX4$)Nr)rrs r&_get_call_arguments_Call._get_call_arguments s2 t9>LD|"& D|r%c(UR5S$rrrs r&rV _Call.args '')!,,r%c(UR5S$)Nrrrs r&rW _Call.kwargs rr%c,UR(d2UR=(d SnURS5(aSU-nU$[U5S:XaSnUup#O0UupnU(dSnO!URS5(dSU-nOSU-n[ XU5$)NrrTzcall%srzcall.%s)rrrrr)rUrrVrWs r&r_Call.__repr__ s##??,fDt$$$K t9>DLD&!% D__T** 4'$%d&99r%c/nUnUb3UR(aURU5 URnUbM3[[ U55$r9)rrMrrr)rUvalsthings r& call_list_Call.call_list sM$$ E"&&E$((r%)rrr)rr;NFT)rNNFT)r r!r"r#rrFrrr#rIrrrrrVrWrrr$rr%r&rr sw&:?8@>C)2Fj]]FN>2 ----:* )r%r)rc [U5(a [U5n[U[5n[U5(a[ SU<S35e[ U5nSU0n U(aSU0n OUc0n U (a U(aSU S'U(d [ U5 URSU5nUn UcSn U RU5 [n [R"U5(a0n O[U(aU(a [S 5e[n O;[U5(d[n O$U(aU(a[!U5(d[n U "SX3U US .U D6n [U["5(aU(a [%X5n O['X5n O [)X Xr5 UbU(dXR*U'URS S5n U(aU(dS U;a[-XSS U U S9U l[1U5GH0n[3U5(aM[5X5nSU0nU (a[9X5(aURUS9 U(aSU0n[U["5(d[;XXU5nUU R*U'OU n[U["5(a U R<n[?XU5nUUS'[AU5(a[nO[nU"SUXUS.UD6nUU R*U'U"5Ul[)UUUS9 [U["5(dGM$[CXU5 GM3 [U 5(aU(aU RD"S0UD6 U $![6a GMnf=f)Nz'Cannot autospec a Mock object. [object=rDr!r"Tr&rr;zJInstance can not be True when create_autospec is mocking an async function)r r%r$rrrrT)r`rr rrr')r rr$r%)r_r)#ror;r,r+rr7rHr}rkrr/isdatadescriptorrDr rkrrurBrrrarr rrJrr.rJr-rmrA _must_skiprrgr7)r!r"r`r rr(rWis_type is_async_funcrr$rrAwrappedrvr child_kwargsr+r r_ child_klasss r&r r s(.~~Dzt$G"**. 45 5"4(MtnGt$ 8'+#$ f% JJvu %EI  NN6 E%%   >? ? t__$ X&8&>&>$  (  (& (D$ && '3D!$-DW78(,u%jj$'GxN&$@+DT2629;T U    t+H) ww..   h  / &1L(M22XhGC),D   &F$ .."48I(1L %"8,,' ' BV%*0B4@BC),D   &*}C  Xsi @ c= ) ) D %gn6 %f% KU   s8 M MMcT[U[5(dU[US05;agURnURHdnUR R U[5nU[LaM.[U[[45(a g[U[5(aUs $ g U$)NrrF) r,r;r.r]rqrrrsrrHrGrB)r!rvrrrs r&rrM s dD ! ! GD*b1 1~~##E73 W   f|[9 : :  . .N Nr%c"\rSrSrSSjrSrg)rmii NcLXlXPlX lX0lX`lX@lgr9)r!idsr"r r`r)rUr!r"r rrr`s r&rF_SpecState.__init__k s      r%)rr`rr r!r")FNNNF)r r!r"r#rFr$rr%r&rmrmi s 48/4r%rmc[U[5(a[R"U5$[R"U5$r9)r,bytesioBytesIOStringIO) read_datas r& _to_streamr s-)U##zz)$${{9%%r%c ^^ ^ ^ ^ [T5nUS/m U U 4SjnU U 4SjnU U 4Sjm U U 4Sjm U U 4SjnU 4Sjn[cVSSKn[[ [ UR 55R[ [ UR5555q[c+SSKn[[ [ UR555q Uc[S[S 9n[[S 9m T T Rl ST Rl ST Rl ST R l ST R"l UT RlT "5T S 'T S T R lUT R"lT T R&lUT R(lUT R*lU U U U4S jnXlT Ul U$) Nc>TRRbTRR$TSR"U0UD6$r) readlinesrrVrW_statehandles r&_readlines_side_effect)mock_open.._readlines_side_effect sA    ( ( 4##00 0ay""D3F33r%c>TRRbTRR$TSR"U0UD6$r)readrrs r&_read_side_effect$mock_open.._read_side_effect s; ;; # # /;;++ +ay~~t.v..r%c?b># T"5ShvN TSR"U0UD6v MN7fr)readline)rVrW_iter_side_effectrs r&_readline_side_effect(mock_open.._readline_side_effect s9$&&&)$$d5f5 5 's /-/c3># TRRbTRRv MTSHnUv M g7fr)rr)linerrs r&r$mock_open.._iter_side_effect sA ?? ' ' 3oo2221IDJsAAcz>TRRbTRR$[TS5$r)rrr)rrsr&_next_side_effect$mock_open.._next_side_effect s1 ?? ' ' 3??// /F1Ir%c&>TR5 gr9)close)exctypeexcinstexctbrs r&_exit_side_effect$mock_open.._exit_side_effect s  r%ropen)rr!)r!rc>[T5TS'TRRTS:XaT"5TS'TSTRl[$)Nrr)rrrr)rVrWrrrrs r& reset_datamock_open..reset_data sHy)q ?? & &&) 3-/F1I*0)FOO 'r%)r file_spec_iormrrJ TextIOWrapperunionr open_specrrrrwriterrrrr(rr) rAr _read_datarrrrrrrrrrs ` @@@@r&rr skI&J$ F4 / 6  S!2!234::3s3;;?O;PQR S]+,  |f95 I &F$*F! $FLL#FKK#'FOO $(F!/FKK%'F1I"()FOO#9F "3FOO"3FOO"3FOO"D Kr%c*\rSrSrSrSSjrSrSrg)ri c [S0UD6$)Nr)r)rUrWs r&rVPropertyMock._get_child_mock s"6""r%NcU"5$r9r)rUr2obj_types r&rPropertyMock.__get__ s v r%cU"U5 gr9r)rUr2rs r&rPropertyMock.__set__ s  S r%rr9)r r!r"r#rVrrr$rr%r&rr s#r%rcr^\rSrSrSrU4Sjr\S.U4SjjrU4SjrSr U4Sjr \S.S jr S r S r U=r$) ThreadingMixini Nc >[URS5[5(aUSRUS'O6[URS5[5(aUSRUS'[ 5R "S0UD6$)Nr timeoutr%r)r,rsr_mock_wait_timeoutrQrV)rUrr]s r&rVThreadingMixin._get_child_mock sl bffX& 7 7xL;;ByM }-~ > >}-@@ByMw&&,,,r%rc&>[5R"U0UD6 U[La URn[R "5UR S'/UR S'[R"5UR S'XR S'g)N _mock_event_mock_calls_events_mock_calls_events_lockr)rQrF_timeout_unsetDEFAULT_TIMEOUT threadingEventrrLock)rUrrVrWr]s r&rFThreadingMixin.__init__ sr $)&) n $**G'0'8 m$.0 *+3<>>3C /0.5 *+r%c>[5R"U0UD6 [R"5URS'/URS'g)Nrr)rQrrr rrrs r&rThreadingMixin.reset_mock s> D+F+'0'8 m$.0 *+r%cUR URHup4nX44X4:XdMUs sSSS5 $ [R"5nURR XU45 SSS5 U$!,(df  W$=fr9)rrrr rM)rU expected_argsexpected_kwargsrVrWevent new_events r& __get_eventThreadingMixin.__get_event s}  ) )'+'>'>#e>m%EE L* )'>")I  # # * *MI+V W *  * ) sA5A54A55 Bc>[5R"U0UD6nURX5nUR5 URR5 U$r9)rQr0_ThreadingMixin__get_eventrr)rUrVrW ret_value call_eventr]s r&r0ThreadingMixin._mock_call sLG&&77 %%d3  r%cU[La URnURRUS9(d&UR=(d SSUS3n[ U5eg)NrrAz was not called before timeout(z).)rrrwaitrr)rUrrs r&wait_until_called ThreadingMixin.wait_until_called! s` n $--G$$W$5oo/01&ir+C % %6r%cURX5nURURS9(dURX5n[ US35eg)Nrz call not found)r-r2rrr)rUrVrWr(rs r&wait_until_any_call_with'ThreadingMixin.wait_until_any_call_with/ sP   .zz$"9"9z:">>tLO O#4O!DE E;r%r)r r!r"r#rrVrrFrr-r0r3r6r$rSrTs@r&rr sAO-'5661,: &FFr%rc\rSrSrSrg)r i: rNrrr%r&r r : s r%r c6SUl[U5Hrn[X5n[ U[ 5(dM&[ UR RU5[5(aMVURULdMg[U5 Mt g![a Mf=frE) r.rJr.rJr,r rrsrmrr)rArrZs r&rrJ sDD  #A!_--  a&&**40* = =    % G   s B  BBc \rSrSrSrSrSrg)r.ib cpXl[[S9n[RUlX R S'g)Nrdr5)iteratorr rr/CO_ITERABLE_COROUTINErjrr)rUr<ros r&rF_AsyncIterator.__init__f s+ #X6 $:: $- j!r%c`# [UR5$![a [ef=f7fr9)rr<rrrsrs r&r_AsyncIterator.__anext__l s0  & &     s.. +.+.)r<N)r r!r"r#rFrr$rr%r&r.r.b s . !r%r.rr)NFNNN)FFNNr:)__all__rrgrr/rrbuiltinsrrrtypesrrr unittest.utilr functoolsrrrrrrJrrr rQrr3r7r+r>rCrPrar\rkrorurrr~rrrrrrrMISSINGrDELETEDrnrrrmrr rrr frozenset removeprefixrr rfrrrHrJrrrrrrrrmultiplestopallrc magic_methodsnumericsrr|inplaceright _non_defaultsrr?r_sync_async_magics _async_magicsrrrr3rr2r r%r+r0r4r8r:rrLrrArKrFrerfrLrr rrrrnrrr rrmr;rrBrrrrr TIMEOUT_UNSETrrr rr.)rrs00r&rTsJ (  '22#$CyC"(m Hmd??33GTm H   @2  F # & 4.."b>6) )f )   ;          &**(6  6 ^ 9d^ 9DO$$ y!!Di $ 4  m!Dm!b8=/8zY/VY/z < 'Ttd&+:?C04.d$u4OCHOdV/&V/r       "K  ((7hnn&67 7 5HNN$455  HHmXw 67==? ?!Hv?  @!]$'99 ]*. 306^ " 1$;;>  :   j G DGB""$!!'(*;*;T"BCIh-K E+TE+P((V 6  f$$v)Ev)r uCGT*/Tn8        &Sl4$''EFTEFP  NJ  0!!ga IH!x dIs0 P=PP !P P+PP P PK!Tү __init__.pynu[PK!b!%  __main__.pynu[PK!ڗc c signals.pynu[PK!&Ϫ## result.pynu[PK!֋44e<suite.pynu[PK!d__equtil.pynu[PK!n]]"__pycache__/loader.cpython-312.pycnu[PK!l==( __pycache__/runner.cpython-312.opt-2.pycnu[PK!?jj*"__pycache__/__main__.cpython-312.opt-1.pycnu[PK!A}} $__pycache__/case.cpython-312.pycnu[PK!>ET kk&5__pycache__/mock.cpython-312.opt-2.pycnu[PK!?_ X__pycache__/mock.cpython-312.pycnu[PK!L,__pycache__/async_case.cpython-312.opt-2.pycnu[PK!^|FF&__pycache__/_log.cpython-312.opt-1.pycnu[PK!d::&F__pycache__/case.cpython-312.opt-1.pycnu[PK!oj&ֿ__pycache__/case.cpython-312.opt-2.pycnu[PK!ծO4O4&__pycache__/main.cpython-312.opt-2.pycnu[PK!iG<G<!__pycache__/suite.cpython-312.pycnu[PK!^繳,__pycache__/async_case.cpython-312.opt-1.pycnu[PK!&__pycache__/_log.cpython-312.opt-2.pycnu[PK!)1__pycache__/signals.cpython-312.opt-1.pycnu[PK!@M@M@(t?__pycache__/runner.cpython-312.opt-1.pycnu[PK!^|FF __pycache__/_log.cpython-312.pycnu[PK!D11"__pycache__/result.cpython-312.pycnu[PK!<|)j j $__pycache__/__init__.cpython-312.pycnu[PK!WX&__pycache__/async_case.cpython-312.pycnu[PK!iG<G<'__pycache__/suite.cpython-312.opt-1.pycnu[PK!-y!w8w8't( __pycache__/suite.cpython-312.opt-2.pycnu[PK!@8 ![[ Ba __pycache__/util.cpython-312.pycnu[PK!k&} __pycache__/util.cpython-312.opt-2.pycnu[PK!D11(\ __pycache__/result.cpython-312.opt-1.pycnu[PK!?jj$x __pycache__/__main__.cpython-312.pycnu[PK!E~RR(6 __pycache__/loader.cpython-312.opt-2.pycnu[PK!ߙ))(= __pycache__/result.cpython-312.opt-2.pycnu[PK!h&mI __pycache__/util.cpython-312.opt-1.pycnu[PK!<|)j j *e __pycache__/__init__.cpython-312.opt-1.pycnu[PK!MM*Ss __pycache__/__main__.cpython-312.opt-2.pycnu[PK!.544 u __pycache__/main.cpython-312.pycnu[PK!@M@M@"C __pycache__/runner.cpython-312.pycnu[PK!.544& __pycache__/main.cpython-312.opt-1.pycnu[PK!VD*1! __pycache__/__init__.cpython-312.opt-2.pycnu[PK!)( __pycache__/signals.cpython-312.opt-2.pycnu[PK!\\(6 __pycache__/loader.cpython-312.opt-1.pycnu[PK!#Փ __pycache__/signals.cpython-312.pycnu[PK!q&B __pycache__/mock.cpython-312.opt-1.pycnu[PK! &q case.pynu[PK!ޙ| XU_log.pynu[PK!F|KK I`loader.pynu[PK! _t-t-main.pynu[PK!bz async_case.pynu[PK!~F(( runner.pynu[PK!wmock.pynu[PK!a2 NN&__pycache__/mock.cpython-311.opt-1.pycnu[PK!D5D5&o__pycache__/main.cpython-311.opt-2.pycnu[PK!>>( __pycache__/runner.cpython-311.opt-2.pycnu[PK!,t8__pycache__/async_case.cpython-311.opt-1.pycnu[PK!qS_ *R__pycache__/__init__.cpython-311.opt-2.pycnu[PK!Fpz \__pycache__/_log.cpython-311.pycnu[PK!R__(o__pycache__/loader.cpython-311.opt-2.pycnu[PK!&66 __pycache__/case.cpython-311.pycnu[PK!ax55 __pycache__/main.cpython-311.pycnu[PK!a55)A=__pycache__/signals.cpython-311.opt-1.pycnu[PK!3E++(L__pycache__/result.cpython-311.opt-2.pycnu[PK!HҖ$x__pycache__/__init__.cpython-311.pycnu[PK!EWW&͉__pycache__/async_case.cpython-311.pycnu[PK!Fpz&z__pycache__/_log.cpython-311.opt-1.pycnu[PK!j+%%,__pycache__/async_case.cpython-311.opt-2.pycnu[PK!}3׶22(*__pycache__/result.cpython-311.opt-1.pycnu[PK!xjǪǪ&8__pycache__/mock.cpython-311.opt-2.pycnu[PK!}T4W U__pycache__/util.cpython-311.pycnu[PK!2}1 i__pycache__/mock.cpython-311.pycnu[PK!AEE'm__pycache__/suite.cpython-311.opt-1.pycnu[PK!b6ss&__pycache__/util.cpython-311.opt-2.pycnu[PK!}3׶22"g.__pycache__/result.cpython-311.pycnu[PK!mvn@n@"oa__pycache__/runner.cpython-311.pycnu[PK!AEE!/__pycache__/suite.cpython-311.pycnu[PK!~9$Z__pycache__/__main__.cpython-311.pycnu[PK!^>! ! &N__pycache__/util.cpython-311.opt-1.pycnu[PK!k* __pycache__/__main__.cpython-311.opt-2.pycnu[PK!ax55&__pycache__/main.cpython-311.opt-1.pycnu[PK!ON j j(D__pycache__/loader.cpython-311.opt-1.pycnu[PK!88&N__pycache__/_log.cpython-311.opt-2.pycnu[PK!:&__pycache__/case.cpython-311.opt-2.pycnu[PK!HҖ*__pycache__/__init__.cpython-311.opt-1.pycnu[PK!a55)__pycache__/signals.cpython-311.opt-2.pycnu[PK!mvn@n@(6__pycache__/runner.cpython-311.opt-1.pycnu[PK!a55#__pycache__/signals.cpython-311.pycnu[PK!se_6_6&.__pycache__/case.cpython-311.opt-1.pycnu[PK!|EAA'9e__pycache__/suite.cpython-311.opt-2.pycnu[PK!~9*__pycache__/__main__.cpython-311.opt-1.pycnu[PK!ykk"__pycache__/loader.cpython-311.pycnu[PK!ʋBB(__pycache__/runner.cpython-313.opt-1.pycnu[PK!7_&X__pycache__/case.cpython-313.opt-2.pycnu[PK!6A 6 __pycache__/_log.cpython-313.pycnu[PK!22(7J __pycache__/result.cpython-313.opt-1.pycnu[PK!;뇆U>U>!r} __pycache__/suite.cpython-313.pycnu[PK!V& __pycache__/case.cpython-313.opt-1.pycnu[PK!RN+N+(M!__pycache__/result.cpython-313.opt-2.pycnu[PK!bvv&!__pycache__/util.cpython-313.opt-1.pycnu[PK!RaRR&"__pycache__/_log.cpython-313.opt-2.pycnu[PK!4XU~:~:'g)"__pycache__/suite.cpython-313.opt-2.pycnu[PK!ɤo&U>'4"__pycache__/suite.cpython-313.opt-1.pycnu[PK!I/3/3&"__pycache__/main.cpython-313.opt-2.pycnu[PK!E%b6 *e#__pycache__/__init__.cpython-313.opt-1.pycnu[PK!__*#__pycache__/__main__.cpython-313.opt-2.pycnu[PK!)PP S#__pycache__/mock.cpython-313.pycnu[PK! m,%__pycache__/async_case.cpython-313.opt-1.pycnu[PK!ޞS,W,W"O%__pycache__/loader.cpython-313.pycnu[PK!22"p%__pycache__/result.cpython-313.pycnu[PK!ص__)%__pycache__/signals.cpython-313.opt-2.pycnu[PK!NVV,%__pycache__/async_case.cpython-313.opt-2.pycnu[PK!pe&33&l%__pycache__/main.cpython-313.opt-1.pycnu[PK!ص__)%__pycache__/signals.cpython-313.opt-1.pycnu[PK! ,, R &__pycache__/case.cpython-313.pycnu[PK!6A& '__pycache__/_log.cpython-313.opt-1.pycnu[PK!N   4'__pycache__/util.cpython-313.pycnu[PK!*&jP'__pycache__/async_case.cpython-313.pycnu[PK!ȃ!&Oj'__pycache__/mock.cpython-313.opt-1.pycnu[PK!C[Z1V1V(X)__pycache__/loader.cpython-313.opt-1.pycnu[PK!pe&33 .)__pycache__/main.cpython-313.pycnu[PK!vN??(V)__pycache__/runner.cpython-313.opt-2.pycnu[PK!5LL(#*__pycache__/loader.cpython-313.opt-2.pycnu[PK!jߴ*p*__pycache__/__init__.cpython-313.opt-2.pycnu[PK!ص__#v*__pycache__/signals.cpython-313.pycnu[PK!ʋBB"*__pycache__/runner.cpython-313.pycnu[PK!ښ;띡&*__pycache__/mock.cpython-313.opt-2.pycnu[PK?2rj,