예제 #1
0
 def test_fails_when_exception_test_fails(self):
     """Tests that when an exception of the right type that fails the
     passed in exception test is raised, the assertion fails."""
     has_two_args = lambda e: assertions.assert_length(e.args, 2)
     with assertions.assert_raises(AssertionError):
         with assertions.assert_raises_such_that(Exception, has_two_args):
             raise Exception("only one argument")
예제 #2
0
 def test_fails_when_exception_test_fails(self):
     """Tests that when an exception of the right type that fails the
     passed in exception test is raised, the assertion fails."""
     has_two_args = lambda e: assertions.assert_length(e.args, 2)
     with assertions.assert_raises(AssertionError):
         with assertions.assert_raises_such_that(Exception, has_two_args):
             raise Exception("only one argument")
예제 #3
0
 def test_passes_when_correct_exception_is_raised(self):
     """Tests that when an exception of the right type that passes the
     exception test is raised, the assertion passes."""
     has_two_args = lambda e: assertions.assert_length(e.args, 2)
     with assertions.assert_raises_such_that(Exception, has_two_args):
         raise Exception("first", "second")
예제 #4
0
 def test_passes_when_correct_exception_is_raised(self):
     """Tests that when an exception of the right type that passes the
     exception test is raised, the assertion passes."""
     has_two_args = lambda e: assertions.assert_length(e.args, 2)
     with assertions.assert_raises_such_that(Exception, has_two_args):
         raise Exception("first", "second")
예제 #5
0
 def has_two_args(e):
     assertions.assert_length(e.args, 2)
예제 #6
0
 def has_two_args(e):
     assertions.assert_length(e.args, 2)