background image

Test for Exception

def test_sqrt_of_negative( self ):

    

"""sqrt of a negative number should throw

       ValueError.

   

 """

    self.

assert????

( math.sqrt(-1) )

What if your code should throw an exception?

Comments:

Unit Testing in Python

navigate_before navigate_next