Python Unit Testing: Testing Python Code Using doctest
Python
| 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
-
2m 15s
-
8m 8sLearn how to write and execute a test using the doctest module. FREE ACCESS
-
8m 16sAfter completing this video, you will be able to recognize where doctests can be placed within source code. FREE ACCESS
-
6m 56sIn this video, learn how to create a readme file for a Python module which bundles documentation and testing in a single file. FREE ACCESS
-
6m 20sIn this video, learn how to use the ELLIPSIS directive to account for unpredictable output in doctests. FREE ACCESS
-
4m 1sDuring this video, you will learn how to use the ELLIPSIS directive to check if the code raises exceptions for incorrect input values. FREE ACCESS
-
5m 50sUpon completion of this video, you will be able to recall how to set doctest to ignore whitespace in the output of tests. FREE ACCESS
-
1m 31s
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.
Digital badges are yours to keep, forever.