Fix context output handling for doctests #2882
If the linenumber of a failing doctest is < 9, the failure/error report is wrong.
Thanks for submitting a PR, your contribution is really appreciated!
Here's a quick checklist that should be present in PRs:
Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please: