Esempio n. 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")
Esempio n. 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")
Esempio n. 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")
Esempio n. 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")
Esempio n. 5
0
 def has_two_args(e):
     assertions.assert_length(e.args, 2)
Esempio n. 6
0
 def has_two_args(e):
     assertions.assert_length(e.args, 2)