Test assertions in TestCase.
Method raiseError Undocumented
Method test_formatTypes_single Undocumented
Method test_formatTypes_multiple Undocumented
Method test_assertRaises Undocumented
Method test_assertRaises_exception_w_metaclass Undocumented
Method test_assertRaises_fails_when_no_error_raised Undocumented
Method test_assertRaises_fails_when_different_error_raised Undocumented
Method test_assertRaises_returns_the_raised_exception Undocumented
Method test_assertRaises_with_multiple_exceptions Undocumented
Method test_assertRaises_with_multiple_exceptions_failure_mode Undocumented
Method test_assertRaises_function_repr_in_exception Undocumented
Method assertFails Assert that function raises a failure with the given message.
Method test_assertIn_success Undocumented
Method test_assertIn_failure Undocumented
Method test_assertIn_failure_with_message Undocumented
Method test_assertNotIn_success Undocumented
Method test_assertNotIn_failure Undocumented
Method test_assertNotIn_failure_with_message Undocumented
Method test_assertIsInstance Undocumented
Method test_assertIsInstance_multiple_classes Undocumented
Method test_assertIsInstance_failure Undocumented
Method test_assertIsInstance_failure_multiple_classes Undocumented
Method test_assertIsInstance_overridden_message Undocumented
Method test_assertIs Undocumented
Method test_assertIs_fails Undocumented
Method test_assertIs_fails_with_message Undocumented
Method test_assertIsNot Undocumented
Method test_assertIsNot_fails Undocumented
Method test_assertIsNot_fails_with_message Undocumented
Method test_assertThat_matches_clean Undocumented
Method test_assertThat_mismatch_raises_description Undocumented
Method test_assertThat_output Undocumented
Method test_assertThat_message_is_annotated Undocumented
Method test_assertThat_verbose_output Undocumented
Method test_expectThat_matches_clean Undocumented
Method test_expectThat_mismatch_fails_test Undocumented
Method test_expectThat_does_not_exit_test Undocumented
Method test_expectThat_adds_detail Undocumented
Method test__force_failure_fails_test Undocumented
Method get_error_string Get the string showing how 'e' would be formatted in test output.
Method test_assertThat_verbose_unicode Undocumented
Method test_assertEqual_nice_formatting Undocumented
Method test_assertEqual_formatting_no_message Undocumented
Method test_assertEqual_non_ascii_str_with_newlines Undocumented
Method test_assertIsNone Undocumented
Method test_assertIsNotNone Undocumented
Method test_fail_preserves_traceback_detail Undocumented

Inherited from TestCase:

