O'Reilly logo

Python 3 Web Development Beginner's Guide by Michel Anders

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action writing unit tests for tasklistdb.py

Run test_tasklistdb.py (provided in the code distribution for this chapter). The output should be a list of test results:


python test_tasklistdb.py
......
----------------------------------------------------------------------
Ran 6 tests in 1.312s
OK

What just happened?

Let us look at one of the classes defined in test_tasklistdb.py, DBentityTest. DBentityTest contains a number of methods starting with test_. These are the actual tests and they verify whether some common operations like retrieving or deleting tasks behave as expected.

Chapter4/test_tasklistdb.py

 from tasklistdb import TaskDB, Task, AuthenticationError, DatabaseError import unittest from os import unlink,close from tempfile ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required