ruff/crates/ruff_python_formatter/tests/snapshots
konsti 0b9af031fb
Format ExprIfExp (ternary operator) (#5597)
## Summary

Format `ExprIfExp`, also known as the ternary operator or inline `if`.
It can look like
```python
a1 = 1 if True else 2
```
but also
```python
b1 = (
    # We return "a" ...
    "a" # that's our True value
    # ... if this condition matches ...
    if True # that's our test
    # ... otherwise we return "b§
    else "b" # that's our False value
)
```

This also fixes a visitor order bug.

The jaccard index on django goes from 0.911 to 0.915.

## Test Plan

I added fixtures without and with comments in strange places.
2023-07-07 19:11:52 +00:00
..
black_compatibility@conditional_expression.py.snap Format ExprIfExp (ternary operator) (#5597) 2023-07-07 19:11:52 +00:00
black_compatibility@miscellaneous__blackd_diff.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@miscellaneous__debug_visitor.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@miscellaneous__decorators.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@miscellaneous__docstring_no_string_normalization.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@miscellaneous__docstring_preview_no_string_normalization.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@miscellaneous__force_pyi.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@miscellaneous__long_strings_flag_disabled.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
black_compatibility@miscellaneous__power_op_newline.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@miscellaneous__string_quotes.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_36__numeric_literals.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_36__numeric_literals_skip_underscores.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_37__python37.py.snap Change generator formatting dummy to include NOT_YET_IMPLEMENTED (#5464) 2023-07-03 09:11:14 +02:00
black_compatibility@py_38__pep_570.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_38__pep_572.py.snap Change generator formatting dummy to include NOT_YET_IMPLEMENTED (#5464) 2023-07-03 09:11:14 +02:00
black_compatibility@py_38__python38.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_39__pep_572_py39.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_39__python39.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_39__remove_with_brackets.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_310__pattern_matching_complex.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_310__pattern_matching_extras.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@py_310__pattern_matching_generic.py.snap Change generator formatting dummy to include NOT_YET_IMPLEMENTED (#5464) 2023-07-03 09:11:14 +02:00
black_compatibility@py_310__pattern_matching_simple.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_310__pattern_matching_style.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
black_compatibility@py_310__pep_572_py310.py.snap Change generator formatting dummy to include NOT_YET_IMPLEMENTED (#5464) 2023-07-03 09:11:14 +02:00
black_compatibility@py_310__remove_newline_after_match.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_310__starred_for_target.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_311__pep_654.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@py_311__pep_654_style.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__attribute_access_on_number_literals.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__bracketmatch.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__class_methods_new_line.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__collections.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__comment_after_escaped_newline.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__comments2.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__comments3.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
black_compatibility@simple_cases__comments4.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__comments6.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__comments9.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__comments_non_breaking_space.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__composition.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
black_compatibility@simple_cases__composition_no_trailing_comma.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
black_compatibility@simple_cases__docstring.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__docstring_preview.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__empty_lines.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__expression.py.snap Format ExprIfExp (ternary operator) (#5597) 2023-07-07 19:11:52 +00:00
black_compatibility@simple_cases__fmtonoff.py.snap Format ExprIfExp (ternary operator) (#5597) 2023-07-07 19:11:52 +00:00
black_compatibility@simple_cases__fmtonoff2.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__fmtonoff3.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__fmtonoff4.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
black_compatibility@simple_cases__fmtonoff5.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
black_compatibility@simple_cases__fmtskip.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__fmtskip2.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__fmtskip3.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__fmtskip5.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__fmtskip7.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__fmtskip8.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__fstring.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__function.py.snap Format ExprIfExp (ternary operator) (#5597) 2023-07-07 19:11:52 +00:00
black_compatibility@simple_cases__function2.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__function_trailing_comma.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
black_compatibility@simple_cases__import_spacing.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__one_element_subscript.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__power_op_spacing.py.snap Change generator formatting dummy to include NOT_YET_IMPLEMENTED (#5464) 2023-07-03 09:11:14 +02:00
black_compatibility@simple_cases__remove_await_parens.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__remove_except_parens.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__remove_for_brackets.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__remove_newline_after_code_block_open.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
black_compatibility@simple_cases__remove_parens.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__return_annotation_brackets.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__skip_magic_trailing_comma.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__slices.py.snap Change generator formatting dummy to include NOT_YET_IMPLEMENTED (#5464) 2023-07-03 09:11:14 +02:00
black_compatibility@simple_cases__string_prefixes.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__torture.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__trailing_comma_optional_parens1.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__trailing_comma_optional_parens2.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__trailing_commas_in_leading_parts.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__tupleassign.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
black_compatibility@simple_cases__whitespace.py.snap Update Black tests (#5438) 2023-06-30 06:32:50 +00:00
format@carriage_return__string.py.snap Normalize '\r' in string literals to '\n' 2023-06-30 10:13:23 +02:00
format@expression__attribute.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
format@expression__binary.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
format@expression__boolean_operation.py.snap Format call expressions (without call chaining) (#5341) 2023-06-27 09:29:40 +00:00
format@expression__call.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
format@expression__compare.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
format@expression__dict.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
format@expression__if.py.snap Format ExprIfExp (ternary operator) (#5597) 2023-07-07 19:11:52 +00:00
format@expression__list.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
format@expression__slice.py.snap Format call expressions (without call chaining) (#5341) 2023-06-27 09:29:40 +00:00
format@expression__string.py.snap Fix invalid printer IR error (#5422) 2023-06-29 08:09:13 +02:00
format@expression__tuple.py.snap Add tests for skip magic trailing comma 2023-06-26 14:15:55 +02:00
format@expression__unary.py.snap Preserve parentheses around left side of binary expression 2023-06-30 09:52:14 +02:00
format@skip_magic_trailing_comma.py.snap Add tests for skip magic trailing comma 2023-06-26 14:15:55 +02:00
format@statement__assign.py.snap Add tests for skip magic trailing comma 2023-06-26 14:15:55 +02:00
format@statement__break.py.snap Add tests for skip magic trailing comma 2023-06-26 14:15:55 +02:00
format@statement__class_definition.py.snap Fix invalid syntax for binary expression in unary op (#5370) 2023-06-29 08:09:26 +02:00
format@statement__for.py.snap Add tests for skip magic trailing comma 2023-06-26 14:15:55 +02:00
format@statement__function.py.snap Add tests for skip magic trailing comma 2023-06-26 14:15:55 +02:00
format@statement__if.py.snap Add tests for skip magic trailing comma 2023-06-26 14:15:55 +02:00
format@statement__import.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
format@statement__import_from.py.snap Format import statements (#5493) 2023-07-04 07:07:20 +00:00
format@statement__try.py.snap Fix formatter StmtTry test (#5568) 2023-07-06 18:23:53 +00:00
format@statement__while.py.snap Format call expressions (without call chaining) (#5341) 2023-06-27 09:29:40 +00:00
format@statement__with.py.snap Don't add a magic trailing comma for a single entry (#5463) 2023-07-03 21:48:44 +02:00
format@trivia.py.snap Add tests for skip magic trailing comma 2023-06-26 14:15:55 +02:00