Instance Variable exception_handlers Exceptions to catch from setUp, runTest and tearDown. This list is able to be modified at any time and consists of (exception_class, handler(case, result, exception_value)) pairs.
Instance Variable force_failure Force testtools.RunTest to fail the test after the test has completed.
Class Variable run_tests_with A factory to make the RunTest to run tests with. Defaults to RunTest. The factory is expected to take a test case and an optional list of exception handlers.
Method __init__ Construct a TestCase.
Method __eq__ Undocumented
Method __repr__ Undocumented
Method addDetail Add a detail to be reported with this test's outcome.
Method getDetails Get the details dict that will be reported with this test's outcome.
Method patch Monkey-patch 'obj.attribute' to 'value' while the test is running.
Method shortDescription Undocumented
Method skipTest Cause this test to be skipped.
Method addCleanup Add a cleanup function to be called after tearDown.
Method addOnException Add a handler to be called when an exception occurs in test code.
Method assertEqual Assert that 'expected' is equal to 'observed'.
Method assertIn Assert that needle is in haystack.
Method assertIsNone Assert that 'observed' is equal to None.
Method assertIsNotNone Assert that 'observed' is not equal to None.
Method assertIs Assert that 'expected' is 'observed'.
Method assertIsNot Assert that 'expected' is not 'observed'.
Method assertNotIn Assert that needle is not in haystack.
Method assertIsInstance Undocumented
Method assertRaises No summary
Method assertThat Assert that matchee is matched by matcher.
Method addDetailUniqueName Add a detail to the test, but ensure it's name is unique.
Method expectThat Check that matchee is matched by matcher, but delay the assertion failure.
Method defaultTestResult Undocumented
Method expectFailure Check that a test fails in a particular way.
Method getUniqueInteger Get an integer unique to this test.
Method getUniqueString Get a string unique to this test.
Method onException Called when an exception propogates from test code.
Method run Undocumented
Method useFixture Use fixture in a test case.
Method setUp Undocumented
Method tearDown Undocumented
Method _formatTypes Format a class or a bunch of classes for display in an error.
Method _add_reason Undocumented
Method _matchHelper Undocumented
Static Method _report_error Undocumented
Static Method _report_expected_failure Undocumented
Static Method _report_failure Undocumented
Static Method _report_skip Undocumented
Method _report_traceback Undocumented
Static Method _report_unexpected_success Undocumented
Method _run_setup Run the setUp function for this test.
Method _run_teardown Run the tearDown function for this test.
Method _get_test_method Undocumented
Method _run_test_method Run the test method for this test.
def raiseError(self, exceptionFactory, *args, **kwargs):
Undocumented
def test_formatTypes_single(self):
Undocumented
def test_formatTypes_multiple(self):
Undocumented
def test_assertRaises(self):
Undocumented
def test_assertRaises_exception_w_metaclass(self):
Undocumented
def test_assertRaises_fails_when_no_error_raised(self):
Undocumented
def test_assertRaises_fails_when_different_error_raised(self):
Undocumented
def test_assertRaises_returns_the_raised_exception(self):
Undocumented
def test_assertRaises_with_multiple_exceptions(self):
Undocumented
def test_assertRaises_with_multiple_exceptions_failure_mode(self):
Undocumented
def test_assertRaises_function_repr_in_exception(self):
Undocumented
def assertFails(self, message, function, *args, **kwargs):
Assert that function raises a failure with the given message.
def test_assertIn_success(self):
Undocumented
def test_assertIn_failure(self):
Undocumented
def test_assertIn_failure_with_message(self):
Undocumented
def test_assertNotIn_success(self):
Undocumented
def test_assertNotIn_failure(self):
Undocumented
def test_assertNotIn_failure_with_message(self):
Undocumented
def test_assertIsInstance(self):
Undocumented
def test_assertIsInstance_multiple_classes(self):
Undocumented
def test_assertIsInstance_failure(self):
Undocumented
def test_assertIsInstance_failure_multiple_classes(self):
Undocumented
def test_assertIsInstance_overridden_message(self):
Undocumented
def test_assertIs(self):
Undocumented
def test_assertIs_fails(self):
Undocumented
def test_assertIs_fails_with_message(self):
Undocumented
def test_assertIsNot(self):
Undocumented
def test_assertIsNot_fails(self):
Undocumented
def test_assertIsNot_fails_with_message(self):
Undocumented
def test_assertThat_matches_clean(self):
Undocumented
def test_assertThat_mismatch_raises_description(self):
Undocumented
def test_assertThat_output(self):
Undocumented
def test_assertThat_message_is_annotated(self):
Undocumented
def test_assertThat_verbose_output(self):
Undocumented
def test_expectThat_matches_clean(self):
Undocumented
def test_expectThat_mismatch_fails_test(self):
Undocumented
def test_expectThat_does_not_exit_test(self):
Undocumented
def test_expectThat_adds_detail(self):
Undocumented
def test__force_failure_fails_test(self):
Undocumented
def get_error_string(self, e):

Get the string showing how 'e' would be formatted in test output.

This is a little bit hacky, since it's designed to give consistent output regardless of Python version.

In testtools, TestResult._exc_info_to_unicode is the point of dispatch between various different implementations of methods that format exceptions, so that's what we have to call. However, that method cares about stack traces and formats the exception class. We don't care about either of these, so we take its output and parse it a little.

def test_assertThat_verbose_unicode(self):
Undocumented
def test_assertEqual_nice_formatting(self):
Undocumented
def test_assertEqual_formatting_no_message(self):
Undocumented
def test_assertEqual_non_ascii_str_with_newlines(self):
Undocumented
def test_assertIsNone(self):
Undocumented
def test_assertIsNotNone(self):
Undocumented
def test_fail_preserves_traceback_detail(self):
Undocumented
API Documentation for testtools, generated by pydoctor at 2015-07-01 16:11:28.