Chapter Review Questions#
What naming convention must a test file follow for pytest to discover it automatically?
What naming convention must a test function follow?
What happens when an
assertstatement fails inside a test function?Write a test function that verifies
abs(-5) == 5.pytest.raises.What does
pytest.raises(ValueError)do?When would you use it?
What is the difference between a unit test and an integration test?
Give three examples of edge cases you should always consider when writing tests for a numeric function.
Why is it generally better to have one assertion per test function rather than many?
How do you run only the tests in a file called
test_strings.pyfrom the command line?