title: Doctest: What is the best way to identify differences between expected and actual output?
body: <p>Can someone help me understand how I can identify differences between the actual and expected output when performing a doctest?  In the below, the expected and actual output looks identical eye.</p>
  <p>I'm pretty sure there is some white space error since when I add <code>optionflags= doctest.NORMALIZE_WHITESPACE</code> in the doctest, the test is successful.  Is there another flag that can help a user triangulate on the location of such a whitespace error?</p>
  <pre><code>import datetime
  import numpy as np
  import pandas as pd
  import yfinance as yf
  
  def id_maribozu(df, tol = 0.0025):
      '''
      &gt;&gt;&gt; df = yf.download('aapl', start = '2021-05-17', end = '2021-06-09', progress=False)
      &gt;&gt;&gt; id_maribozu(df)
                    Open    High     Low   Close  Adj Close    Volume  mbzu  mbzu_stop
      Date
      2021-05-17  126.82  126.93  125.17  126.27     125.90  74244600     0       0.00
      2021-05-18  126.56  126.99  124.78  124.85     124.48  63342900     0       0.00
      2021-05-19  123.16  124.92  122.86  124.69     124.32  92612000     1     122.86
      2021-05-20  125.23  127.72  125.10  127.31     126.93  76857100     0       0.00
      2021-05-21  127.82  128.00  125.21  125.43     125.06  79295400    -1     128.00
      2021-05-24  126.01  127.94  125.94  127.10     126.72  63092900     0       0.00
      2021-05-25  127.82  128.32  126.32  126.90     126.53  72009500     0       0.00
      2021-05-26  126.96  127.39  126.42  126.85     126.48  56575900     0       0.00
      2021-05-27  126.44  127.64  125.08  125.28     124.91  94625600     0       0.00
      2021-05-28  125.57  125.80  124.55  124.61     124.24  71311100    -1     125.80
      2021-06-01  125.08  125.35  123.94  124.28     123.91  67637100     0       0.00
      2021-06-02  124.28  125.24  124.05  125.06     124.69  59278900     1     124.05
      2021-06-03  124.68  124.85  123.13  123.54     123.18  76229200     0       0.00
      2021-06-04  124.07  126.16  123.85  125.89     125.52  75169300     1     123.85
      2021-06-07  126.17  126.32  124.83  125.90     125.53  71057600     0       0.00
      2021-06-08  126.60  128.46  126.21  126.74     126.37  74403800     0       0.00
      '''
      bull_mbzu = (abs(df['Close'] / df['High'] - 1) &lt; 0.0025) &amp; (abs(df['Open'] / df['Low'] - 1) &lt; tol)
      bear_mbzu = (abs(df['Open'] / df['High'] - 1) &lt; 0.0025) &amp; (abs(df['Close'] / df['Low'] - 1) &lt; tol)
      df['mbzu'] = np.where(bull_mbzu, 1, np.where(bear_mbzu, -1, 0))
      df.loc[:,'mbzu_stop'] = np.where(bull_mbzu, df['Low'], np.where(bear_mbzu, df['High'], 0))
      print(df.round(2))
  
  if __name__ == &quot;__main__&quot;:
      import doctest
      doctest.testmod()
  </code></pre>
  <pre><code>&gt;&gt;&gt; %run id_maribozu.py
  **********************************************************************
  File &quot;/Volumes/Data/TechnicalAnalysis/Candlesticks/Maribozu/id_maribozu.py&quot;, line 10, in __main__.id_maribozu
  Failed example:
      id_maribozu(df)
  Expected:
                    Open    High     Low   Close  Adj Close    Volume  mbzu  mbzu_stop
      Date
      2021-05-17  126.82  126.93  125.17  126.27     125.90  74244600     0       0.00
      2021-05-18  126.56  126.99  124.78  124.85     124.48  63342900     0       0.00
      2021-05-19  123.16  124.92  122.86  124.69     124.32  92612000     1     122.86
      2021-05-20  125.23  127.72  125.10  127.31     126.93  76857100     0       0.00
      2021-05-21  127.82  128.00  125.21  125.43     125.06  79295400    -1     128.00
      2021-05-24  126.01  127.94  125.94  127.10     126.72  63092900     0       0.00
      2021-05-25  127.82  128.32  126.32  126.90     126.53  72009500     0       0.00
      2021-05-26  126.96  127.39  126.42  126.85     126.48  56575900     0       0.00
      2021-05-27  126.44  127.64  125.08  125.28     124.91  94625600     0       0.00
      2021-05-28  125.57  125.80  124.55  124.61     124.24  71311100    -1     125.80
      2021-06-01  125.08  125.35  123.94  124.28     123.91  67637100     0       0.00
      2021-06-02  124.28  125.24  124.05  125.06     124.69  59278900     1     124.05
      2021-06-03  124.68  124.85  123.13  123.54     123.18  76229200     0       0.00
      2021-06-04  124.07  126.16  123.85  125.89     125.52  75169300     1     123.85
      2021-06-07  126.17  126.32  124.83  125.90     125.53  71057600     0       0.00
      2021-06-08  126.60  128.46  126.21  126.74     126.37  74403800     0       0.00
  Got:
                    Open    High     Low   Close  Adj Close    Volume  mbzu  mbzu_stop
      Date
      2021-05-17  126.82  126.93  125.17  126.27     125.90  74244600     0       0.00
      2021-05-18  126.56  126.99  124.78  124.85     124.48  63342900     0       0.00
      2021-05-19  123.16  124.92  122.86  124.69     124.32  92612000     1     122.86
      2021-05-20  125.23  127.72  125.10  127.31     126.93  76857100     0       0.00
      2021-05-21  127.82  128.00  125.21  125.43     125.06  79295400    -1     128.00
      2021-05-24  126.01  127.94  125.94  127.10     126.72  63092900     0       0.00
      2021-05-25  127.82  128.32  126.32  126.90     126.53  72009500     0       0.00
      2021-05-26  126.96  127.39  126.42  126.85     126.48  56575900     0       0.00
      2021-05-27  126.44  127.64  125.08  125.28     124.91  94625600     0       0.00
      2021-05-28  125.57  125.80  124.55  124.61     124.24  71311100    -1     125.80
      2021-06-01  125.08  125.35  123.94  124.28     123.91  67637100     0       0.00
      2021-06-02  124.28  125.24  124.05  125.06     124.69  59278900     1     124.05
      2021-06-03  124.68  124.85  123.13  123.54     123.18  76229200     0       0.00
      2021-06-04  124.07  126.16  123.85  125.89     125.52  75169300     1     123.85
      2021-06-07  126.17  126.32  124.83  125.90     125.53  71057600     0       0.00
      2021-06-08  126.60  128.46  126.21  126.74     126.37  74403800     0       0.00
  **********************************************************************
  1 items had failures:
     1 of   2 in __main__.id_maribozu
  ***Test Failed*** 1 failures.
  </code></pre>