April 2019
Intermediate to advanced
646 pages
16h 48m
English
Writing unit tests presupposes that you isolate the unit of code that is being tested. Tests usually feed the function or method with some data and verify its return value and/or the side effects of its execution. This is mainly to make sure the tests include the following:
Sometimes, the proper isolation of the program component is not obvious. For instance, if the code sends emails, it will probably call Python's smtplib module, which will work with the SMTP server through a network connection. If we want our tests to be reproducible and are just testing if emails ...