title: What the Diff? (Python unittest failing (?) due to leading whitespace in multine strings)
body: <p>I am attempting to build the header row of a month in HTML. I have a test case, and when I visually inspect either the comparison or the portion generated by my code, I get an assertion error (eg. my case did not pass). The weird thing is that when I visually inspect, the outputs SEEM to be identical.</p>
  
  <p>I have done some fiddling, and narrowed the scope of the problem. Please see code below.</p>
  
  <p>Here is my testcase:</p>
  
  <pre><code>class xyz(unittest.TestCase):
  
      def test__render_table_header(self):
          self.maxDiff = None
          testy = self.testcal1
          htmltest = testy._render_table_header(date(2014, 8, 1))
          htmlcase = """&lt;table&gt;
              &lt;th colspan='7'&gt;
                  &lt;div class="headercontainer"&gt;
                      &lt;div class="montheader"&gt;{}&lt;/div&gt;
                      &lt;div class="yearheader"&gt;{}&lt;/div&gt;
                  &lt;/div&gt;
              &lt;/th&gt;
              &lt;tr&gt;
                  &lt;td class='dayheader'&gt;Sun&lt;/td&gt;
                  &lt;td class='dayheader'&gt;Mon&lt;/td&gt;
                  &lt;td class='dayheader'&gt;Tues&lt;/td&gt;
                  &lt;td class='dayheader'&gt;Wed&lt;/td&gt;
                  &lt;td class='dayheader'&gt;Thurs&lt;/td&gt;
                  &lt;td class='dayheader'&gt;Fri&lt;/td&gt;
                  &lt;td class='dayheader'&gt;Sat&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;""".format('August', '2014')
          self.assertEqual(htmlcase, htmltest)
  </code></pre>
  
  <p>Here is my function:</p>
  
  <pre><code>def _render_table_header(self, dateobj):
  
      TOP_OF_TABLE = """&lt;table&gt;
          &lt;th colspan='7'&gt;
              &lt;div class="headercontainer"&gt;
                  &lt;div class="montheader"&gt;{}&lt;/div&gt;
                  &lt;div class="yearheader"&gt;{}&lt;/div&gt;
              &lt;/div&gt;
          &lt;/th&gt;
          &lt;tr&gt;
              &lt;td class='dayheader'&gt;Sun&lt;/td&gt;
              &lt;td class='dayheader'&gt;Mon&lt;/td&gt;
              &lt;td class='dayheader'&gt;Tues&lt;/td&gt;
              &lt;td class='dayheader'&gt;Wed&lt;/td&gt;
              &lt;td class='dayheader'&gt;Thurs&lt;/td&gt;
              &lt;td class='dayheader'&gt;Fri&lt;/td&gt;
              &lt;td class='dayheader'&gt;Sat&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;"""
      month = dateobj.strftime('%B')
      year = dateobj.strftime('%Y')
      return TOP_OF_TABLE.format(month, year)
  </code></pre>
  
  <p>Here is the error and diff I get:</p>
  
  <pre><code>FAIL: test__render_table_header 
  
  (__main__.test_enhanced_cal_helper_functions)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "court_app_timeline.py", line 430, in test__render_table_header
      self.assertEqual(htmlcase, htmltest)
  AssertionError: '&lt;table&gt;\n            &lt;th colspan=\'7\'&gt;\n                &lt;div [585 chars]&lt;tr&gt;' != '&lt;table&gt;\n                &lt;th colspan=\'7\'&gt;\n                 [649 chars]&lt;tr&gt;'
    &lt;table&gt;
  -             &lt;th colspan='7'&gt;
  +                 &lt;th colspan='7'&gt;
  ? ++++
  -                 &lt;div class="headercontainer"&gt;
  +                     &lt;div class="headercontainer"&gt;
  ? ++++
  -                     &lt;div class="montheader"&gt;August&lt;/div&gt;
  +                         &lt;div class="montheader"&gt;August&lt;/div&gt;
  ? ++++
  -                     &lt;div class="yearheader"&gt;2014&lt;/div&gt;
  +                         &lt;div class="yearheader"&gt;2014&lt;/div&gt;
  ? ++++
  -                 &lt;/div&gt;
  +                     &lt;/div&gt;
  ? ++++
  -             &lt;/th&gt;
  +                 &lt;/th&gt;
  ? ++++
  -             &lt;tr&gt;
  +                 &lt;tr&gt;
  ? ++++
  -                 &lt;td class='dayheader'&gt;Sun&lt;/td&gt;
  +                     &lt;td class='dayheader'&gt;Sun&lt;/td&gt;
  ? ++++
  -                 &lt;td class='dayheader'&gt;Mon&lt;/td&gt;
  +                     &lt;td class='dayheader'&gt;Mon&lt;/td&gt;
  ? ++++
  -                 &lt;td class='dayheader'&gt;Tues&lt;/td&gt;
  +                     &lt;td class='dayheader'&gt;Tues&lt;/td&gt;
  ? ++++
  -                 &lt;td class='dayheader'&gt;Wed&lt;/td&gt;
  +                     &lt;td class='dayheader'&gt;Wed&lt;/td&gt;
  ? ++++
  -                 &lt;td class='dayheader'&gt;Thurs&lt;/td&gt;
  +                     &lt;td class='dayheader'&gt;Thurs&lt;/td&gt;
  ? ++++
  -                 &lt;td class='dayheader'&gt;Fri&lt;/td&gt;
  +                     &lt;td class='dayheader'&gt;Fri&lt;/td&gt;
  ? ++++
  -                 &lt;td class='dayheader'&gt;Sat&lt;/td&gt;
  +                     &lt;td class='dayheader'&gt;Sat&lt;/td&gt;
  ? ++++
  -             &lt;/tr&gt;
  +                 &lt;/tr&gt;
  ? ++++
  -             &lt;tr&gt;+                 &lt;tr&gt;? ++++
  
  
  ----------------------------------------------------------------------
  </code></pre>
  
  <p>I will admit to you fine folks that I'm not the most talented programmer. In fact, my entire programming career hearkens back to only about 5 months ago. Along with that comes a certain ineptitude at reading diffs. It seems to me that the major difference between the outputs has to do with leading whitespace. How can I fix this?</p>
  
  <p>PS - any tips, comments, pointers, etc. are much appreciated.</p>