Skip to content

Commit

Permalink
Py <3.13 help text formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
kschwab committed Nov 9, 2024
1 parent 31e18d9 commit a6c6225
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_source_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2122,14 +2122,22 @@ class Settings(BaseModel):

with pytest.raises(SystemExit):
CliApp.run(Settings, cli_args=['--help'])
assert (
capsys.readouterr().out
== f"""usage: example.py [-h] [--circle-optional.radius float |
usage = (
"""usage: example.py [-h] [--circle-optional.radius float |
--circle-optional.diameter float |
--circle-optional.perimeter float]
(--circle-required.radius float |
--circle-required.diameter float |
--circle-required.perimeter float)
--circle-required.perimeter float)"""
if sys.version_info >= (3, 13)
else """usage: example.py [-h]
[--circle-optional.radius float | --circle-optional.diameter float | --circle-optional.perimeter float]
(--circle-required.radius float | --circle-required.diameter float | --circle-required.perimeter float)
"""
)
assert (
capsys.readouterr().out
== f"""{usage}
{ARGPARSE_OPTIONS_TEXT}:
-h, --help show this help message and exit
Expand Down

0 comments on commit a6c6225

Please sign in to comment.