def test_html_report_delta():
    from pycobertura.reporters import HtmlReporterDelta
    cobertura1 = make_cobertura('tests/dummy.source1/coverage.xml')
    cobertura2 = make_cobertura('tests/dummy.source2/coverage.xml')
    report_delta = HtmlReporterDelta(cobertura1, cobertura2)
    html_output = report_delta.generate()
    assert ('.red {color: red}' in html_output)
    assert ('.green {color: green}' in html_output)
    assert ('normalize.css' in html_output)
    assert ('Skeleton V2.0' in html_output)
    assert (remove_style_tag(html_output) == u'<html>\n  <head>\n    <title>pycobertura report</title>\n    <meta charset="UTF-8">\n  </head>\n  <body>\n    <div class="container">\n      <table class="u-full-width">\n        <thead>\n          <tr>\n            <th>Filename</th>\n            <th>Stmts</th>\n            <th>Miss</th>\n            <th>Cover</th>\n            <th>Missing</th>\n          </tr>\n        </thead>\n        <tbody>\n          <tr>\n            <td><a href="#dummy/dummy.py">dummy/dummy.py</a></td>\n            <td>-</td>\n            <td><span class="green">-2</span></td>\n            <td>+40.00%</td>\n            <td><span class="green">-5</span>, <span class="green">-6</span>\n            </td>\n          </tr>\n          <tr>\n            <td><a href="#dummy/dummy2.py">dummy/dummy2.py</a></td>\n            <td>+2</td>\n            <td><span class="red">+1</span></td>\n            <td>-25.00%</td>\n            <td><span class="green">-2</span>, <span class="green">-4</span>, <span class="red">+5</span>\n            </td>\n          </tr>\n          <tr>\n            <td><a href="#dummy/dummy3.py">dummy/dummy3.py</a></td>\n            <td>+2</td>\n            <td><span class="red">+2</span></td>\n            <td>-</td>\n            <td><span class="red">+1</span>, <span class="red">+2</span>\n            </td>\n          </tr>\n        </tbody>\n        <tfoot>\n          <tr>\n            <td>TOTAL</td>\n            <td>+4</td>\n            <td><span class="red">+1</span></td>\n            <td>+31.06%</td>\n            <td></td>\n          </tr>\n        </tfoot>\n      </table><div class="legend">\n  <dl>\n    <dt><code>code</code></dt><dd>coverage unchanged</dd>\n    <dt class="hit"><code>code</code></dt><dd>coverage increased</dd>\n    <dt class="miss"><code>code</code></dt><dd>coverage decreased</dd>\n    <dt><code>+</code></dt><dd>line added or modified</dd>\n  </dl>\n</div>\n<h4 id="dummy/dummy.py">dummy/dummy.py</h4>\n<table class="code u-max-full-width">\n  <tbody>\n    <tr>\n      <td class="lineno">\n        <pre>2 &nbsp;\n3 &nbsp;\n4 &nbsp;\n5 &nbsp;\n6 +\n</pre>\n      </td>\n      <td class="source">\n        <pre><span class="noop">    pass\n</span><span class="noop">\n</span><span class="noop">def bar():\n</span><span class="hit">    a = &#39;a&#39;\n</span><span class="hit">    d = &#39;d&#39;\n</span></pre>\n      </td>\n    </tr>\n  </tbody>\n</table>\n<h4 id="dummy/dummy2.py">dummy/dummy2.py</h4>\n<table class="code u-max-full-width">\n  <tbody>\n    <tr>\n      <td class="lineno">\n        <pre>1 &nbsp;\n2 +\n3 &nbsp;\n4 +\n5 &nbsp;\n</pre>\n      </td>\n      <td class="source">\n        <pre><span class="noop">def baz():\n</span><span class="hit">    c = &#39;c&#39;\n</span><span class="noop">\n</span><span class="hit">def bat():\n</span><span class="miss">    pass\n</span></pre>\n      </td>\n    </tr>\n  </tbody>\n</table>\n<h4 id="dummy/dummy3.py">dummy/dummy3.py</h4>\n<table class="code u-max-full-width">\n  <tbody>\n    <tr>\n      <td class="lineno">\n        <pre>1 +\n2 +\n</pre>\n      </td>\n      <td class="source">\n        <pre><span class="miss">def foobar():\n</span><span class="miss">    pass  # This is a very long comment that was purposefully written so we could test how HTML rendering looks like when the boundaries of the page are reached. And here is a non-ascii char: Ş\n</span></pre>\n      </td>\n    </tr>\n  </tbody>\n</table>\n    </div>\n  </body>\n</html>')
