Lines Matching +full:hook +full:- +full:run +full:- +full:in +full:- +full:context
27 Raise this exception in a test to skip it.
75 # exc_info -> frame -> exc_info
106 # Swallows all but first exception. If a multi-exception handler
153 return all(_is_subtype(e, basetype) for e in expected)
180 context manager, so check for a 'msg' kwarg and return self.
203 # bpo-23890: manually break a reference cycle
208 """A context manager used to implement TestCase.assertRaises* methods."""
247 """A context manager used to implement TestCase.assertWarns* methods."""
253 # The __warningregistry__'s need to be in a pristine state for tests
255 for v in list(sys.modules.values()):
273 for m in self.warnings:
301 for mapping in self.maps:
302 for k in mapping:
303 if k not in seen:
311 By default, the test code itself should be placed in a method named
316 subclass, specify in the constructor arguments the name of the test method
327 in order to be run.
334 objects used in assert methods) will be printed on failure in *addition*
336 * maxDiff: sets the maximum length of a diff in failure messages
371 raise ValueError("no such test method in %s: %s" %
379 # instances of said type in more detail to generate a more useful
397 are of the same type in assertEqual().
419 "Hook method for setting up the test fixture before exercising it."
423 "Hook method for deconstructing the test fixture after testing it."
428 "Hook method for setting up class fixture before running tests in the class."
432 "Hook method for deconstructing the class fixture after running all tests in the class."
441 """Returns a one-line description of the test, or None if no
481 """Return a context manager that will return the enclosed block
482 of code in a subtest identified by the optional message and
483 keyword parameters. A failure in the subtest marks the test
511 for test, exc_info in errors:
557 def run(self, result=None): member in TestCase
597 for test, reason in outcome.skipped:
611 # outcome.errors -> frame -> outcome -> outcome.errors
612 # outcome.expectedFailure -> frame -> outcome -> outcome.expectedFailure
650 return self.run(*args, **kwds)
653 """Run the test without collecting errors in a TestResult"""
704 # don't switch to '{}' formatting in Python 2.X
719 context object used like this::
725 is used as a context object.
727 The context manager keeps a reference to the exception as
736 context = _AssertRaisesContext(expected_exception, self)
738 return context.handle('assertRaises', args, kwargs)
740 # bpo-23890: manually break a reference cycle
741 context = None
748 warning filtering rules in effect, it might be silenced, printed
752 context object used like this::
758 is used as a context object.
760 The context manager keeps a reference to the first matching
771 context = _AssertWarnsContext(expected_warning, self)
772 return context.handle('assertWarns', args, kwargs)
779 This method must be used as a context manager, and will yield
781 At the end of the context manager, the `output` attribute will
802 This method must be used as a context manager.
816 # and vice versa. I opted for the conservative approach in case
817 # subclasses are not intended to be compared in detail to their super
822 # See the discussion in http://bugs.python.org/issue2578.
876 diff = abs(first - second)
915 diff = abs(first - second)
965 differing = 'First %s has no length. Non-sequence?' % (
972 differing = 'Second %s has no length. Non-sequence?' % (
983 for i in range(min(len1, len2)):
1010 'elements.\n' % (seq_type_name, len1 - len2))
1019 'elements.\n' % (seq_type_name, len2 - len1))
1042 """A list-specific equality assertion.
1054 """A tuple-specific equality assertion.
1065 """A set-specific equality assertion.
1096 lines.append('Items in the first set but not the second:')
1097 for item in difference1:
1100 lines.append('Items in the second set but not the first:')
1101 for item in difference2:
1108 """Just like self.assertTrue(a in b), but with a nicer default message."""
1109 if member not in container:
1110 standardMsg = '%s not found in %s' % (safe_repr(member),
1115 """Just like self.assertTrue(a not in b), but with a nicer default message."""
1116 if member in container:
1117 standardMsg = '%s unexpectedly found in %s' % (safe_repr(member),
1153 for key, value in subset.items():
1154 if key not in dictionary:
1166 standardMsg = 'Missing: %s' % ','.join(safe_repr(m) for m in
1184 - [0, 1, 1] and [1, 0, 1] compare equal.
1185 - [0, 0, 1] and [0, 1] compare unequal.
1202 lines = ['First has %d, Second has %d: %r' % diff for diff in differences]
1209 """Assert that two multi-line strings are equal."""
1279 """Asserts that the message in a raised exception matches a regex.
1284 to be found in error message.
1287 msg: Optional message used in case of failure. Can only be used
1288 when assertRaisesRegex is used as a context manager.
1290 context = _AssertRaisesContext(expected_exception, self, expected_regex)
1291 return context.handle('assertRaisesRegex', args, kwargs)
1295 """Asserts that the message in a triggered warning matches a regexp.
1303 to be found in error message.
1306 msg: Optional message used in case of failure. Can only be used
1307 when assertWarnsRegex is used as a context manager.
1309 context = _AssertWarnsContext(expected_warning, self, expected_regex)
1310 return context.handle('assertWarnsRegex', args, kwargs)
1318 standardMsg = "Regex didn't match: %r not found in %r" % (
1330 standardMsg = 'Regex matched: %r matches %r in %r' % (
1364 This is useful for slipping pre-existing test functions into the
1365 unittest framework. Optionally, set-up and tidy-up functions can be
1366 supplied. As with TestCase, the tidy-up ('tearDown') function will
1367 always be called if the set-up ('setUp') function ran successfully.
1429 raise NotImplementedError("subtests cannot be run directly")
1438 for (k, v) in self.params.items())
1446 """Returns a one-line description of the subtest, or None if no