From 174fc47b7893b98d4a4393da849c09b6bd415764 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Thu, 15 Mar 2018 11:28:59 -0700 Subject: [PATCH 1/1] Fix spurious space in parenthesized set expressions Fixes #7 --- README.md | 2 ++ black.py | 1 + tests/expression.py | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 28f79db..63fb4b2 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,8 @@ You can still try but prepare to be disappointed. * fixed invalid spacing of dots in relative imports (#6, #13) +* fixed spurious space in parenthesized set expressions (#7) + ### 18.3a0 diff --git a/black.py b/black.py index 7ae2627..64df7f7 100644 --- a/black.py +++ b/black.py @@ -895,6 +895,7 @@ def whitespace(leaf: Leaf) -> str: syms.or_test, syms.and_test, syms.arith_expr, + syms.expr, syms.shift_expr, syms.yield_expr, syms.term, diff --git a/tests/expression.py b/tests/expression.py index 3291dc2..1d9f0ab 100644 --- a/tests/expression.py +++ b/tests/expression.py @@ -106,6 +106,8 @@ a = (1,) b = 1, c = 1 d = (1,) + a + (2,) +what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove) +what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove) def gen(): @@ -228,6 +230,12 @@ a = (1,) b = 1, c = 1 d = (1,) + a + (2,) +what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set( + vars_to_remove +) +what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set( + vars_to_remove +) def gen(): -- 2.39.5