summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-11-11 07:51:23 -0500
committerNed Batchelder <ned@nedbatchelder.com>2018-11-11 16:45:33 -0500
commitc86186ac5b305f7d72b0bd8976c0f217e604d882 (patch)
tree0e4bd0e549f76bc218a027ebf55ddbb46d4b00fc
parent5dd9b8027d2f2edc46de157ffd00a93e6297a235 (diff)
downloadpython-coveragepy-git-c86186ac5b305f7d72b0bd8976c0f217e604d882.tar.gz
Update an HTML gold test due to new peephole optimizations
-rw-r--r--tests/farm/html/gold_partial/index.html22
-rw-r--r--tests/farm/html/gold_partial/partial_py.html48
-rw-r--r--tests/test_html.py14
3 files changed, 37 insertions, 47 deletions
diff --git a/tests/farm/html/gold_partial/index.html b/tests/farm/html/gold_partial/index.html
index 1948615c..6ac43531 100644
--- a/tests/farm/html/gold_partial/index.html
+++ b/tests/farm/html/gold_partial/index.html
@@ -17,7 +17,7 @@
<div id="header">
<div class="content">
<h1>Coverage report:
- <span class="pc_cov">100%</span>
+ <span class="pc_cov">91%</span>
</h1>
<img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" />
<form id="filter_container">
@@ -56,23 +56,23 @@
<tfoot>
<tr class="total">
<td class="name left">Total</td>
- <td>9</td>
+ <td>7</td>
<td>0</td>
<td>1</td>
- <td>2</td>
- <td>0</td>
- <td class="right" data-ratio="11 11">100%</td>
+ <td>4</td>
+ <td>1</td>
+ <td class="right" data-ratio="10 11">91%</td>
</tr>
</tfoot>
<tbody>
<tr class="file">
<td class="name left"><a href="partial_py.html">partial.py</a></td>
- <td>9</td>
+ <td>7</td>
<td>0</td>
<td>1</td>
- <td>2</td>
- <td>0</td>
- <td class="right" data-ratio="11 11">100%</td>
+ <td>4</td>
+ <td>1</td>
+ <td class="right" data-ratio="10 11">91%</td>
</tr>
</tbody>
</table>
@@ -83,8 +83,8 @@
<div id="footer">
<div class="content">
<p>
- <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a2">coverage.py v5.0a2</a>,
- created at 2018-08-22 20:12
+ <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a4">coverage.py v5.0a4</a>,
+ created at 2018-11-11 07:38
</p>
</div>
</div>
diff --git a/tests/farm/html/gold_partial/partial_py.html b/tests/farm/html/gold_partial/partial_py.html
index 44238f68..96d02f2f 100644
--- a/tests/farm/html/gold_partial/partial_py.html
+++ b/tests/farm/html/gold_partial/partial_py.html
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
- <title>Coverage for partial.py: 100%</title>
+ <title>Coverage for partial.py: 91%</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.hotkeys.js"></script>
@@ -17,15 +17,15 @@
<div id="header">
<div class="content">
<h1>Coverage for <b>partial.py</b> :
- <span class="pc_cov">100%</span>
+ <span class="pc_cov">91%</span>
</h1>
<img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" />
<h2 class="stats">
- 9 statements &nbsp;
- <span class="run hide_run shortkey_r button_toggle_run">9 run</span>
+ 7 statements &nbsp;
+ <span class="run hide_run shortkey_r button_toggle_run">7 run</span>
<span class="mis shortkey_m button_toggle_mis">0 missing</span>
<span class="exc shortkey_x button_toggle_exc">1 excluded</span>
- <span class="par run hide_run shortkey_p button_toggle_par">0 partial</span>
+ <span class="par run hide_run shortkey_p button_toggle_par">1 partial</span>
</h2>
</div>
</div>
@@ -58,45 +58,39 @@
<p id="n1" class="pln"><a href="#n1">1</a></p>
<p id="n2" class="stm run hide_run"><a href="#n2">2</a></p>
<p id="n3" class="pln"><a href="#n3">3</a></p>
-<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p>
+<p id="n4" class="stm par run hide_run"><a href="#n4">4</a></p>
<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p>
<p id="n6" class="pln"><a href="#n6">6</a></p>
<p id="n7" class="stm run hide_run"><a href="#n7">7</a></p>
<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p>
<p id="n9" class="pln"><a href="#n9">9</a></p>
-<p id="n10" class="stm run hide_run"><a href="#n10">10</a></p>
-<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p>
+<p id="n10" class="pln"><a href="#n10">10</a></p>
+<p id="n11" class="pln"><a href="#n11">11</a></p>
<p id="n12" class="pln"><a href="#n12">12</a></p>
<p id="n13" class="pln"><a href="#n13">13</a></p>
-<p id="n14" class="pln"><a href="#n14">14</a></p>
+<p id="n14" class="stm run hide_run"><a href="#n14">14</a></p>
<p id="n15" class="pln"><a href="#n15">15</a></p>
-<p id="n16" class="pln"><a href="#n16">16</a></p>
-<p id="n17" class="stm run hide_run"><a href="#n17">17</a></p>
-<p id="n18" class="pln"><a href="#n18">18</a></p>
-<p id="n19" class="stm run hide_run"><a href="#n19">19</a></p>
-<p id="n20" class="exc"><a href="#n20">20</a></p>
+<p id="n16" class="stm run hide_run"><a href="#n16">16</a></p>
+<p id="n17" class="exc"><a href="#n17">17</a></p>
</td>
<td class="text">
<p id="t1" class="pln"><span class="com"># partial branches and excluded lines</span><span class="strut">&nbsp;</span></p>
<p id="t2" class="stm run hide_run"><span class="nam">a</span> <span class="op">=</span> <span class="num">6</span><span class="strut">&nbsp;</span></p>
<p id="t3" class="pln"><span class="strut">&nbsp;</span></p>
-<p id="t4" class="stm run hide_run"><span class="key">while</span> <span class="key">True</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
+<p id="t4" class="stm par run hide_run"><span class="annotate short">4&#x202F;&#x219B;&#x202F;7</span><span class="annotate long">line 4 didn't jump to line 7, because the condition on line 4 was never false</span><span class="key">while</span> <span class="str">"no peephole"</span><span class="op">.</span><span class="nam">upper</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> <span class="com"># t4</span><span class="strut">&nbsp;</span></p>
<p id="t5" class="stm run hide_run"> <span class="key">break</span><span class="strut">&nbsp;</span></p>
<p id="t6" class="pln"><span class="strut">&nbsp;</span></p>
-<p id="t7" class="stm run hide_run"><span class="key">while</span> <span class="num">1</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
+<p id="t7" class="stm run hide_run"><span class="key">while</span> <span class="nam">a</span><span class="op">:</span> <span class="com"># pragma: no branch</span><span class="strut">&nbsp;</span></p>
<p id="t8" class="stm run hide_run"> <span class="key">break</span><span class="strut">&nbsp;</span></p>
<p id="t9" class="pln"><span class="strut">&nbsp;</span></p>
-<p id="t10" class="stm run hide_run"><span class="key">while</span> <span class="nam">a</span><span class="op">:</span> <span class="com"># pragma: no branch</span><span class="strut">&nbsp;</span></p>
-<p id="t11" class="stm run hide_run"> <span class="key">break</span><span class="strut">&nbsp;</span></p>
+<p id="t10" class="pln"><span class="key">if</span> <span class="num">0</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
+<p id="t11" class="pln"> <span class="nam">never_happen</span><span class="op">(</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
<p id="t12" class="pln"><span class="strut">&nbsp;</span></p>
-<p id="t13" class="pln"><span class="key">if</span> <span class="num">0</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
-<p id="t14" class="pln"> <span class="nam">never_happen</span><span class="op">(</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
+<p id="t13" class="pln"><span class="key">if</span> <span class="num">1</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
+<p id="t14" class="stm run hide_run"> <span class="nam">a</span> <span class="op">=</span> <span class="num">21</span><span class="strut">&nbsp;</span></p>
<p id="t15" class="pln"><span class="strut">&nbsp;</span></p>
-<p id="t16" class="pln"><span class="key">if</span> <span class="num">1</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
-<p id="t17" class="stm run hide_run"> <span class="nam">a</span> <span class="op">=</span> <span class="num">21</span><span class="strut">&nbsp;</span></p>
-<p id="t18" class="pln"><span class="strut">&nbsp;</span></p>
-<p id="t19" class="stm run hide_run"><span class="key">if</span> <span class="nam">a</span> <span class="op">==</span> <span class="num">23</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
-<p id="t20" class="exc"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span><span class="str">"Can't"</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
+<p id="t16" class="stm run hide_run"><span class="key">if</span> <span class="nam">a</span> <span class="op">==</span> <span class="num">23</span><span class="op">:</span><span class="strut">&nbsp;</span></p>
+<p id="t17" class="exc"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span><span class="str">"Can't"</span><span class="op">)</span><span class="strut">&nbsp;</span></p>
</td>
</tr>
</table>
@@ -104,8 +98,8 @@
<div id="footer">
<div class="content">
<p>
- <a class="nav" href="index.html">&#xab; index</a> &nbsp; &nbsp; <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a2">coverage.py v5.0a2</a>,
- created at 2018-08-22 20:12
+ <a class="nav" href="index.html">&#xab; index</a> &nbsp; &nbsp; <a class="nav" href="https://coverage.readthedocs.io/en/coverage-5.0a4">coverage.py v5.0a4</a>,
+ created at 2018-11-11 07:48
</p>
</div>
</div>
diff --git a/tests/test_html.py b/tests/test_html.py
index 40c2cbf1..98e7b0b3 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -900,10 +900,7 @@ assert len(math) == 18
# partial branches and excluded lines
a = 6
- while True:
- break
-
- while 1:
+ while "no peephole".upper(): # t4
break
while a: # pragma: no branch
@@ -936,13 +933,12 @@ assert len(math) == 18
compare_html(gold_path("html/gold_partial"), "out")
contains(
"out/partial_py.html",
- '<p id="t4" class="stm run hide_run">',
+ '<p id="t4" class="stm par run hide_run">',
'<p id="t7" class="stm run hide_run">',
- '<p id="t10" class="stm run hide_run">',
# The "if 0" and "if 1" statements are optimized away.
- '<p id="t13" class="pln">',
+ '<p id="t10" class="pln">',
# The "raise AssertionError" is excluded by regex in the .ini.
- '<p id="t20" class="exc">',
+ '<p id="t17" class="exc">',
)
contains(
"out/index.html",
@@ -950,7 +946,7 @@ assert len(math) == 18
)
contains(
"out/index.html",
- '<span class="pc_cov">100%</span>'
+ '<span class="pc_cov">91%</span>'
)
def test_styled(self):