diff --git a/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.options.json b/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.options.json new file mode 100644 index 0000000000000..cf266d35406c4 --- /dev/null +++ b/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.options.json @@ -0,0 +1 @@ +{"target_version": "py312"} \ No newline at end of file diff --git a/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py b/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py new file mode 100644 index 0000000000000..7c365c27c3868 --- /dev/null +++ b/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py @@ -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)) diff --git a/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py.expect b/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py.expect new file mode 100644 index 0000000000000..8c7278beb4947 --- /dev/null +++ b/crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_aliases.py.expect @@ -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)) diff --git a/crates/ruff_python_formatter/resources/test/fixtures/import_black_tests.py b/crates/ruff_python_formatter/resources/test/fixtures/import_black_tests.py index be1602f9ab96f..552a1fe8b255f 100755 --- a/crates/ruff_python_formatter/resources/test/fixtures/import_black_tests.py +++ b/crates/ruff_python_formatter/resources/test/fixtures/import_black_tests.py @@ -96,9 +96,6 @@ def import_fixture(fixture: Path, fixture_set: str): # Uses a different output format "decorators.py", - - # Ruff fails to parse because of a parser bug - "type_aliases.py" # #8900 #8899 ]