diff --git a/CHANGES.rst b/CHANGES.rst index 5369e29c1..74412bf53 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -27,6 +27,9 @@ Unreleased hashes added to their names to ensure updated files are used instead of stale cached copies. +- Missing branch coverage explanations that said "the condition was never + false" now read "was always true" because it's easier to understand. + .. scriv-start-here diff --git a/coverage/parser.py b/coverage/parser.py index 45ea397bb..8a64f6247 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -1093,7 +1093,7 @@ def _handle__If(self, node: ast.If) -> set[ArcStart]: start = self.line_for_node(node.test) from_start = ArcStart(start, cause="the condition on line {lineno} was never true") exits = self.add_body_arcs(node.body, from_start=from_start) - from_start = ArcStart(start, cause="the condition on line {lineno} was never false") + from_start = ArcStart(start, cause="the condition on line {lineno} was always true") exits |= self.add_body_arcs(node.orelse, from_start=from_start) return exits @@ -1287,7 +1287,7 @@ def _handle__While(self, node: ast.While) -> set[ArcStart]: my_block = self.block_stack.pop() assert isinstance(my_block, LoopBlock) exits.update(my_block.break_exits) - from_start = ArcStart(start, cause="the condition on line {lineno} was never false") + from_start = ArcStart(start, cause="the condition on line {lineno} was always true") if node.orelse: else_exits = self.add_body_arcs(node.orelse, from_start=from_start) exits |= else_exits diff --git a/tests/gold/html/b_branch/b_py.html b/tests/gold/html/b_branch/b_py.html index dbda3ea29..5bbd60cda 100644 --- a/tests/gold/html/b_branch/b_py.html +++ b/tests/gold/html/b_branch/b_py.html @@ -67,7 +67,7 @@

» next       coverage.py v7.5.1a0.dev1, - created at 2024-04-24 09:22 -0400 + created at 2024-04-25 08:04 -0400