---
source: crates/ruff_python_formatter/tests/fixtures.rs
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/remove_redundant_parens_in_case_guard.py
---
## Input

```python
match 1:
    case _ if (True):
        pass


match 1:
    case _ if (
        True
    ):
        pass


match 1:
    case _ if (
        # this is a comment
        True
    ):
        pass


match 1:
    case _ if (
        True
        # this is a comment
    ):
        pass


match 1:
    case _ if (
        True  # this is a comment
    ):
        pass


match 1:
    case _ if (  # this is a comment
        True
    ):
        pass


match 1:
    case _ if (
        True
    ):  # this is a comment
        pass


match 1:
    case _ if (True):  # comment over the line limit unless parens are removed x
        pass


match 1:
    case _ if (True):  # comment over the line limit and parens should go to next line
        pass
```

## Black Differences

```diff
--- Black
+++ Ruff
@@ -1,10 +1,10 @@
 match 1:
-    case _ if True:
+    case _ if (True):
         pass
 
 
 match 1:
-    case _ if True:
+    case _ if (True):
         pass
 
 
@@ -25,27 +25,33 @@
 
 
 match 1:
-    case _ if True:  # this is a comment
+    case _ if (
+        True  # this is a comment
+    ):
         pass
 
 
 match 1:
-    case _ if True:  # this is a comment
+    case _ if (  # this is a comment
+        True
+    ):
         pass
 
 
 match 1:
-    case _ if True:  # this is a comment
+    case _ if (True):  # this is a comment
         pass
 
 
 match 1:
-    case _ if True:  # comment over the line limit unless parens are removed x
+    case _ if (
+        True
+    ):  # comment over the line limit unless parens are removed x
         pass
 
 
 match 1:
-    case (
-        _
-    ) if True:  # comment over the line limit and parens should go to next line
+    case _ if (
+        True
+    ):  # comment over the line limit and parens should go to next line
         pass
```

## Ruff Output

```python
match 1:
    case _ if (True):
        pass


match 1:
    case _ if (True):
        pass


match 1:
    case _ if (
        # this is a comment
        True
    ):
        pass


match 1:
    case _ if (
        True
        # this is a comment
    ):
        pass


match 1:
    case _ if (
        True  # this is a comment
    ):
        pass


match 1:
    case _ if (  # this is a comment
        True
    ):
        pass


match 1:
    case _ if (True):  # this is a comment
        pass


match 1:
    case _ if (
        True
    ):  # comment over the line limit unless parens are removed x
        pass


match 1:
    case _ if (
        True
    ):  # comment over the line limit and parens should go to next line
        pass
```

## Black Output

```python
match 1:
    case _ if True:
        pass


match 1:
    case _ if True:
        pass


match 1:
    case _ if (
        # this is a comment
        True
    ):
        pass


match 1:
    case _ if (
        True
        # this is a comment
    ):
        pass


match 1:
    case _ if True:  # this is a comment
        pass


match 1:
    case _ if True:  # this is a comment
        pass


match 1:
    case _ if True:  # this is a comment
        pass


match 1:
    case _ if True:  # comment over the line limit unless parens are removed x
        pass


match 1:
    case (
        _
    ) if True:  # comment over the line limit and parens should go to next line
        pass
```
