title: Multi-line string output in Python doctest
body: <p>I have a Python3 function that returns a multi-line string. I want to test it with doctest, but can't get it to work. I've tried using the <code>+NORMALIZE_WHITESPACE</code> <a href="https://docs.python.org/3/library/doctest.html#directives" rel="noreferrer">directive</a> without success.</p>
  
  <pre><code>def dummy():
      """Dummy test function
  
      &gt;&gt;&gt; dummy()  # doctest: +NORMALIZE_WHITESPACE
      '''Hello Mum
      Hello Dad'''
      """
      return """Hello Mum
      Hello Dad"""
  
  if __name__ == "__main__":
      import doctest
      doctest.testmod()
  </code></pre>
  
  <p>The above code fails with this error:</p>
  
  <pre><code>File "c:/foo.py", line 5, in __main__.dummy
  Failed example:
      dummy()  # doctest: +NORMALIZE_WHITESPACE
  Expected:
      '''Hello Mum
      Hello Dad'''
  Got:
      'Hello Mum\n    Hello Dad'
  </code></pre>
  
  <p>I have tried changing the doctest line to include a literal <code>\n</code> as follows:</p>
  
  <pre><code>&gt;&gt;&gt; dummy()  # doctest: +NORMALIZE_WHITESPACE
  'Hello Mum\n    Hello Dad'
  </code></pre>
  
  <p>But this fails with an almost identical error:</p>
  
  <pre><code>Failed example:
      dummy()  # doctest: +NORMALIZE_WHITESPACE
  Expected:
      'Hello Mum
      Hello Dad'
  Got:
      'Hello Mum\n    Hello Dad'
  </code></pre>
  
  <p>How can I test a multi-line string output with doctest?</p>