def test_html_report_delta():
    from pycobertura.reporters import HtmlReporterDelta
    cobertura1 = make_cobertura('tests/dummy.source1/coverage.xml')
    cobertura2 = make_cobertura('tests/dummy.source2/coverage.xml')
    report_delta = HtmlReporterDelta(cobertura1, cobertura2)
    html_output = report_delta.generate()
    assert ('.red {color: red}' in html_output)
    assert ('.green {color: green}' in html_output)
    assert ('normalize.css' in html_output)
    assert ('Skeleton V2.0' in html_output)
    assert (remove_style_tag(html_output) == u'<html>\n  <head>\n    <title>pycobertura report</title>\n    <meta charset="UTF-8">\n  </head>\n  <body>\n    <div class="container">\n      <table class="u-full-width">\n        <thead>\n          <tr>\n            <th>Filename</th>\n            <th>Stmts</th>\n            <th>Miss</th>\n            <th>Cover</th>\n            <th>Missing</th>\n          </tr>\n        </thead>\n        <tbody>\n          <tr>\n            <td><a href="#dummy/dummy.py">dummy/dummy.py</a></td>\n            <td>-</td>\n            <td><span class="green">-2</span></td>\n            <td>+40.00%</td>\n            <td><span class="green">-5</span>, <span class="green">-6</span>\n            </td>\n          </tr>\n          <tr>\n            <td><a href="#dummy/dummy2.py">dummy/dummy2.py</a></td>\n            <td>+2</td>\n            <td><span class="red">+1</span></td>\n            <td>-25.00%</td>\n            <td><span class="green">-2</span>, <span class="green">-4</span>, <span class="red">+5</span>\n            </td>\n          </tr>\n          <tr>\n            <td><a href="#dummy/dummy3.py">dummy/dummy3.py</a></td>\n            <td>+2</td>\n            <td><span class="red">+2</span></td>\n            <td>-</td>\n            <td><span class="red">+1</span>, <span class="red">+2</span>\n            </td>\n          </tr>\n        </tbody>\n        <tfoot>\n          <tr>\n            <td>TOTAL</td>\n            <td>+4</td>\n            <td><span class="red">+1</span></td>\n            <td>+31.06%</td>\n            <td></td>\n          </tr>\n        </tfoot>\n      </table><div class="legend">\n  <dl>\n    <dt><code>code</code></dt><dd>coverage unchanged</dd>\n    <dt class="hit"><code>code</code></dt><dd>coverage increased</dd>\n    <dt class="miss"><code>code</code></dt><dd>coverage decreased</dd>\n    <dt><code>+</code></dt><dd>line added or modified</dd>\n  </dl>\n</div>\n<h4 id="dummy/dummy.py">dummy/dummy.py</h4>\n<table class="code u-max-full-width">\n  <tbody>\n    <tr>\n      <td class="lineno">\n        <pre>2 &nbsp;\n3 &nbsp;\n4 &nbsp;\n5 &nbsp;\n6 +\n</pre>\n      </td>\n      <td class="source">\n        <pre><span class="noop">    pass\n</span><span class="noop">\n</span><span class="noop">def bar():\n</span><span class="hit">    a = &#39;a&#39;\n</span><span class="hit">    d = &#39;d&#39;\n</span></pre>\n      </td>\n    </tr>\n  </tbody>\n</table>\n<h4 id="dummy/dummy2.py">dummy/dummy2.py</h4>\n<table class="code u-max-full-width">\n  <tbody>\n    <tr>\n      <td class="lineno">\n        <pre>1 &nbsp;\n2 +\n3 &nbsp;\n4 +\n5 &nbsp;\n</pre>\n      </td>\n      <td class="source">\n        <pre><span class="noop">def baz():\n</span><span class="hit">    c = &#39;c&#39;\n</span><span class="noop">\n</span><span class="hit">def bat():\n</span><span class="miss">    pass\n</span></pre>\n      </td>\n    </tr>\n  </tbody>\n</table>\n<h4 id="dummy/dummy3.py">dummy/dummy3.py</h4>\n<table class="code u-max-full-width">\n  <tbody>\n    <tr>\n      <td class="lineno">\n        <pre>1 +\n2 +\n</pre>\n      </td>\n      <td class="source">\n        <pre><span class="miss">def foobar():\n</span><span class="miss">    pass  # This is a very long comment that was purposefully written so we could test how HTML rendering looks like when the boundaries of the page are reached. And here is a non-ascii char: Ş\n</span></pre>\n      </td>\n    </tr>\n  </tbody>\n</table>\n    </div>\n  </body>\n</html>')