Skip to content
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 #13375

Merged
merged 1 commit into from
Sep 17, 2024
Merged

Update Black tests #13375

merged 1 commit into from
Sep 17, 2024

Conversation

MichaReiser
Copy link
Member

Summary

Pull in the latest black snapshot tests

Test Plan

cargo test. I reviewed the new snapshot tests

@MichaReiser MichaReiser added internal An internal refactor or improvement formatter Related to the formatter labels Sep 17, 2024
Comment on lines +38 to +43
-type something_that_is_long[
- something_that_is_long = something_that_is_long
-] = something_that_is_long
+type something_that_is_long[something_that_is_long = something_that_is_long] = (
+ something_that_is_long
+)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer Ruff's formatting here which is more in line with other assignment formatting where the preference is to break the right side before breaking the left.

Comment on lines +49 to +52
+def simple[T = something_that_is_long](
+ short1: int, short2: str, short3: bytes
+) -> float:
pass
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer Ruff's formatting here. Breaking the return type and arguments is more readable than breaking the type arguments (overall, prefer breaking the right before breaking the left)


f"{1:{f'{2}'}}"
-f"{1:{f'{2}'}}"
+f'{1:{f'{2}'}}'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to #13237

Comment on lines +51 to +54
- case "test" if (
- "any long condition" != "another long condition" and "this is a long condition"
- ):
+ case "test" if "any long condition" != "another long condition" and "this is a long condition":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to new preview style that parenthesizes long if conditions.

- | memoryview
- # comment with non-return annotation
- ),
+ # comment with non-return annotation
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+
#
-#

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff does not support form feed characters.

@konstin I think you were right on the on-site. It's form feed characters :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought we would, but maybe we only added this for the linter? #7489


class ClassC:
def f(self):
-
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff does not preserve empty lines at the beginning of a class (intentional decision)

+def bobtwo():
+ # some comment here
def bobtwo():
-
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff does not preserve empty lines between the class and any leading comment (intentional decision)

+++ Ruff
@@ -1,5 +1,4 @@
class Plotter:
-
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff does not preserve empty lines after a class (intentional deviation)

@MichaReiser MichaReiser merged commit d86e5ad into main Sep 17, 2024
20 checks passed
@MichaReiser MichaReiser deleted the micha/update-black-tests branch September 17, 2024 09:16
Copy link
Contributor

ruff-ecosystem results

Formatter (stable)

ℹ️ ecosystem check encountered format errors. (no format changes; 3 project errors)

apache/superset (error)

Failed to clone apache/superset: error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
error: 3365 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

zulip/zulip (error)

Failed to clone zulip/zulip: error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
error: 992 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

zanieb/huggingface-notebooks (error)

Failed to clone zanieb/huggingface-notebooks: fatal: early EOF
fatal: fetch-pack: invalid index-pack output

Formatter (preview)

✅ ecosystem check detected no format changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants