Lines Matching +full:hook +full:- +full:run +full:- +full:in +full:- +full:context
28 Raise this exception in a test to skip it.
76 # exc_info -> frame -> exc_info
107 # Swallows all but first exception. If a multi-exception handler
154 return all(_is_subtype(e, basetype) for e in expected)
181 context manager, so check for a 'msg' kwarg and return self.
204 # bpo-23890: manually break a reference cycle
209 """A context manager used to implement TestCase.assertRaises* methods."""
246 """A context manager used to implement TestCase.assertWarns* methods."""
252 # The __warningregistry__'s need to be in a pristine state for tests
254 for v in list(sys.modules.values()):
272 for m in self.warnings:
322 """A context manager used to implement TestCase.assertLogs()."""
368 for mapping in self.maps:
369 for k in mapping:
370 if k not in seen:
378 By default, the test code itself should be placed in a method named
383 subclass, specify in the constructor arguments the name of the test method
394 in order to be run.
401 objects used in assert methods) will be printed on failure in *addition*
403 * maxDiff: sets the maximum length of a diff in failure messages
438 raise ValueError("no such test method in %s: %s" %
446 # instances of said type in more detail to generate a more useful
464 are of the same type in assertEqual().
482 elif 'function' in kwargs:
490 'argument, got %d' % (len(args)-1))
503 "Hook method for setting up the test fixture before exercising it."
507 "Hook method for deconstructing the test fixture after testing it."
512 "Hook method for setting up class fixture before running tests in the class."
516 "Hook method for deconstructing the class fixture after running all tests in the class."
525 """Returns a one-line description of the test, or None if no
565 """Return a context manager that will return the enclosed block
566 of code in a subtest identified by the optional message and
567 keyword parameters. A failure in the subtest marks the test
595 for test, exc_info in errors:
641 def run(self, result=None): member in TestCase
682 for test, reason in outcome.skipped:
702 # outcome.errors -> frame -> outcome -> outcome.errors
703 # outcome.expectedFailure -> frame -> outcome -> outcome.expectedFailure
736 return self.run(*args, **kwds)
739 """Run the test without collecting errors in a TestResult"""
744 function, args, kwargs = self._cleanups.pop(-1)
782 # don't switch to '{}' formatting in Python 2.X
797 context object used like this::
803 is used as a context object.
805 The context manager keeps a reference to the exception as
814 context = _AssertRaisesContext(expected_exception, self)
816 return context.handle('assertRaises', args, kwargs)
818 # bpo-23890: manually break a reference cycle
819 context = None
826 warning filtering rules in effect, it might be silenced, printed
830 context object used like this::
836 is used as a context object.
838 The context manager keeps a reference to the first matching
849 context = _AssertWarnsContext(expected_warning, self)
850 return context.handle('assertWarns', args, kwargs)
857 This method must be used as a context manager, and will yield
859 At the end of the context manager, the `output` attribute will
883 # and vice versa. I opted for the conservative approach in case
884 # subclasses are not intended to be compared in detail to their super
889 # See the discussion in http://bugs.python.org/issue2578.
943 diff = abs(first - second)
982 diff = abs(first - second)
1032 differing = 'First %s has no length. Non-sequence?' % (
1039 differing = 'Second %s has no length. Non-sequence?' % (
1050 for i in range(min(len1, len2)):
1077 'elements.\n' % (seq_type_name, len1 - len2))
1086 'elements.\n' % (seq_type_name, len2 - len1))
1109 """A list-specific equality assertion.
1121 """A tuple-specific equality assertion.
1132 """A set-specific equality assertion.
1163 lines.append('Items in the first set but not the second:')
1164 for item in difference1:
1167 lines.append('Items in the second set but not the first:')
1168 for item in difference2:
1175 """Just like self.assertTrue(a in b), but with a nicer default message."""
1176 if member not in container:
1177 standardMsg = '%s not found in %s' % (safe_repr(member),
1182 """Just like self.assertTrue(a not in b), but with a nicer default message."""
1183 if member in container:
1184 standardMsg = '%s unexpectedly found in %s' % (safe_repr(member),
1219 for key, value in subset.items():
1220 if key not in dictionary:
1232 standardMsg = 'Missing: %s' % ','.join(safe_repr(m) for m in
1250 - [0, 1, 1] and [1, 0, 1] compare equal.
1251 - [0, 0, 1] and [0, 1] compare unequal.
1268 lines = ['First has %d, Second has %d: %r' % diff for diff in differences]
1275 """Assert that two multi-line strings are equal."""
1345 """Asserts that the message in a raised exception matches a regex.
1350 to be found in error message.
1353 msg: Optional message used in case of failure. Can only be used
1354 when assertRaisesRegex is used as a context manager.
1356 context = _AssertRaisesContext(expected_exception, self, expected_regex)
1357 return context.handle('assertRaisesRegex', args, kwargs)
1361 """Asserts that the message in a triggered warning matches a regexp.
1369 to be found in error message.
1372 msg: Optional message used in case of failure. Can only be used
1373 when assertWarnsRegex is used as a context manager.
1375 context = _AssertWarnsContext(expected_warning, self, expected_regex)
1376 return context.handle('assertWarnsRegex', args, kwargs)
1384 standardMsg = "Regex didn't match: %r not found in %r" % (
1396 standardMsg = 'Regex matched: %r matches %r in %r' % (
1430 This is useful for slipping pre-existing test functions into the
1431 unittest framework. Optionally, set-up and tidy-up functions can be
1432 supplied. As with TestCase, the tidy-up ('tearDown') function will
1433 always be called if the set-up ('setUp') function ran successfully.
1495 raise NotImplementedError("subtests cannot be run directly")
1504 for (k, v) in self.params.items())
1512 """Returns a one-line description of the subtest, or None if no