Mocking __init__ methods in Python
Patching a class's __init__ method is a common and powerful technique for unit testing code that relies on objects whose initialization performs unwanted side effects. These side effects can include making API calls, connecting to a database, or performing other time-consuming or stateful operations [1]. By mocking __init__, you can prevent these actions and verify that the class was instantiated correctly.
