background image

Write two 

Failing

 Tests

import unittest
import math

class 

MathTest

(

unittest.TestCase

):

    

# This answer is WRONG. Test should fail.

    def 

test_wrong_sqrt

(self):

        self.assertEqual(1, math.sqrt(25))

    

# sqrt of negative number is not allowed.

    def 

test_sqrt_of_negative

(self):

        self.assertEqual(4, math.sqrt(-16))

Comments:

Unit Testing in Python

navigate_before navigate_next