Skip to content

Commit

Permalink
Update black tests (#8278)
Browse files Browse the repository at this point in the history
Update black tests to
psf/black@c369e44
  • Loading branch information
konstin committed Oct 27, 2023
1 parent e2b5c6a commit cd8e1ba
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flags: --pyi
from typing import Union

@bird
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
''''''

'\''
'"'
"'"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""""""

"'"
'"'
"'"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# flags: --preview --skip-string-normalization
class C:

r"""Raw"""

def f():

r"""Raw"""

class SingleQuotes:


r'''Raw'''

class UpperCaseR:
R"""Raw"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class C:
r"""Raw"""


def f():
r"""Raw"""


class SingleQuotes:
r'''Raw'''


class UpperCaseR:
R"""Raw"""
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ input_file: crates/ruff_python_formatter/resources/test/fixtures/black/miscellan
## Input

```py
# flags: --pyi
from typing import Union
@bird
Expand Down Expand Up @@ -42,7 +43,8 @@ def eggs() -> Union[str, int]: ...
```diff
--- Black
+++ Ruff
@@ -1,32 +1,58 @@
@@ -1,32 +1,59 @@
+# flags: --pyi
from typing import Union
+
Expand All @@ -67,13 +69,13 @@ def eggs() -> Union[str, int]: ...
- def BMethod(self, arg: List[str]) -> None: ...
+ def BMethod(self, arg: List[str]) -> None:
+ ...
+
+
+class C:
+ ...
-class C: ...
+class C:
+ ...
+
+
@hmm
-class D: ...
+class D:
Expand Down Expand Up @@ -118,6 +120,7 @@ def eggs() -> Union[str, int]: ...
## Ruff Output

```py
# flags: --pyi
from typing import Union
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ input_file: crates/ruff_python_formatter/resources/test/fixtures/black/miscellan

```py
''''''
'\''
'"'
"'"
Expand Down Expand Up @@ -69,7 +70,7 @@ f"\"{a}\"{'hello' * b}\"{c}\""
```diff
--- Black
+++ Ruff
@@ -24,7 +24,12 @@
@@ -25,7 +25,12 @@
r'Tricky "quote'
r"Not-so-tricky \"quote"
rf"{yay}"
Expand All @@ -89,6 +90,7 @@ f"\"{a}\"{'hello' * b}\"{c}\""

```py
""""""
"'"
'"'
"'"
Expand Down Expand Up @@ -151,6 +153,7 @@ f"\"{a}\"{'hello' * b}\"{c}\""
```py
""""""
"'"
'"'
"'"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
source: crates/ruff_python_formatter/tests/fixtures.rs
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/raw_docstring.py
---
## Input

```py
# flags: --preview --skip-string-normalization
class C:
r"""Raw"""
def f():
r"""Raw"""
class SingleQuotes:
r'''Raw'''
class UpperCaseR:
R"""Raw"""
```

## Black Differences

```diff
--- Black
+++ Ruff
@@ -1,4 +1,6 @@
+# flags: --preview --skip-string-normalization
class C:
+
r"""Raw"""
@@ -7,8 +9,9 @@
class SingleQuotes:
- r'''Raw'''
+ r"""Raw"""
+
class UpperCaseR:
R"""Raw"""
```

## Ruff Output

```py
# flags: --preview --skip-string-normalization
class C:
r"""Raw"""
def f():
r"""Raw"""
class SingleQuotes:
r"""Raw"""
class UpperCaseR:
R"""Raw"""
```

## Black Output

```py
class C:
r"""Raw"""
def f():
r"""Raw"""
class SingleQuotes:
r'''Raw'''
class UpperCaseR:
R"""Raw"""
```


0 comments on commit cd8e1ba

Please sign in to comment.