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

```python
my_dict = {
    "something_something":
        r"Lorem ipsum dolor sit amet, an sed convenire eloquentiam \t"
        r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t"
        r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t",
}

my_dict = {
    "a key in my dict": a_very_long_variable * and_a_very_long_function_call() / 100000.0
}

my_dict = {
    "a key in my dict": a_very_long_variable * and_a_very_long_function_call() * and_another_long_func() / 100000.0
}

my_dict = {
    "a key in my dict": MyClass.some_attribute.first_call().second_call().third_call(some_args="some value")
}

{
    'xxxxxx':
        xxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx(
            xxxxxxxxxxxxxx={
                'x':
                    xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=(
                            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                            .xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                                xxxxxxxxxxxxx=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                                .xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx={
                                        'x': x.xx,
                                        'x': x.x,
                                    }))))
            }),
}


class Random:
    def func():
        random_service.status.active_states.inactive = (
            make_new_top_level_state_from_dict(
                {
                    "topLevelBase": {
                        "secondaryBase": {
                            "timestamp": 1234,
                            "latitude": 1,
                            "longitude": 2,
                            "actionTimestamp": Timestamp(
                                seconds=1530584000, nanos=0
                            ).ToJsonString(),
                        }
                    },
                }
            )
        )
```

## Black Differences

```diff
--- Black
+++ Ruff
@@ -1,32 +1,26 @@
 my_dict = {
-    "something_something": (
-        r"Lorem ipsum dolor sit amet, an sed convenire eloquentiam \t"
-        r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t"
-        r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t"
-    ),
+    "something_something": r"Lorem ipsum dolor sit amet, an sed convenire eloquentiam \t"
+    r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t"
+    r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t",
 }
 
 my_dict = {
-    "a key in my dict": (
-        a_very_long_variable * and_a_very_long_function_call() / 100000.0
-    )
+    "a key in my dict": a_very_long_variable
+    * and_a_very_long_function_call()
+    / 100000.0
 }
 
 my_dict = {
-    "a key in my dict": (
-        a_very_long_variable
-        * and_a_very_long_function_call()
-        * and_another_long_func()
-        / 100000.0
-    )
+    "a key in my dict": a_very_long_variable
+    * and_a_very_long_function_call()
+    * and_another_long_func()
+    / 100000.0
 }
 
 my_dict = {
-    "a key in my dict": (
-        MyClass.some_attribute.first_call()
-        .second_call()
-        .third_call(some_args="some value")
-    )
+    "a key in my dict": MyClass.some_attribute.first_call()
+    .second_call()
+    .third_call(some_args="some value")
 }
 
 {
@@ -52,16 +46,18 @@
 class Random:
     def func():
         random_service.status.active_states.inactive = (
-            make_new_top_level_state_from_dict({
-                "topLevelBase": {
-                    "secondaryBase": {
-                        "timestamp": 1234,
-                        "latitude": 1,
-                        "longitude": 2,
-                        "actionTimestamp": (
-                            Timestamp(seconds=1530584000, nanos=0).ToJsonString()
-                        ),
-                    }
-                },
-            })
+            make_new_top_level_state_from_dict(
+                {
+                    "topLevelBase": {
+                        "secondaryBase": {
+                            "timestamp": 1234,
+                            "latitude": 1,
+                            "longitude": 2,
+                            "actionTimestamp": Timestamp(
+                                seconds=1530584000, nanos=0
+                            ).ToJsonString(),
+                        }
+                    },
+                }
+            )
         )
```

## Ruff Output

```python
my_dict = {
    "something_something": r"Lorem ipsum dolor sit amet, an sed convenire eloquentiam \t"
    r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t"
    r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t",
}

my_dict = {
    "a key in my dict": a_very_long_variable
    * and_a_very_long_function_call()
    / 100000.0
}

my_dict = {
    "a key in my dict": a_very_long_variable
    * and_a_very_long_function_call()
    * and_another_long_func()
    / 100000.0
}

my_dict = {
    "a key in my dict": MyClass.some_attribute.first_call()
    .second_call()
    .third_call(some_args="some value")
}

{
    "xxxxxx": xxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx(
        xxxxxxxxxxxxxx={
            "x": xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=(
                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                        xxxxxxxxxxxxx=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx={
                                "x": x.xx,
                                "x": x.x,
                            }
                        )
                    )
                )
            )
        }
    ),
}


class Random:
    def func():
        random_service.status.active_states.inactive = (
            make_new_top_level_state_from_dict(
                {
                    "topLevelBase": {
                        "secondaryBase": {
                            "timestamp": 1234,
                            "latitude": 1,
                            "longitude": 2,
                            "actionTimestamp": Timestamp(
                                seconds=1530584000, nanos=0
                            ).ToJsonString(),
                        }
                    },
                }
            )
        )
```

## Black Output

```python
my_dict = {
    "something_something": (
        r"Lorem ipsum dolor sit amet, an sed convenire eloquentiam \t"
        r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t"
        r"signiferumque, duo ea vocibus consetetur scriptorem. Facer \t"
    ),
}

my_dict = {
    "a key in my dict": (
        a_very_long_variable * and_a_very_long_function_call() / 100000.0
    )
}

my_dict = {
    "a key in my dict": (
        a_very_long_variable
        * and_a_very_long_function_call()
        * and_another_long_func()
        / 100000.0
    )
}

my_dict = {
    "a key in my dict": (
        MyClass.some_attribute.first_call()
        .second_call()
        .third_call(some_args="some value")
    )
}

{
    "xxxxxx": xxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx(
        xxxxxxxxxxxxxx={
            "x": xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=(
                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                        xxxxxxxxxxxxx=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
                            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx={
                                "x": x.xx,
                                "x": x.x,
                            }
                        )
                    )
                )
            )
        }
    ),
}


class Random:
    def func():
        random_service.status.active_states.inactive = (
            make_new_top_level_state_from_dict({
                "topLevelBase": {
                    "secondaryBase": {
                        "timestamp": 1234,
                        "latitude": 1,
                        "longitude": 2,
                        "actionTimestamp": (
                            Timestamp(seconds=1530584000, nanos=0).ToJsonString()
                        ),
                    }
                },
            })
        )
```
