Esempio n. 1
0
 def test_raises_warnings_as_exceptions(self):
     warnings = WarningRaiser()
     
     try:
         warnings.example_warning(who="carol", bananas=10)
     except UserWarning as e:
         assert_that(str(e), contains_string("example warning (bananas: 10, who: 'carol')"))
Esempio n. 2
0
 def test_can_specify_the_type_of_exception_raised(self):
     class ExampleException(Exception):
         pass
     
     warnings = WarningRaiser(ExampleException)
     
     try:
         warnings.point_blank()
     except ExampleException as e:
         assert_that(str(e), contains_string("point blank"))