mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:25:17 +00:00
Enforce valid format options in spec tests (#9021)
This commit is contained in:
parent
b4a050c21d
commit
ee6548d7dd
10 changed files with 83 additions and 39 deletions
|
@ -15,7 +15,6 @@ def g():
|
|||
# hi
|
||||
...
|
||||
|
||||
# FIXME(#8905): Uncomment, leads to unstable formatting
|
||||
# def h():
|
||||
# ...
|
||||
# # bye
|
||||
def h():
|
||||
...
|
||||
# bye
|
||||
|
|
|
@ -9,3 +9,12 @@ class MyClass:
|
|||
# fmt: on
|
||||
def method():
|
||||
print ( "str" )
|
||||
|
||||
@decor(
|
||||
a=1,
|
||||
# fmt: off
|
||||
b=(2, 3),
|
||||
# fmt: on
|
||||
)
|
||||
def func():
|
||||
pass
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# flags: --line-ranges=12-12
|
||||
# flags: --line-ranges=12-12 --line-ranges=21-21
|
||||
# NOTE: If you need to modify this file, pay special attention to the --line-ranges=
|
||||
# flag above as it's formatting specifically these lines.
|
||||
|
||||
|
@ -10,3 +10,12 @@ class MyClass:
|
|||
# fmt: on
|
||||
def method():
|
||||
print("str")
|
||||
|
||||
@decor(
|
||||
a=1,
|
||||
# fmt: off
|
||||
b=(2, 3),
|
||||
# fmt: on
|
||||
)
|
||||
def func():
|
||||
pass
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"line_length": 6}
|
||||
{"line_width": 6}
|
|
@ -1 +1 @@
|
|||
{"line_length": 0}
|
||||
{"line_width": 1}
|
|
@ -48,7 +48,8 @@ def import_fixture(fixture: Path, fixture_set: str):
|
|||
if "--line-length=" in flags:
|
||||
[_, length_and_rest] = flags.split("--line-length=", 1)
|
||||
length = length_and_rest.split(" ", 1)[0]
|
||||
options["line_length"] = int(length)
|
||||
length = int(length)
|
||||
options["line_width"] = 1 if length == 0 else length
|
||||
|
||||
if "--skip-magic-trailing-comma" in flags:
|
||||
options["magic_trailing_comma"] = "ignore"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue