Skip to content

Commit 84d9d3e

Browse files
committed
fix: (no class) wasn't right
1 parent 5621228 commit 84d9d3e

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Version 7.5.4 — 2024-06-22
5757
- Fixed a minor branch coverage problem with wildcard match/case cases using
5858
names or guard clauses.
5959

60+
- Fixed an incorrect calculation of "(no class)" lines in the classes report.
61+
6062
- Started testing on 3.13 free-threading (nogil) builds of Python. I'm not
6163
claiming full support yet. Closes `issue 1799`_.
6264

coverage/html.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,11 @@ def write_region_index_pages(self, files_to_report: Iterable[FileToReport]) -> N
542542
for ftr in files_to_report:
543543
region_nouns = [pair[0] for pair in ftr.fr.code_region_kinds()]
544544
num_lines = len(ftr.fr.source().splitlines())
545-
outside_lines = set(range(1, num_lines + 1))
546545
regions = ftr.fr.code_regions()
547546

548547
for noun in region_nouns:
549548
page_data = self.index_pages[noun]
549+
outside_lines = set(range(1, num_lines + 1))
550550

551551
for region in regions:
552552
if region.kind != noun:

tests/gold/html/b_branch/class_index.html

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<header>
1212
<div class="content">
1313
<h1>Coverage report:
14-
<span class="pc_cov">100%</span>
14+
<span class="pc_cov">70%</span>
1515
</h1>
1616
<aside id="help_panel_wrapper">
1717
<input id="help_panel_state" type="checkbox">
@@ -57,7 +57,7 @@ <h2>
5757
</h2>
5858
<p class="text">
5959
<a class="nav" href="https://coverage.readthedocs.io/en/7.6.0a0.dev1">coverage.py v7.6.0a0.dev1</a>,
60-
created at 2024-07-10 16:14 -0400
60+
created at 2024-07-10 16:17 -0400
6161
</p>
6262
</div>
6363
</header>
@@ -79,24 +79,24 @@ <h2>
7979
<tr class="region">
8080
<td class="name left"><a href="b_py.html">b.py</a></td>
8181
<td class="name left"><a href="b_py.html"><data value=''><span class='no-noun'>(no class)</span></data></a></td>
82-
<td>6</td>
83-
<td>0</td>
84-
<td>0</td>
82+
<td>17</td>
83+
<td>3</td>
8584
<td>0</td>
86-
<td>0</td>
87-
<td class="right" data-ratio="6 6">100%</td>
85+
<td>6</td>
86+
<td>4</td>
87+
<td class="right" data-ratio="16 23">70%</td>
8888
</tr>
8989
</tbody>
9090
<tfoot>
9191
<tr class="total">
9292
<td class="name left">Total</td>
9393
<td class="name left">&nbsp;</td>
94-
<td>6</td>
95-
<td>0</td>
96-
<td>0</td>
94+
<td>17</td>
95+
<td>3</td>
9796
<td>0</td>
98-
<td>0</td>
99-
<td class="right" data-ratio="6 6">100%</td>
97+
<td>6</td>
98+
<td>4</td>
99+
<td class="right" data-ratio="16 23">70%</td>
100100
</tr>
101101
</tfoot>
102102
</table>
@@ -108,7 +108,7 @@ <h2>
108108
<div class="content">
109109
<p>
110110
<a class="nav" href="https://coverage.readthedocs.io/en/7.6.0a0.dev1">coverage.py v7.6.0a0.dev1</a>,
111-
created at 2024-07-10 16:14 -0400
111+
created at 2024-07-10 16:17 -0400
112112
</p>
113113
</div>
114114
<aside class="hidden">

tests/gold/html/contexts/class_index.html

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
55
<title>Coverage report</title>
66
<link rel="icon" sizes="32x32" href="favicon_32_cb_58284776.png">
7-
<link rel="stylesheet" href="style_cb_718ce007.css" type="text/css">
8-
<script src="coverage_html_cb_d1c4fcc4.js" defer></script>
7+
<link rel="stylesheet" href="style_cb_8e611ae1.css" type="text/css">
8+
<script src="coverage_html_cb_6fb7b396.js" defer></script>
99
</head>
1010
<body class="indexfile">
1111
<header>
1212
<div class="content">
1313
<h1>Coverage report:
14-
<span class="pc_cov">100%</span>
14+
<span class="pc_cov">94%</span>
1515
</h1>
1616
<aside id="help_panel_wrapper">
1717
<input id="help_panel_state" type="checkbox">
@@ -54,8 +54,8 @@ <h2>
5454
<a class="button current">Classes</a>
5555
</h2>
5656
<p class="text">
57-
<a class="nav" href="https://coverage.readthedocs.io/en/7.5.1a0.dev1">coverage.py v7.5.1a0.dev1</a>,
58-
created at 2024-04-28 13:14 -0300
57+
<a class="nav" href="https://coverage.readthedocs.io/en/7.6.0a0.dev1">coverage.py v7.6.0a0.dev1</a>,
58+
created at 2024-07-10 16:30 -0400
5959
</p>
6060
</div>
6161
</header>
@@ -75,20 +75,20 @@ <h2>
7575
<tr class="region">
7676
<td class="name left"><a href="two_tests_py.html">two_tests.py</a></td>
7777
<td class="name left"><a href="two_tests_py.html"><data value=''><span class='no-noun'>(no class)</span></data></a></td>
78-
<td>7</td>
78+
<td>17</td>
79+
<td>1</td>
7980
<td>0</td>
80-
<td>0</td>
81-
<td class="right" data-ratio="7 7">100%</td>
81+
<td class="right" data-ratio="16 17">94%</td>
8282
</tr>
8383
</tbody>
8484
<tfoot>
8585
<tr class="total">
8686
<td class="name left">Total</td>
8787
<td class="name left">&nbsp;</td>
88-
<td>7</td>
89-
<td>0</td>
88+
<td>17</td>
89+
<td>1</td>
9090
<td>0</td>
91-
<td class="right" data-ratio="7 7">100%</td>
91+
<td class="right" data-ratio="16 17">94%</td>
9292
</tr>
9393
</tfoot>
9494
</table>
@@ -99,8 +99,8 @@ <h2>
9999
<footer>
100100
<div class="content">
101101
<p>
102-
<a class="nav" href="https://coverage.readthedocs.io/en/7.5.1a0.dev1">coverage.py v7.5.1a0.dev1</a>,
103-
created at 2024-04-28 13:14 -0300
102+
<a class="nav" href="https://coverage.readthedocs.io/en/7.6.0a0.dev1">coverage.py v7.6.0a0.dev1</a>,
103+
created at 2024-07-10 16:30 -0400
104104
</p>
105105
</div>
106106
<aside class="hidden">

0 commit comments

Comments
 (0)