ruff/crates/ruff_python_formatter/resources/test/fixtures
Charlie Marsh c71ff7eae1
Avoid printing continuations within import identifiers (#7744)
## Summary

It turns out that _some_ identifiers can contain newlines --
specifically, dot-delimited import identifiers, like:
```python
import foo\
    .bar
```

At present, we print all identifiers verbatim, which causes us to retain
the `\` in the formatted output. This also leads to violating some debug
assertions (see the linked issue, though that's a symptom of this
formatting failure).

This PR adds detection for import identifiers that contain newlines, and
formats them via `text` (slow) rather than `source_code_slice` (fast) in
those cases.

Closes https://github.com/astral-sh/ruff/issues/7734.

## Test Plan

`cargo test`
2023-10-02 09:51:07 -04:00
..
black Introduce IndentWidth (#7301) 2023-09-13 14:52:24 +02:00
ruff Avoid printing continuations within import identifiers (#7744) 2023-10-02 09:51:07 -04:00
import_black_tests.py Update Black tests (#6618) 2023-08-16 15:05:51 +00:00