Conversation
Contributor
|
962fb05 to
a48d96d
Compare
ntBre
commented
Oct 13, 2025
...on_formatter/tests/snapshots/black_compatibility@cases__remove_lone_list_item_parens.py.snap
Show resolved
Hide resolved
...ruff_python_formatter/tests/snapshots/black_compatibility@cases__type_param_defaults.py.snap
Show resolved
Hide resolved
crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__cantfit.py.snap
Show resolved
Hide resolved
crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__fmtskip10.py.snap
Show resolved
Hide resolved
crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__fmtskip10.py.snap
Show resolved
Hide resolved
...ormatter/tests/snapshots/black_compatibility@cases__preview_long_strings__regression.py.snap
Show resolved
Hide resolved
...ython_formatter/tests/snapshots/black_compatibility@cases__preview_multiline_strings.py.snap
Show resolved
Hide resolved
.../snapshots/black_compatibility@cases__preview_remove_multiline_lone_list_item_parens.py.snap
Show resolved
Hide resolved
...n_formatter/tests/snapshots/black_compatibility@cases__preview_wrap_comprehension_in.py.snap
Show resolved
Hide resolved
...thon_formatter/tests/snapshots/black_compatibility@cases__remove_except_types_parens.py.snap
Show resolved
Hide resolved
This is currently stacked on #20777 to remove the panic from introducing the new syntax error tracked in #20774. I also still need to go through the other new deviations to make sure they look reasonable. Summary -- ```shell git clone [email protected]:psf/black.git ../other/black crates/ruff_python_formatter/resources/test/fixtures/import_black_tests.py ../other/black ``` Then ran our tests and accepted the snapshots I had to make a small fix to our tuple normalization logic for `del` statements in the second commit, otherwise the tests were panicking at a changed AST. I think the new implementation is closer to the intention described in the nearby comment anyway, though. The first commit adds the new files, the next three commits make some small fixes to help get the tests running, and then the last commit accepts all of the new snapshots, including the new unsupported syntax error for one f-string example, tracked in #20774. Test Plan -- Newly imported tests
this was causing an issue with a new black test: ```py del ([], name_1, name_2), [(), [], name_4, name_3], name_1[[name_2 for name_1 in name_0]] ``` we were flattening the first argument since it happened to be a tuple instead of what seems to be the intended case mentioned in the comment where the only `del` target is a tuple (which this example also triggers *after* formatting)
a48d96d to
a362ddb
Compare
MichaReiser
reviewed
Oct 14, 2025
| -]( | ||
| - a: str, | ||
| -): | ||
| +](a: str): |
Member
There was a problem hiding this comment.
Huh, we ignore the trailing comma
Contributor
Author
There was a problem hiding this comment.
Oh, this might actually be okay. This is the input:
def trailing_comma1[T=int,](a: str):
passSo we respect the trailing comma in the type parameters, and there's no trailing comma in the function parameters.
MichaReiser
approved these changes
Oct 14, 2025
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks for the detailed analysis.
dcreager
added a commit
that referenced
this pull request
Oct 15, 2025
…rable * origin/main: [ty] Add (unused) `inferable` parameter to type property methods (#20865) Run macos tests on macos (#20889) Remove `release` CI job (#20887) [ty] CI: Faster ecosystem analysis (#20886) Remove `strip` from release profile (#20885) [ty] Sync vendored typeshed stubs (#20876) [ty] Add some completion ranking improvements (#20807) Improved error recovery for unclosed strings (including f- and t-strings) (#20848) Enable lto=fat (#20863) [`pyupgrade`] Extend `UP019` to detect `typing_extensions.Text` (`UP019`) (#20825) [`flake8-bugbear`] Omit annotation in preview fix for `B006` (#20877) fix(docs): Fix typo in `RUF015` description (#20873) [ty] Improve and extend tests for instance attributes redeclared in subclasses (#20866) [ty] Ignore slow seeds as a temporary measure (#20870) Remove parentheses around multiple exception types on Python 3.14+ (#20768) Update Black tests (#20794)
dcreager
added a commit
that referenced
this pull request
Oct 15, 2025
…nt-sets * dcreager/non-non-inferable: (174 commits) [ty] Add (unused) `inferable` parameter to type property methods (#20865) Run macos tests on macos (#20889) Remove `release` CI job (#20887) [ty] CI: Faster ecosystem analysis (#20886) Remove `strip` from release profile (#20885) [ty] Sync vendored typeshed stubs (#20876) [ty] Add some completion ranking improvements (#20807) Improved error recovery for unclosed strings (including f- and t-strings) (#20848) Enable lto=fat (#20863) [`pyupgrade`] Extend `UP019` to detect `typing_extensions.Text` (`UP019`) (#20825) [`flake8-bugbear`] Omit annotation in preview fix for `B006` (#20877) fix(docs): Fix typo in `RUF015` description (#20873) [ty] Improve and extend tests for instance attributes redeclared in subclasses (#20866) [ty] Ignore slow seeds as a temporary measure (#20870) use existing method Remove parentheses around multiple exception types on Python 3.14+ (#20768) Update Black tests (#20794) just the api parts [ty] Fix further issues in `super()` inference logic (#20843) [ty] Document when a rule was added (#20859) ...
Merged
dylwil3
added a commit
that referenced
this pull request
Jan 6, 2026
I am updating these because we didn't have test coverage for the different handling of `fmt: skip` comments applied to multiple statements on the same line. This is in preparation for #22119 (to show before/after deviations). Follows the same procedure as in #20794 Edit: As it happens, the new fixtures do not even cover the case relevant to #22119 - they just deal with the already handled case of a one-line compound statement. Nevertheless, it seems worthwhile to make this update, especially since it uncovered a (possible?) bug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Then ran our tests and accepted the snapshots
I had to make a small fix to our tuple normalization logic for
delstatementsin the second commit, otherwise the tests were panicking at a changed AST. I
think the new implementation is closer to the intention described in the nearby
comment anyway, though.
The first commit adds the new Python, settings, and
.expectfiles, the next three commits make some smallfixes to help get the tests running, and then the fifth commit accepts all but one of the new snapshots. The last commit includes the new unsupported syntax error for one f-string example, tracked in #20774.
Test Plan
Newly imported tests. I went through all of the new snapshots and added review comments below. I think they're all expected, except a few cases I wasn't 100% sure about.