Open kirisakow opened 1 year ago
Thank you for the report! I also found this in the printed version of the book, but the example code doesn't have the same error:
https://github.com/bslatkin/effectivepython/blob/4ae6f3141291ea137eb29a245bf889dbc8091713/example_code/item_78.py#L150 https://github.com/bslatkin/effectivepython/blob/4ae6f3141291ea137eb29a245bf889dbc8091713/example_code/item_78.py#L264
Will resolve it.
Ah -- because it was fixed in #73
(2nd ed)
The code block in the middle of the page is about
unittest.mock.patch
and yet, instead of callingfeed_animal(database, name, now)
, it callsfeed_func(database, name, now)
(a leftover of the precedent approach of using keyword-only arguments for injecting mocks).Wrong code:
Correct code: