3 ms·
Can't you do this with expectations of failure, especially if your functions under test aren't total functions? I really like encoding failure types into the t
by jackcviers3 6y ago
Can't you do this with expectations of failure, especially if your functions under test aren't total functions?
I really like encoding failure types into the type signature of my code (assuming types).
defa(x: str) -> Union[str, AnErrorType]:
That way, it is clear that your code may fail, and so you must test the unhappy path as well. Limits the places you might be able to throw and read/write input, and requires an effect type, but keeping functions total allows for fewer bugs and fewer places to test horrible things happening.