List Comprehensions
Learn how to maximize coverage of a test file using list comprehensions.
Setting module attributes in test files
Now that our first test uses a fixture, we’ll add tests focusing on specific values in the weather API response. Since the module under test (SoggyWaffle.WeatherAPI.ResponseParser
) is focused on translating data specific to an external API into internal data, the module must have a lot of knowledge specific to that API. This shows up in the form of all the various weather condition IDs at the top of the module.
Our tests will have to have that same level of knowledge so that they can test the code thoroughly. This means adding a copy of all of the IDs to our test file. ...