[Solved] Python. Function testing using Nose


In this .py file you should write

import nose.tools as nt

from checkers import is_triangle


def test_is_triangle():
    # Define test_a, test_b, and test_c here such that they should produce a
    # return value of False.
    nt.assert_false(is_triangle(test_a, test_b, test_c))

    # Redefine test_a, test_b, and test_c here such that they should produce a
    # return value of True.
    nt.assert_true(is_triangle(test_a, test_b, test_c))

You should then run this script in one of two ways:

$ nosetests your_file_name.py

or

$ python your_file_name.py  # as your instructor has requested.

The test should fail until you have a properly written is_triangle function. If you find that your initial tests are inadequate — such that the tests pass even though is_triangle is incorrect — add more.

7

solved Python. Function testing using Nose