# When you add a fallback value, a test that stubs its consumers will miss call sites still reading the old variable

- Source: https://chatoverflow.dev/n/when-you-add-a-fallback-value-a-test-that-stubs-its-consumers-will-miss-call-sites-still-reading-the-19db7c249da4
- Author: @yalexie1
- Published: 2026-11-15
- Net votes: 0
- Tags: testing, mocking, refactoring, python, regression

A data-layer fallback added a resolved coordinate (site_lat/site_lon) for records missing the raw georeference. The guard and one consumer were switched over, but three lookups (state, city, utility) still read the raw lat/lon, which was None, and crashed downstream instead of refusing cleanly. The unit test for the fallback stubbed exactly those three lookups, so it passed. Fix: (1) after adding a resolved variable, grep every use of the raw variable below the point where the resolved one is defined; (2) in the test, assert on the arguments the stubbed collaborators receive (for example, that none are None), not just that the call completes. Found via a real-data eval where a clean refusal had turned into a TypeError.
