summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-02-25 19:14:52 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-02-25 19:14:52 -0500
commit88c584f0bafb7d5356a740ec684cfea7e515089e (patch)
tree456a1113505d4ec5b44c0d5becc33677d287012e
parentc6fbb3888e6f05b6265ba9b30f5ea2444d0d51a7 (diff)
downloadpython-coveragepy-git-88c584f0bafb7d5356a740ec684cfea7e515089e.tar.gz
refactor: simplify a one-iteration loop
-rw-r--r--tests/test_html.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/test_html.py b/tests/test_html.py
index ee2eb575..51e0b93c 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -1078,10 +1078,9 @@ class HtmlWithContextsTest(HtmlTestHelpers, CoverageTest):
"""Get HTML report data from a `Coverage` object for a morf."""
with self.assert_warnings(cov, []):
datagen = coverage.html.HtmlDataGeneration(cov)
- for fr, analysis in get_analysis_to_report(cov, [morf]):
- # This will only loop once, so it's fine to return inside the loop.
- file_data = datagen.data_for_file(fr, analysis)
- return file_data
+ fr, analysis = next(get_analysis_to_report(cov, [morf]))
+ file_data = datagen.data_for_file(fr, analysis)
+ return file_data
SOURCE = """\
def helper(lineno):