Commit 19d69b34 authored by Łukasz Langa's avatar Łukasz Langa
Browse files

Fix placement of dictionary unpacking inside dict literals

Fixes #111
parent e41844fe
Loading
Loading
Loading
Loading
+2 −0
Changes for README.md: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -495,6 +495,8 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md).

* fixed parsing of unaligned standalone comments (#99, #112)

* fixed placement of dictionary unpacking inside dictionary literals (#111)

### 18.4a1

* added `--quiet` (#78)
+1 −1
Changes for black.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1498,7 +1498,7 @@ def is_split_before_delimiter(leaf: Leaf, previous: Leaf = None) -> int:
    if (
        leaf.type in VARARGS
        and leaf.parent
        and leaf.parent.type in {syms.argument, syms.typedargslist}
        and leaf.parent.type in {syms.argument, syms.typedargslist, syms.dictsetmaker}
    ):
        # * and ** might also be MATH_OPERATORS but in this case they are not.
        # Don't treat them as a delimiter.
+11 −1
Changes for tests/expression.diff: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@
 ]
 slice[0]
 slice[0:1]
@@ -114,78 +123,104 @@
@@ -114,79 +123,113 @@
 numpy[-(c + 1):, d]
 numpy[:, l[-2]]
 numpy[:, ::-1]
@@ -123,6 +123,16 @@
+((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
 (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
 (*starred)
-{"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}  # no trailing comma, this file is not 3.6+
+{
+    "id": "1",
+    "type": "type",
+    "started_at": now(),
+    "ended_at": now() + timedelta(days=10),
+    "priority": 1,
+    "import_session_id": 1,
+    **kwargs
+}  # no trailing comma, this file is not 3.6+
 a = (1,)
 b = 1,
 c = 1
+10 −0
Changes for tests/expression.py: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@
((i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c')))
(((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
(*starred)
{"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}  # no trailing comma, this file is not 3.6+
a = (1,)
b = 1,
c = 1
@@ -331,6 +332,15 @@ async def f():
((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
(((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
(*starred)
{
    "id": "1",
    "type": "type",
    "started_at": now(),
    "ended_at": now() + timedelta(days=10),
    "priority": 1,
    "import_session_id": 1,
    **kwargs
}  # no trailing comma, this file is not 3.6+
a = (1,)
b = 1,
c = 1