Skip to content

Commit

Permalink
test only in 3.8+
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Dec 10, 2022
1 parent bae256b commit 8310b81
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
9 changes: 0 additions & 9 deletions tests/data/preview/return_annotation_brackets.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ def foo() -> tuple[int, int, int,]:
def frobnicate() -> "ThisIsTrulyUnreasonablyExtremelyLongClassName | list[ThisIsTrulyUnreasonablyExtremelyLongClassName]":
pass

# Should not remove parens around walrus operator
def walrus() -> (x := 1):
pass

# output
# Control
def double(a: int) -> int:
Expand Down Expand Up @@ -224,8 +220,3 @@ def frobnicate() -> (
" list[ThisIsTrulyUnreasonablyExtremelyLongClassName]"
):
pass


# Should not remove parens around walrus operator
def walrus() -> (x := 1):
pass
9 changes: 9 additions & 0 deletions tests/data/preview_38/return_annotation_brackets_py38.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Should not remove parens around walrus operator
def walrus() -> (x := 1):
pass


# output
# Should not remove parens around walrus operator
def walrus() -> (x := 1):
pass
7 changes: 7 additions & 0 deletions tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ def test_preview_format(filename: str) -> None:
)


@pytest.mark.parametrize("filename", all_data_cases("preview_38"))
def test_preview_minimum_python_38_format(filename: str) -> None:
source, expected = read_data("preview_38", filename)
mode = black.Mode(preview=True)
assert_format(source, expected, mode, minimum_version=(3, 9))


@pytest.mark.parametrize("filename", all_data_cases("preview_39"))
def test_preview_minimum_python_39_format(filename: str) -> None:
source, expected = read_data("preview_39", filename)
Expand Down

0 comments on commit 8310b81

Please sign in to comment.