I have data which is processed sequentially, changing from
State A -> State B -> State C
If I had functions
def convertAtoB(obj):...
def convertBtoC(obj):...
How would I write a unit test to test convertBtoC? Since unit tests must be independent from each other, I can't call convertAtoB within the unit test to create the object of state B.
Either create a mock version of B or create a full static version of B and pass it to convertBtoC.
For example:
fetchJSONWeatherOverHTTP(weatherRequest) -> convertJSONWeatherIntoDataclass(jsonWeather)
weatherRequest -> jsonWeather -> weather
In this case we'd need to mockup the jsonWeather object with fake data or use an old result because we would not want to perform an http request in our unit test.
Writing unit tests for functions in a pipeline