Python Unit Testing: Testing Python Code Using doctest

Python 3.0+
  • 8 Videos | 46m 16s
  • Includes Assessment
  • Earns a Badge
Likes 19 Likes 19
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 course
    write and execute a test using the doctest module
    recognize where doctests can be placed within source code
    create 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 doctests
    use the ELLIPSIS directive to check if the code raises exceptions for incorrect input values
    recall how to set doctest to ignore whitespace in the output of tests tests
    summarize the key concepts covered in this course

IN THIS COURSE

  • Playable
    1. 
    Course Overview
    2m 15s
    UP NEXT
  • Playable
    2. 
    The doctest Module
    8m 8s
  • Locked
    3. 
    The Placement of doctests
    8m 16s
  • Locked
    4. 
    An Executable Document
    6m 56s
  • Locked
    5. 
    Handle Unpredictable Outputs
    6m 20s
  • Locked
    6. 
    Test for Exceptions
    4m 1s
  • Locked
    7. 
    Handle Whitespace in the Output
    5m 50s
  • Locked
    8. 
    Course Summary
    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 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

Likes 17 Likes 17  
Likes 1602 Likes 1602  
Likes 55 Likes 55