Python Unit Testing: Testing Python Code Using doctest
Python 3.0+
| Intermediate
- 8 Videos | 43m 16s
- Includes Assessment
- Earns a Badge
This 8-video course explores several Python applications for testing, including the unit-test framework, pytest, and doctest. To take this course, you should have prior experience with Python programming, and familiarity with running commands from a Linux shell. This course focuses on doctests, and examines how the doctest module allows the definition of simple python tests within the docstrings in your source code. You will examine what syntax is needed when manually running tests from a Python shell, and how to copy over shells. Next, you will learn to capture the output and use it in your source file, then how to create an executable document for your source. This course demonstrates packaging a readme file, and the tests for a Python module. Learners will examine the bundling of documentation and tests into a single executable file. You will learn how to Ellipsis directive to address unpredictable outputs. Finally, you will learn to instruct your doctests to ignore whitespace characters within the outputs of a test by using the normalized whitespace directive.
WHAT YOU WILL LEARN
-
discover the key concepts covered in this coursewrite and execute a test using the doctest modulerecognize where doctests can be placed within source codecreate a readme file for a Python module which bundles documentation and testing in a single file
-
use the ELLIPSIS directive to account for unpredictable output in doctestsuse the ELLIPSIS directive to check if the code raises exceptions for incorrect input valuesrecall how to set doctest to ignore whitespace in the output of tests testssummarize the key concepts covered in this course
IN THIS COURSE
-
1.Course Overview2m 15sUP NEXT
-
2.The doctest Module8m 8s
-
3.The Placement of doctests8m 16s
-
4.An Executable Document6m 56s
-
5.Handle Unpredictable Outputs6m 20s
-
6.Test for Exceptions4m 1s
-
7.Handle Whitespace in the Output5m 50s
-
8.Course Summary1m 31s
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion of this course, which can be shared on any social network or business platform
Digital badges are yours to keep, forever.YOU MIGHT ALSO LIKE

BOOK
The Pythonic Way