Esempio n. 1
0
 def test_fails_when_no_exception_is_raised(self):
     with assert_raises_assertion(
             "Expected code to raise <class 'tests.ExpectedError'>"):
         with expect.raises(ExpectedError):
             pass
Esempio n. 2
0
 def test_allows_unexpected_exception_to_bubble_up(self):
     with assert_raises(ActualError, 'Unexpected exception should bubble up'):
         with expect.raises(ExpectedError):
             raise ActualError('Unexpected exception should bubble up')
Esempio n. 3
0
 def test_passes_for_expected_exception(self):
     with expect.raises(ExpectedError):
         raise ExpectedError