The mock tests in PaaS I/O in Python on Exercism are returning non-None
values from __exit__
of IO classes . However, based on the type hints defined in the Python standard library, such non-None values are considered “impossible”. More info on the reasoning can be found at The return type hint of __exit__ should be Optional[bool] instead of None · Issue #103573 · python/cpython · GitHub
In short, the __exit__
method should never return any value other than None
in the mock tests (which are currently returning None
, True
and False
under different conditions). Currently these tests violate what the IO classes are supposed to return per the defined type hints in the Python library.
Personally I found the tests very confusing, so I thought I’d report this in case someone else ran into the same pains
(The corresponding Discord thread.)