Skip to content

Commit

Permalink
fix test_bad_action for Python >= 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
FriedrichFroebel authored Dec 15, 2024
1 parent 737832d commit 2ea1e11
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,17 @@ def test_bad_action(self, action='eggs'):
parser.parse_arguments(dict())
self.assertEqual(exception_manager.exception.args, (2,))
action_values = ','.join(self.action_names)
action_strings = ', '.join(map(repr, self.action_names))
if sys.version_info < (3, 9):
if sys.version_info < (3, 12):
action_strings = ', '.join(map(repr, self.action_names))
self.assertMultiLineEqual(
stderr.getvalue(),
(
f'usage: didjvu [-h] [--version] {{{action_values}}} ...\n'
f"didjvu: error: invalid choice: 'eggs' (choose from {action_strings})\n"
f"didjvu: error: argument {{{action_values}}}: invalid choice: 'eggs' (choose from {action_strings})\n"
)
)
else:
action_strings = ', '.join(map(lambda x: f"'{x}'", self.action_names))
self.assertMultiLineEqual(
stderr.getvalue(),
(
Expand Down

0 comments on commit 2ea1e11

Please sign in to comment.