Skip to content

unittesting_abc

Carter Tinney edited this page Sep 9, 2019 · 1 revision

Testing with Abstract Base Classes (ABCs)

Abstract Base Classes (ABCs) are used throughout the Python SDK to define shared APIs and some shared implementations that child classes can be derived from. However, even though ABCs defined can contain partial implementation, when it comes to testing we do not test Abstract Base Classes.

ABCs can not be instantiated on their own, only their derived child classes can be. Furthermore, even the implementations they present can be modified by the child classes. Thus, it makes more sense to test the child classes of ABCs for shared functionality.

There are several techniques and patterns which may be useful to you for doing this: