Did I find the right examples for you? yes no

All Samples(12)  |  Call(12)  |  Derive(0)  |  Import(0)
Check that a test fails in a particular way.

If the test fails in the expected way, a KnownFailure is caused. If it
succeeds an UnexpectedSuccess is caused.

The expected use of expectFailure is as a barrier at the point in a
test where the test would fail. For example:
>>> def test_foo(self):
>>>    self.expectFailure("1 should be 0", self.assertNotEqual, 1, 0)
>>>    self.assertEqual(1, 0)(more...)

src/t/e/testtools-0.9.35/testtools/tests/test_testcase.py   testtools(Download)
            def test(self):
                self.addDetail("foo", content)
                self.expectFailure("we are sad", self.assertEqual,
                    1, 0)
        case = Case('test')
            def test(self):
                self.addDetail("foo", content)
                self.expectFailure("we are sad", self.assertEqual,
                    1, 1)
        case = Case('test')

src/t/e/testtools-HEAD/testtools/tests/test_testcase.py   testtools(Download)
            def test(self):
                self.addDetail("foo", content)
                self.expectFailure("we are sad", self.assertEqual,
                    1, 0)
        case = Case('test')
            def test(self):
                self.addDetail("foo", content)
                self.expectFailure("we are sad", self.assertEqual,
                    1, 1)
        case = Case('test')

src/t/e/testtools-0.9.35/testtools/tests/test_testresult.py   testtools(Download)
        def succeeded(self):
            self.expectFailure("yo!", lambda: None)
    return Test("succeeded")
 
 
    def test_control_characters_in_failure_string(self):
        """Control characters in assertions should be escaped"""
        textoutput = self._test_external_case("self.fail('\\a\\a\\a')")
        self.expectFailure("Defense against the beeping horror unimplemented",
            self.assertNotIn, self._as_output("\a\a\a"), textoutput)

src/t/e/testtools-HEAD/testtools/tests/test_testresult.py   testtools(Download)
        def succeeded(self):
            self.expectFailure("yo!", lambda: None)
    return Test("succeeded")
 
 
    def test_control_characters_in_failure_string(self):
        """Control characters in assertions should be escaped"""
        textoutput = self._test_external_case("self.fail('\\a\\a\\a')")
        self.expectFailure("Defense against the beeping horror unimplemented",
            self.assertNotIn, self._as_output("\a\a\a"), textoutput)

src/s/s/sst-0.2.4/src/sst/tests/__init__.py   sst(Download)
        def test_expected_failure(self):
            # We expect the test to fail and it does
            self.expectFailure("1 should be 0", self.assertEqual, 1, 0)
 
        def test_unexpected_success(self):
            # We expect the test to fail but it doesn't
            self.expectFailure("1 is not 1", self.assertEqual, 1, 1)

src/u/c/ucitests-0.1.2/ucitests/fixtures.py   ucitests(Download)
        def test_expected_failure(self):
            # We expect the test to fail and it does
            self.expectFailure("1 should be 0", self.assertEqual, 1, 0)
 
        def test_unexpected_success(self):
            # We expect the test to fail but it doesn't
            self.expectFailure("1 is not 1", self.assertEqual, 1, 1)