summaryrefslogtreecommitdiff
path: root/coverage/cmdline.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-13 12:20:54 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-11-13 12:33:11 -0500
commitec48227a1f00cf2b00298d8189f1265daaa447d6 (patch)
tree5c37c3f7bead1aa8c114a1645516d6453745556a /coverage/cmdline.py
parent5ca980dabd71aa74d90351a6d4e88cf101d65ded (diff)
downloadpython-coveragepy-git-ec48227a1f00cf2b00298d8189f1265daaa447d6.tar.gz
refactor: a plural helper
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r--coverage/cmdline.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index f3a466e3..070683b8 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -21,7 +21,7 @@ from coverage.data import CoverageData, combinable_files, line_counts
from coverage.debug import info_formatter, info_header, short_stack
from coverage.exceptions import BaseCoverageException, ExceptionDuringRun, NoSource
from coverage.execfile import PyRunner
-from coverage.misc import human_sorted
+from coverage.misc import human_sorted, plural
from coverage.results import Numbers, should_fail_under
@@ -819,9 +819,9 @@ class CoverageScript:
summary = line_counts(data, fullpath=True)
filenames = human_sorted(summary.keys())
nfiles = len(filenames)
- print(f"{nfiles} file{'' if nfiles == 1 else 's'}:")
+ print(f"{nfiles} file{plural(nfiles)}:")
for f in filenames:
- line = f"{f}: {summary[f]} line{'' if summary[f] == 1 else 's'}"
+ line = f"{f}: {summary[f]} line{plural(summary[f])}"
plugin = data.file_tracer(f)
if plugin:
line += f" [{plugin}]"