background image

Exercise: Run the Tests

Run on the command line:

cmd>

  python -m unittest math_test.py

..EF
===================================================
ERROR: test_sqrt_of_negative (math_test.MathTest)
---------------------------------------------------
Traceback (most recent call last):
  File "test_math.py", line 10, in test_sqrt_negative
    self.assertEqual(4, math.sqrt(-16))

ValueError

: math domain error

===================================================
FAIL: test_wrong_sqrt (test_math.MathTest)
Trackback (most recent call last):

AssertionError

: 1 != 5.0

Comments:

Unit Testing in Python

navigate_before navigate_next