-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set
target_version
in black tests and update tests
- Loading branch information
1 parent
8cb7950
commit 390adb4
Showing
55 changed files
with
996 additions
and
466 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
crates/ruff_python_formatter/resources/test/fixtures/black/cases/comment_type_hint.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# split out from comments2 as it does not work with line-length=1, losing the comment | ||
a = "type comment with trailing space" # type: str |
2 changes: 2 additions & 0 deletions
2
crates/ruff_python_formatter/resources/test/fixtures/black/cases/comment_type_hint.py.expect
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# split out from comments2 as it does not work with line-length=1, losing the comment | ||
a = "type comment with trailing space" # type: str |
This file contains 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
This file contains 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
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/fmtskip2.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# l2 loses the comment with line-length=1 in preview mode | ||
l1 = ["This list should be broken up", "into multiple lines", "because it is way too long"] | ||
l2 = ["But this list shouldn't", "even though it also has", "way too many characters in it"] # fmt: skip | ||
l3 = ["I have", "trailing comma", "so I should be braked",] |
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/fmtskip2.py.expect
This file contains 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
2 changes: 1 addition & 1 deletion
2
...atter/resources/test/fixtures/black/cases/funcdef_return_type_trailing_comma.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"preview": "enabled"} | ||
{"preview": "enabled", "target_version": "py310"} |
1 change: 1 addition & 0 deletions
1
...formatter/resources/test/fixtures/black/cases/parenthesized_context_managers.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py310"} |
1 change: 1 addition & 0 deletions
1
...ython_formatter/resources/test/fixtures/black/cases/pattern_matching_complex.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py310"} |
1 change: 1 addition & 0 deletions
1
...python_formatter/resources/test/fixtures/black/cases/pattern_matching_extras.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py310"} |
1 change: 1 addition & 0 deletions
1
...ython_formatter/resources/test/fixtures/black/cases/pattern_matching_generic.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py310"} |
1 change: 1 addition & 0 deletions
1
...python_formatter/resources/test/fixtures/black/cases/pattern_matching_simple.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py310"} |
1 change: 1 addition & 0 deletions
1
..._python_formatter/resources/test/fixtures/black/cases/pattern_matching_style.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py310"} |
2 changes: 1 addition & 1 deletion
2
...formatter/resources/test/fixtures/black/cases/pep604_union_types_line_breaks.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"preview": "enabled"} | ||
{"preview": "enabled", "target_version": "py310"} |
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/pep_570.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py38"} |
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/pep_572.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py38"} |
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/pep_572_py310.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py310"} |
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/pep_572_py39.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py39"} |
1 change: 1 addition & 0 deletions
1
...f_python_formatter/resources/test/fixtures/black/cases/pep_572_remove_parens.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py38"} |
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/pep_646.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py311"} |
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/pep_654.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py311"} |
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/pep_654_style.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"target_version": "py311"} |
1 change: 1 addition & 0 deletions
1
...formatter/resources/test/fixtures/black/cases/preview_allow_empty_first_line.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"preview": "enabled"} |
62 changes: 62 additions & 0 deletions
62
...ff_python_formatter/resources/test/fixtures/black/cases/preview_allow_empty_first_line.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
def foo(): | ||
""" | ||
Docstring | ||
""" | ||
|
||
# Here we go | ||
if x: | ||
|
||
# This is also now fine | ||
a = 123 | ||
|
||
else: | ||
# But not necessary | ||
a = 123 | ||
|
||
if y: | ||
|
||
while True: | ||
|
||
""" | ||
Long comment here | ||
""" | ||
a = 123 | ||
|
||
if z: | ||
|
||
for _ in range(100): | ||
a = 123 | ||
else: | ||
|
||
try: | ||
|
||
# this should be ok | ||
a = 123 | ||
except: | ||
|
||
"""also this""" | ||
a = 123 | ||
|
||
|
||
def bar(): | ||
|
||
if x: | ||
a = 123 | ||
|
||
|
||
def baz(): | ||
|
||
# OK | ||
if x: | ||
a = 123 | ||
|
||
def quux(): | ||
|
||
new_line = here | ||
|
||
|
||
class Cls: | ||
|
||
def method(self): | ||
|
||
pass |
62 changes: 62 additions & 0 deletions
62
...on_formatter/resources/test/fixtures/black/cases/preview_allow_empty_first_line.py.expect
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
def foo(): | ||
""" | ||
Docstring | ||
""" | ||
|
||
# Here we go | ||
if x: | ||
|
||
# This is also now fine | ||
a = 123 | ||
|
||
else: | ||
# But not necessary | ||
a = 123 | ||
|
||
if y: | ||
|
||
while True: | ||
|
||
""" | ||
Long comment here | ||
""" | ||
a = 123 | ||
|
||
if z: | ||
|
||
for _ in range(100): | ||
a = 123 | ||
else: | ||
|
||
try: | ||
|
||
# this should be ok | ||
a = 123 | ||
except: | ||
|
||
"""also this""" | ||
a = 123 | ||
|
||
|
||
def bar(): | ||
|
||
if x: | ||
a = 123 | ||
|
||
|
||
def baz(): | ||
|
||
# OK | ||
if x: | ||
a = 123 | ||
|
||
|
||
def quux(): | ||
|
||
new_line = here | ||
|
||
|
||
class Cls: | ||
def method(self): | ||
|
||
pass |
2 changes: 1 addition & 1 deletion
2
...on_formatter/resources/test/fixtures/black/cases/preview_context_managers_38.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"preview": "enabled"} | ||
{"preview": "enabled", "target_version": "py38"} |
2 changes: 1 addition & 1 deletion
2
...on_formatter/resources/test/fixtures/black/cases/preview_context_managers_39.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"preview": "enabled"} | ||
{"preview": "enabled", "target_version": "py39"} |
2 changes: 1 addition & 1 deletion
2
.../resources/test/fixtures/black/cases/preview_context_managers_autodetect_310.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"preview": "enabled"} | ||
{"preview": "enabled", "target_version": "py310"} |
2 changes: 1 addition & 1 deletion
2
.../resources/test/fixtures/black/cases/preview_context_managers_autodetect_311.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"preview": "enabled"} | ||
{"preview": "enabled", "target_version": "py311"} |
2 changes: 1 addition & 1 deletion
2
...r/resources/test/fixtures/black/cases/preview_context_managers_autodetect_39.options.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"preview": "enabled"} | ||
{"preview": "enabled", "target_version": "py39"} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.