Say I have method that just appends a string to an input string..
def request(
url: str,
headers: dict = None
):
default_headers = {
"user-agent": "some user agent"
}
if isinstance(headers, dict):
default_headers.update(headers)
When I run a coverage report for this method, it says that default_headers.update(headers) needs coverage. How do I add coverage for this statement?
''.join([char for char in 'test'])is the same thing as'test'. Also, you're using PEP 484 type hints, so I assume you're usingmypyor some other type checker. That means you needn't be testing the return types of functions, since your type checker is doing that for you already. You should be testing that the values are correct.