---
source: crates/ruff_python_formatter/src/lib.rs
expression: snapshot
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/comments_non_breaking_space.py
---
## Input

```py
from .config import (  ConfigTypeAttributes,    Int,    Path,    # String,
    # DEFAULT_TYPE_ATTRIBUTES,
)

result = 1  # A simple comment
result = (    1, ) # Another one

result = 1    # type: ignore
result = 1# This comment is talking about type: ignore
square = Square(4) # type: Optional[Square]

def function(a:int=42):
    """ This docstring is already formatted
       a
       b
    """
    #    There's a NBSP + 3 spaces before
    #    And 4 spaces on the next line
    pass
```

## Black Differences

```diff
--- Black
+++ Ruff
@@ -1,23 +1,22 @@
 from .config import (
     ConfigTypeAttributes,
     Int,
-    Path,  # String,
-    # DEFAULT_TYPE_ATTRIBUTES,
+    Path,  # String,
 )
 
-result = 1  # A simple comment
-result = (1,)  # Another one
+result = 1  # A simple comment
+result = (1,)  # Another one
 
-result = 1  #  type: ignore
-result = 1  # This comment is talking about type: ignore
-square = Square(4)  #  type: Optional[Square]
+result = 1  # type: ignore
+result = 1  # This comment is talking about type: ignore
+square = Square(4)  # type: Optional[Square]
 
 
 def function(a: int = 42):
-    """This docstring is already formatted
-    a
-    b
+    """ This docstring is already formatted
+       a
+       b
     """
-    #    There's a NBSP + 3 spaces before
+    #    There's a NBSP + 3 spaces before
     #    And 4 spaces on the next line
     pass
```

## Ruff Output

```py
from .config import (
    ConfigTypeAttributes,
    Int,
    Path,  # String,
)

result = 1  # A simple comment
result = (1,)  # Another one

result = 1  # type: ignore
result = 1  # This comment is talking about type: ignore
square = Square(4)  # type: Optional[Square]


def function(a: int = 42):
    """ This docstring is already formatted
       a
       b
    """
    #    There's a NBSP + 3 spaces before
    #    And 4 spaces on the next line
    pass
```

## Black Output

```py
from .config import (
    ConfigTypeAttributes,
    Int,
    Path,  # String,
    # DEFAULT_TYPE_ATTRIBUTES,
)

result = 1  # A simple comment
result = (1,)  # Another one

result = 1  #  type: ignore
result = 1  # This comment is talking about type: ignore
square = Square(4)  #  type: Optional[Square]


def function(a: int = 42):
    """This docstring is already formatted
    a
    b
    """
    #    There's a NBSP + 3 spaces before
    #    And 4 spaces on the next line
    pass
```


