Mocks and Patches
Explore mocking and patching techniques to isolate parts of your code during tests and control their behavior. Understand when and how to use mocks for testing complex systems, especially in machine learning pipelines to handle slow components and manage external dependencies effectively.
We'll cover the following...
Overview
Mocking and patching are techniques used to isolate certain parts of a system under test and control their behavior. They are useful because they allow us to test the behavior of our code under different scenarios and verify that it behaves correctly in those scenarios.
Mocking involves creating a fake or mock version of an object or module used in our system under test. This mock object is designed to mimic the behavior of the real object, but it can be controlled by the test to return specific values or to raise exceptions.
...