Marco Ricci commited on 2024-12-31 23:58:59
Zeige 2 geänderte Dateien mit 10 Einfügungen und 10 Löschungen.
Exclude further machinery from coverage that isn't meant to be tested.
| ... | ... |
@@ -36,7 +36,7 @@ def load_translations( |
| 36 | 36 |
localedirs: list[str] | None = None, |
| 37 | 37 |
languages: Sequence[str] | None = None, |
| 38 | 38 |
class_: type[gettext.NullTranslations] | None = None, |
| 39 |
-) -> gettext.NullTranslations: |
|
| 39 |
+) -> gettext.NullTranslations: # pragma: no cover |
|
| 40 | 40 |
"""Load a translation catalog for derivepassphrase. |
| 41 | 41 |
|
| 42 | 42 |
Runs [`gettext.translation`][] under the hood for multiple locale |
| ... | ... |
@@ -1137,7 +1137,7 @@ class ErrMsgTemplate(enum.Enum): |
| 1137 | 1137 |
) |
| 1138 | 1138 |
|
| 1139 | 1139 |
|
| 1140 |
-def write_pot_file(fileobj: TextIO) -> None: |
|
| 1140 |
+def _write_pot_file(fileobj: TextIO) -> None: # pragma: no cover |
|
| 1141 | 1141 |
r"""Write a .po template to the given file object. |
| 1142 | 1142 |
|
| 1143 | 1143 |
Assumes the file object is opened for writing and accepts string |
| ... | ... |
@@ -1209,7 +1209,7 @@ def write_pot_file(fileobj: TextIO) -> None: |
| 1209 | 1209 |
|
| 1210 | 1210 |
def _format_po_entry( |
| 1211 | 1211 |
enum_value: Label | InfoMsgTemplate | WarnMsgTemplate | ErrMsgTemplate, |
| 1212 |
-) -> tuple[str, ...]: |
|
| 1212 |
+) -> tuple[str, ...]: # pragma: no cover |
|
| 1213 | 1213 |
ret: list[str] = ['\n'] |
| 1214 | 1214 |
ts = enum_value.value |
| 1215 | 1215 |
if ts.translator_comments: |
| ... | ... |
@@ -1229,7 +1229,7 @@ def _format_po_entry( |
| 1229 | 1229 |
return tuple(ret) |
| 1230 | 1230 |
|
| 1231 | 1231 |
|
| 1232 |
-def _cstr(s: str) -> str: |
|
| 1232 |
+def _cstr(s: str) -> str: # pragma: no cover |
|
| 1233 | 1233 |
def escape(string: str) -> str: |
| 1234 | 1234 |
return string.translate({
|
| 1235 | 1235 |
0: r'\000', |
| ... | ... |
@@ -1260,4 +1260,4 @@ def _cstr(s: str) -> str: |
| 1260 | 1260 |
|
| 1261 | 1261 |
|
| 1262 | 1262 |
if __name__ == '__main__': |
| 1263 |
- write_pot_file(sys.stdout) |
|
| 1263 |
+ _write_pot_file(sys.stdout) |
| ... | ... |
@@ -815,7 +815,7 @@ class CommandWithHelpGroups(click.Command): |
| 815 | 815 |
if isinstance(param, OptionGroupOption): |
| 816 | 816 |
group_name = self._text(param.option_group_name) |
| 817 | 817 |
epilogs.setdefault(group_name, self._text(param.epilog)) |
| 818 |
- else: |
|
| 818 |
+ else: # pragma: no cover |
|
| 819 | 819 |
group_name = default_group_name |
| 820 | 820 |
help_records.setdefault(group_name, []).append(rec) |
| 821 | 821 |
if default_group_name in help_records: # pragma: no branch |
| ... | ... |
@@ -989,7 +989,7 @@ def version_option_callback( |
| 989 | 989 |
ctx: click.Context, |
| 990 | 990 |
param: click.Parameter, |
| 991 | 991 |
value: bool, # noqa: FBT001 |
| 992 |
-) -> None: |
|
| 992 |
+) -> None: # pragma: no cover |
|
| 993 | 993 |
del param |
| 994 | 994 |
if value and not ctx.resilient_parsing: |
| 995 | 995 |
click.echo( |
| ... | ... |
@@ -2617,13 +2617,13 @@ def derivepassphrase_vault( # noqa: C901,PLR0912,PLR0913,PLR0914,PLR0915 |
| 2617 | 2617 |
group = LoggingOption |
| 2618 | 2618 |
elif isinstance(param, CompatibilityOption): |
| 2619 | 2619 |
group = CompatibilityOption |
| 2620 |
- elif isinstance(param, StandardOption): |
|
| 2620 |
+ elif isinstance(param, StandardOption): # pragma: no branch |
|
| 2621 | 2621 |
group = StandardOption |
| 2622 |
- elif isinstance(param, OptionGroupOption): |
|
| 2622 |
+ elif isinstance(param, OptionGroupOption): # pragma: no cover |
|
| 2623 | 2623 |
raise AssertionError( # noqa: DOC501,TRY003,TRY004 |
| 2624 | 2624 |
f'Unknown option group for {param!r}' # noqa: EM102
|
| 2625 | 2625 |
) |
| 2626 |
- else: |
|
| 2626 |
+ else: # pragma: no cover |
|
| 2627 | 2627 |
group = click.Option |
| 2628 | 2628 |
options_in_group.setdefault(group, []).append(param) |
| 2629 | 2629 |
params_by_str[param.human_readable_name] = param |
| 2630 | 2630 |