We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0700018 commit 60a5d65Copy full SHA for 60a5d65
doc/branch.rst
@@ -116,3 +116,16 @@ Here the while loop will never complete because the break will always be taken
116
at some point. Coverage.py can't work that out on its own, but the "no branch"
117
pragma indicates that the branch is known to be partial, and the line is not
118
flagged.
119
+
120
+Generator expressions
121
+=====================
122
123
+Generator expressions may also report partial branch coverage. Consider the
124
+following example::
125
126
+ value = next(i in range(1))
127
128
+While we might expect this line of code to be reported as covered, the
129
+generator did not iterate until ``StopIteration`` is raised, the indication
130
+that the loop is complete. This is another case
131
+where adding ``# pragma: no branch`` may be desirable.
0 commit comments