going to use the library's API, not the library's internals process _order validate _order one, clean, simple point of entrance, that returns one thing clean API
what my code WILL do avoid writing your library until you are done defining HOW it will be used NO weird implementation quirks usually no more than 5 lines of code :) i n t e r f a c e i n t e r n a l s
of a dependency usually doesn’t require a framework store data for later retrieval (cache, databases) no validation of the way the fake is used no validation of the way the fake is used
dependency is used by the class a mock function call returns a predefined value immediately a mock object's attributes and methods are defined entirely in the test, without creating the real object
function to fire your alarm DON’T CARE experiencing an alarm everytime a test runs ( what if we were testing a rocket launch ) CARE slow code is out of your tests : network calls and file systems DON’T CARE functionally testing 3rd party libraries used in your code.
mock.Mock and mock.MagicMock accept all method calls and property assignments regardless of the underlying API tests will still pass even if the implementation changed
to maintain fixtures with easy-to-use factories for complex objects use objects customized for the current test declare only the fields especially when working with models
and mark tests as expected to fail ) continue through a test function after failure mark a test as expected minimum boilerplate code easy to parse reporting