diff --git a/httpie/output/formatters/colors.py b/httpie/output/formatters/colors.py index 0d9bd12e2f..3a29a7cb96 100644 --- a/httpie/output/formatters/colors.py +++ b/httpie/output/formatters/colors.py @@ -385,4 +385,4 @@ def make_styles(): PIE_STYLES = make_styles() PIE_STYLE_NAMES = list(PIE_STYLES.keys()) -BUNDLED_STYLES |= PIE_STYLES.keys() +BUNDLED_STYLES |= {style.value for style in PIE_STYLES} diff --git a/tests/test_cli_ui.py b/tests/test_cli_ui.py index bb744cdc4e..9b7ae3e150 100644 --- a/tests/test_cli_ui.py +++ b/tests/test_cli_ui.py @@ -63,3 +63,14 @@ def fake_terminal_size(*args, **kwargs): def test_naked_invocation(ignore_terminal_size, args, expected_msg): result = http(*args, tolerate_error_exit_status=True) assert result.stderr == expected_msg + + +def test_invalid_style_lists_bundled_pie_styles_by_name(): + result = http( + '--style', '$invalid', '--offline', 'pie.dev', + tolerate_error_exit_status=True, + ) + assert 'invalid choice' in result.stderr + assert 'PieStyle' not in result.stderr + for name in ('pie', 'pie-dark', 'pie-light'): + assert name in result.stderr