I can't figure out how to avoid this doctest error:
Failed example:
print(test())
Expected:
output
<BLANKLINE>
Got:
output
<BLANKLINE>
For this code
def test():
r'''Produce string according to specification.
>>> print(test())
output
<BLANKLINE>
'''
return '\toutput\n'
I have put a tab literal into the source code, line 5 in front of output
.
It looks like doctest (or python docstrings?) ignores that tab literal and converts it to four spaces.
The so-called "Expected" value is literally not what my source specifies it to be.
What's a solution for this?
I don't want to replace the print statement with
>>> test()
'\toutput\n'
Because a huge part of why I usually like doctests is because they demonstrate examples, and the most important part of this function I am writing is the shape of the output.