mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:10:09 +00:00
Import Black's type aliases test (#9456)
This commit is contained in:
parent
58fcd96ac1
commit
79f4abbb8d
4 changed files with 26 additions and 3 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.options.json
vendored
Normal file
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.options.json
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"target_version": "py312"}
|
10
crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py
vendored
Normal file
10
crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
type A=int
|
||||||
|
type Gen[T]=list[T]
|
||||||
|
type Alias[T]=lambda: T
|
||||||
|
type And[T]=T and T
|
||||||
|
type IfElse[T]=T if T else T
|
||||||
|
type One = int; type Another = str
|
||||||
|
class X: type InClass = int
|
||||||
|
|
||||||
|
type = aliased
|
||||||
|
print(type(42))
|
15
crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py.expect
vendored
Normal file
15
crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py.expect
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
type A = int
|
||||||
|
type Gen[T] = list[T]
|
||||||
|
type Alias[T] = lambda: T
|
||||||
|
type And[T] = T and T
|
||||||
|
type IfElse[T] = T if T else T
|
||||||
|
type One = int
|
||||||
|
type Another = str
|
||||||
|
|
||||||
|
|
||||||
|
class X:
|
||||||
|
type InClass = int
|
||||||
|
|
||||||
|
|
||||||
|
type = aliased
|
||||||
|
print(type(42))
|
|
@ -96,9 +96,6 @@ IGNORE_LIST = [
|
||||||
|
|
||||||
# Uses a different output format
|
# Uses a different output format
|
||||||
"decorators.py",
|
"decorators.py",
|
||||||
|
|
||||||
# Ruff fails to parse because of a parser bug
|
|
||||||
"type_aliases.py" # #8900 #8899
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue