DocTestParser.parse() is returning the second part of the block indented. DocTestParser() knows that >>> starts a block and that ... is subordinate and thus indented. However, changing the example doctest to ">>> finally:' causes the test to fail.
This leads me to wonder if the finally is really running in the examples in the problematic doctest. In the cases I see in the test, we could use the 'with' statement instead, or rewrite the code as a function that will be treated in a manner we expect.
I know how to hack the checker to compile the 'finally:' line, but I think it is better for us to not second guess the parser(). The doctest is bad and we should rewrite.
DocTestParser. parse() is returning the second part of the block indented. DocTestParser() knows that >>> starts a block and that ... is subordinate and thus indented. However, changing the example doctest to ">>> finally:' causes the test to fail.
This leads me to wonder if the finally is really running in the examples in the problematic doctest. In the cases I see in the test, we could use the 'with' statement instead, or rewrite the code as a function that will be treated in a manner we expect.
I know how to hack the checker to compile the 'finally:' line, but I think it is better for us to not second guess the parser(). The doctest is bad and we should rewrite.