ruff/crates/ruff_python_formatter/tests/snapshots
Louis Dispa e7e2f44440
Format raise statement (#5595)
## Summary

This PR implements the formatting of `raise` statements. I haven't
looked at the black implementation, this is inspired from from the
`return` statements formatting.

## Test Plan

The black differences with insta.

I also compared manually some edge cases with very long string and call
chaining and it seems to do the same formatting as black.

There is one issue:
```python
# input

raise OsError(
    "aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa"
) from a.aaaaa(aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa).a(aaaa)


# black

raise OsError(
    "aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa"
) from a.aaaaa(
    aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa
).a(
    aaaa
)


# ruff

raise OsError(
    "aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa"
) from a.aaaaa(
    aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa
).a(aaaa)
```

But I'm not sure this diff is the raise formatting implementation.

---------

Co-authored-by: Louis Dispa <ldispa@deezer.com>
2023-07-10 21:23:49 +02: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 Format named expressions (walrus operator) (#5642) 2023-07-10 12:32:15 +00: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 Format named expressions (walrus operator) (#5642) 2023-07-10 12:32:15 +00:00
black_compatibility@py_39__python39.py.snap Format named expressions (walrus operator) (#5642) 2023-07-10 12:32:15 +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 Format named expressions (walrus operator) (#5642) 2023-07-10 12:32:15 +00: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 Format raise statement (#5595) 2023-07-10 21:23:49 +02: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 raise statement (#5595) 2023-07-10 21:23:49 +02: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 raise statement (#5595) 2023-07-10 21:23:49 +02: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 Format raise statement (#5595) 2023-07-10 21:23:49 +02: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 Fix typos found by codespell (#5607) 2023-07-08 12:33:18 +02:00
format@expression__if.py.snap Fix find_only_token_in_range with expression parentheses (#5645) 2023-07-10 15:55:19 +02: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__named_expr.py.snap Format named expressions (walrus operator) (#5642) 2023-07-10 12:32:15 +00: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 typos found by codespell (#5607) 2023-07-08 12:33:18 +02:00
format@expression__tuple.py.snap Format raise statement (#5595) 2023-07-10 21:23:49 +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 Fix typos found by codespell (#5607) 2023-07-08 12:33:18 +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__raise.py.snap Format raise statement (#5595) 2023-07-10 21:23:49 +02: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