Writing unit tests with Python unittest

Python 3 provides a really nice and quite a featured library that allows us to write unit tests for our applications. This library, known as unittest, is used for writing unit tests that may range from the complexity of very simple tests to very complex tests involving a proper setup before a unit test is made to run.

Some of the features that we see supported in the Python unittest library are as follows:

  • Object-oriented: The library facilitates the writing of unit tests in an object-oriented manner. What this means is that, the objects are written in an object-oriented form through the use of classes and methods. This in no sense means that only object-oriented code can be tested with the library. ...

Get Hands-On Enterprise Application Development with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.