From c7f8ad17f50fc77db0c646a55a3950c3306156f6 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 8 Nov 2020 12:42:52 -0300 Subject: [PATCH] Rename _make_plural to pluralize A bit shorter and a better name, IMHO. --- src/_pytest/terminal.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index f1736ee43..7d2943dd0 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -1204,7 +1204,7 @@ class TerminalReporter: count = len(reports) color = _color_for_type.get(key, _color_for_type_default) markup = {color: True, "bold": color == main_color} - parts.append(("%d %s" % _make_plural(count, key), markup)) + parts.append(("%d %s" % pluralize(count, key), markup)) if not parts: parts = [("no tests ran", {_color_for_type_default: True})] @@ -1223,9 +1223,7 @@ class TerminalReporter: elif deselected == 0: main_color = "green" - collected_output = "%d %s collected" % _make_plural( - self._numcollected, "test" - ) + collected_output = "%d %s collected" % pluralize(self._numcollected, "test") parts = [(collected_output, {main_color: True})] else: all_tests_were_deselected = self._numcollected == deselected @@ -1241,7 +1239,7 @@ class TerminalReporter: if errors: main_color = _color_for_type["error"] - parts += [("%d %s" % _make_plural(errors, "error"), {main_color: True})] + parts += [("%d %s" % pluralize(errors, "error"), {main_color: True})] return parts, main_color @@ -1329,7 +1327,7 @@ _color_for_type = { _color_for_type_default = "yellow" -def _make_plural(count: int, noun: str) -> Tuple[int, str]: +def pluralize(count: int, noun: str) -> Tuple[int, str]: # No need to pluralize words such as `failed` or `passed`. if noun not in ["error", "warnings", "test"]: return count, noun