-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update Black tests #20794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Black tests #20794
Conversation
|
962fb05 to
a48d96d
Compare
...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
| -]( | ||
| - a: str, | ||
| -): | ||
| +](a: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, we ignore the trailing comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed analysis.
…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)
…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) ...
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.