Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To make tests robust and detailed we also should check all exceptions which can occur during code execution. To  In order to write assertions about raised exceptions, you can use pytest.raises() as a context manager. For this example, we are going to write a test to check whether the divide() function returns an exception during a dividing number by zero or not. Like in the previous section all tests will be collected in the test_operations.py file and all new functions will be added to the operations.py file. 

...