Search⌘ K
AI Features

Creating a More Complex Test

Explore how to create more complex tests in Python using the unittest module. Understand how to set up and tear down a test database to isolate tests, and practice writing tests that update and query a simple database within your test cases. This lesson guides you through managing test state to maintain accuracy in automated testing.

Most of the codes are more complex than our my_math.py example. So let’s create a piece of code that depends on a database being in existence. We will create a simple script that can create the database with some initial data if it doesn’t exist along with ...