Contribute Media
A thank you to everyone who makes this possible: Read More

Demystifying the Patch Function

Description

One of the most challenging and important thing fors for Python developers learn is the unittest mock library. The patch function is in particular confusing- there are many different ways to use it. Should I use a context manager? Decorator? When would I use it manually? Improperly used patch functions can make unit tests useless, all the while making them look as if they are correctly testing code. Let’s learn how to wield patch with confidence!

Details

Improve this page