Tool: Pyflakes Processed Files: kgb/tests.py kgb/spies.py Tool: PEP8 Style Checker Processed Files: kgb/tests.py kgb/spies.py
Fix spying on functions belonging to falsy objects.
Review Request #7778 — Created Nov. 23, 2015 and submitted
When spying on a function that belonged to an object that evaluated the false, the spy would be created on the class and not the instance. This would end up polluting any future spies, as the spy would stick around on the class long-term but be bound to the state of the original instance. This happened because we checked if a value was truthy/falsy, when what we wanted was to check whether it was None. The check is now more specific, fixing this case.
Unit tests pass.
My original case where I hit this now succeeds.