Python doctests are cool. Let me start with a simple example:
def foo(): \"\"\" >>> foo() hello world \"\"\" print \"hello world\"
I ended up with this workaround.
def foo(): """ >>> foo() # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS ... world """ print("hello world")
It at least works without non-whitespace characters or other workarounds.