Update black tests (#8278)

Update black tests to
c369e446f9
This commit is contained in:
konsti 2023-10-27 12:44:19 +02:00 committed by GitHub
parent e2b5c6ac5f
commit cd8e1bad64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 137 additions and 6 deletions

View file

@ -1,3 +1,4 @@
# flags: --pyi
from typing import Union from typing import Union
@bird @bird

View file

@ -1,4 +1,5 @@
'''''' ''''''
'\'' '\''
'"' '"'
"'" "'"

View file

@ -1,4 +1,5 @@
"""""" """"""
"'" "'"
'"' '"'
"'" "'"

View file

@ -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"""

View file

@ -0,0 +1,14 @@
class C:
r"""Raw"""
def f():
r"""Raw"""
class SingleQuotes:
r'''Raw'''
class UpperCaseR:
R"""Raw"""

View file

@ -5,6 +5,7 @@ input_file: crates/ruff_python_formatter/resources/test/fixtures/black/miscellan
## Input ## Input
```py ```py
# flags: --pyi
from typing import Union from typing import Union
@bird @bird
@ -42,7 +43,8 @@ def eggs() -> Union[str, int]: ...
```diff ```diff
--- Black --- Black
+++ Ruff +++ Ruff
@@ -1,32 +1,58 @@ @@ -1,32 +1,59 @@
+# flags: --pyi
from typing import Union from typing import Union
+ +
@ -67,13 +69,13 @@ def eggs() -> Union[str, int]: ...
- def BMethod(self, arg: List[str]) -> None: ... - def BMethod(self, arg: List[str]) -> None: ...
+ def BMethod(self, arg: List[str]) -> None: + def BMethod(self, arg: List[str]) -> None:
+ ... + ...
+
+
+class C:
+ ...
-class C: ... -class C: ...
+class C:
+ ...
+
+
@hmm @hmm
-class D: ... -class D: ...
+class D: +class D:
@ -118,6 +120,7 @@ def eggs() -> Union[str, int]: ...
## Ruff Output ## Ruff Output
```py ```py
# flags: --pyi
from typing import Union from typing import Union

View file

@ -6,6 +6,7 @@ input_file: crates/ruff_python_formatter/resources/test/fixtures/black/miscellan
```py ```py
'''''' ''''''
'\'' '\''
'"' '"'
"'" "'"
@ -69,7 +70,7 @@ f"\"{a}\"{'hello' * b}\"{c}\""
```diff ```diff
--- Black --- Black
+++ Ruff +++ Ruff
@@ -24,7 +24,12 @@ @@ -25,7 +25,12 @@
r'Tricky "quote' r'Tricky "quote'
r"Not-so-tricky \"quote" r"Not-so-tricky \"quote"
rf"{yay}" rf"{yay}"
@ -89,6 +90,7 @@ f"\"{a}\"{'hello' * b}\"{c}\""
```py ```py
"""""" """"""
"'" "'"
'"' '"'
"'" "'"
@ -151,6 +153,7 @@ f"\"{a}\"{'hello' * b}\"{c}\""
```py ```py
"""""" """"""
"'" "'"
'"' '"'
"'" "'"

View file

@ -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"""
```